@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * \ingroup project |
| 25 | 25 | * \brief This file is a CRUD class file for Task (Create/Read/Update/Delete) |
| 26 | 26 | */ |
| 27 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 27 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Class to manage tasks |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public $fk_element = 'fk_task'; |
| 49 | 49 | public $picto = 'task'; |
| 50 | - protected $childtables = array('projet_task_time'); // To test if we can delete object |
|
| 50 | + protected $childtables = array('projet_task_time'); // To test if we can delete object |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var int ID parent task |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @var string description |
| 64 | 64 | */ |
| 65 | 65 | public $description; |
| 66 | - public $duration_effective; // total of time spent on this task |
|
| 66 | + public $duration_effective; // total of time spent on this task |
|
| 67 | 67 | public $planned_workload; |
| 68 | 68 | public $date_c; |
| 69 | 69 | public $date_start; |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | public $timespent_duration; |
| 99 | 99 | public $timespent_old_duration; |
| 100 | 100 | public $timespent_date; |
| 101 | - public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) |
|
| 102 | - public $timespent_withhour; // 1 = we entered also start hours for timesheet line |
|
| 101 | + public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) |
|
| 102 | + public $timespent_withhour; // 1 = we entered also start hours for timesheet line |
|
| 103 | 103 | public $timespent_fk_user; |
| 104 | 104 | public $timespent_note; |
| 105 | 105 | public $comments = array(); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | // Check parameters |
| 136 | 136 | // Put here code to add control on parameters values |
| 137 | 137 | // Insert request |
| 138 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet_task ("; |
|
| 138 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; |
|
| 139 | 139 | $sql .= "fk_projet"; |
| 140 | 140 | $sql .= ", ref"; |
| 141 | 141 | $sql .= ", fk_task_parent"; |
@@ -149,29 +149,29 @@ discard block |
||
| 149 | 149 | $sql .= ", progress"; |
| 150 | 150 | $sql .= ") VALUES ("; |
| 151 | 151 | $sql .= $this->fk_project; |
| 152 | - $sql .= ", " . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'null'); |
|
| 153 | - $sql .= ", " . $this->fk_task_parent; |
|
| 154 | - $sql .= ", '" . $this->db->escape($this->label) . "'"; |
|
| 155 | - $sql .= ", '" . $this->db->escape($this->description) . "'"; |
|
| 156 | - $sql .= ", '" . $this->db->idate($this->date_c) . "'"; |
|
| 157 | - $sql .= ", " . $user->id; |
|
| 158 | - $sql .= ", " . ($this->date_start != '' ? "'" . $this->db->idate($this->date_start) . "'" : 'null'); |
|
| 159 | - $sql .= ", " . ($this->date_end != '' ? "'" . $this->db->idate($this->date_end) . "'" : 'null'); |
|
| 160 | - $sql .= ", " . (($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); |
|
| 161 | - $sql .= ", " . (($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); |
|
| 152 | + $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); |
|
| 153 | + $sql .= ", ".$this->fk_task_parent; |
|
| 154 | + $sql .= ", '".$this->db->escape($this->label)."'"; |
|
| 155 | + $sql .= ", '".$this->db->escape($this->description)."'"; |
|
| 156 | + $sql .= ", '".$this->db->idate($this->date_c)."'"; |
|
| 157 | + $sql .= ", ".$user->id; |
|
| 158 | + $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); |
|
| 159 | + $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); |
|
| 160 | + $sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); |
|
| 161 | + $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); |
|
| 162 | 162 | $sql .= ")"; |
| 163 | 163 | |
| 164 | 164 | $this->db->begin(); |
| 165 | 165 | |
| 166 | - dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 166 | + dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 167 | 167 | $resql = $this->db->query($sql); |
| 168 | 168 | if (!$resql) { |
| 169 | 169 | $error++; |
| 170 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 170 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (!$error) { |
| 174 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "projet_task"); |
|
| 174 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task"); |
|
| 175 | 175 | |
| 176 | 176 | if (!$notrigger) { |
| 177 | 177 | // Call trigger |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | // Commit or rollback |
| 197 | 197 | if ($error) { |
| 198 | 198 | foreach ($this->errors as $errmsg) { |
| 199 | - dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); |
|
| 200 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 199 | + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); |
|
| 200 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 201 | 201 | } |
| 202 | 202 | $this->db->rollback(); |
| 203 | 203 | return -1 * $error; |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | $sql .= ", t2.ref as task_parent_ref"; |
| 244 | 244 | $sql .= ", t2.rang as task_parent_position"; |
| 245 | 245 | } |
| 246 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as t"; |
|
| 246 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 247 | 247 | if (!empty($loadparentdata)) |
| 248 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t2 ON t.fk_task_parent = t2.rowid"; |
|
| 248 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t2 ON t.fk_task_parent = t2.rowid"; |
|
| 249 | 249 | $sql .= " WHERE "; |
| 250 | 250 | if (!empty($ref)) { |
| 251 | - $sql .= "t.ref = '" . $this->db->escape($ref) . "'"; |
|
| 251 | + $sql .= "t.ref = '".$this->db->escape($ref)."'"; |
|
| 252 | 252 | } else { |
| 253 | - $sql .= "t.rowid = " . $id; |
|
| 253 | + $sql .= "t.rowid = ".$id; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 256 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 257 | 257 | $resql = $this->db->query($sql); |
| 258 | 258 | if ($resql) { |
| 259 | 259 | $num_rows = $this->db->num_rows($resql); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | return 0; |
| 299 | 299 | } |
| 300 | 300 | } else { |
| 301 | - $this->error = "Error " . $this->db->lasterror(); |
|
| 301 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 302 | 302 | return -1; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -341,27 +341,27 @@ discard block |
||
| 341 | 341 | // Check parameters |
| 342 | 342 | // Put here code to add control on parameters values |
| 343 | 343 | // Update request |
| 344 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task SET"; |
|
| 345 | - $sql .= " fk_projet=" . (isset($this->fk_project) ? $this->fk_project : "null") . ","; |
|
| 346 | - $sql .= " ref=" . (isset($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : "'" . $this->db->escape($this->id) . "'") . ","; |
|
| 347 | - $sql .= " fk_task_parent=" . (isset($this->fk_task_parent) ? $this->fk_task_parent : "null") . ","; |
|
| 348 | - $sql .= " label=" . (isset($this->label) ? "'" . $this->db->escape($this->label) . "'" : "null") . ","; |
|
| 349 | - $sql .= " description=" . (isset($this->description) ? "'" . $this->db->escape($this->description) . "'" : "null") . ","; |
|
| 350 | - $sql .= " duration_effective=" . (isset($this->duration_effective) ? $this->duration_effective : "null") . ","; |
|
| 351 | - $sql .= " planned_workload=" . ((isset($this->planned_workload) && $this->planned_workload != '') ? $this->planned_workload : "null") . ","; |
|
| 352 | - $sql .= " dateo=" . ($this->date_start != '' ? "'" . $this->db->idate($this->date_start) . "'" : 'null') . ","; |
|
| 353 | - $sql .= " datee=" . ($this->date_end != '' ? "'" . $this->db->idate($this->date_end) . "'" : 'null') . ","; |
|
| 354 | - $sql .= " progress=" . (($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null') . ","; |
|
| 355 | - $sql .= " rang=" . ((!empty($this->rang)) ? $this->rang : "0"); |
|
| 356 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 344 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET"; |
|
| 345 | + $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; |
|
| 346 | + $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "'".$this->db->escape($this->id)."'").","; |
|
| 347 | + $sql .= " fk_task_parent=".(isset($this->fk_task_parent) ? $this->fk_task_parent : "null").","; |
|
| 348 | + $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; |
|
| 349 | + $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; |
|
| 350 | + $sql .= " duration_effective=".(isset($this->duration_effective) ? $this->duration_effective : "null").","; |
|
| 351 | + $sql .= " planned_workload=".((isset($this->planned_workload) && $this->planned_workload != '') ? $this->planned_workload : "null").","; |
|
| 352 | + $sql .= " dateo=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null').","; |
|
| 353 | + $sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').","; |
|
| 354 | + $sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').","; |
|
| 355 | + $sql .= " rang=".((!empty($this->rang)) ? $this->rang : "0"); |
|
| 356 | + $sql .= " WHERE rowid=".$this->id; |
|
| 357 | 357 | |
| 358 | 358 | $this->db->begin(); |
| 359 | 359 | |
| 360 | - dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 360 | + dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 361 | 361 | $resql = $this->db->query($sql); |
| 362 | 362 | if (!$resql) { |
| 363 | 363 | $error++; |
| 364 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 364 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | // Update extrafield |
@@ -391,10 +391,10 @@ discard block |
||
| 391 | 391 | $project = new Project($this->db); |
| 392 | 392 | $project->fetch($this->fk_project); |
| 393 | 393 | |
| 394 | - $olddir = $conf->projet->dir_output . '/' . dol_sanitizeFileName($project->ref) . '/' . dol_sanitizeFileName($this->oldcopy->ref); |
|
| 395 | - $newdir = $conf->projet->dir_output . '/' . dol_sanitizeFileName($project->ref) . '/' . dol_sanitizeFileName($this->ref); |
|
| 394 | + $olddir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->oldcopy->ref); |
|
| 395 | + $newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref); |
|
| 396 | 396 | if (file_exists($olddir)) { |
| 397 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 397 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 398 | 398 | $res = dol_move($olddir, $newdir); |
| 399 | 399 | if (!$res) { |
| 400 | 400 | $langs->load("errors"); |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | // Commit or rollback |
| 409 | 409 | if ($error) { |
| 410 | 410 | foreach ($this->errors as $errmsg) { |
| 411 | - dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); |
|
| 412 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 411 | + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); |
|
| 412 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 413 | 413 | } |
| 414 | 414 | $this->db->rollback(); |
| 415 | 415 | return -1 * $error; |
@@ -430,14 +430,14 @@ discard block |
||
| 430 | 430 | { |
| 431 | 431 | |
| 432 | 432 | global $conf, $langs; |
| 433 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 433 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 434 | 434 | |
| 435 | 435 | $error = 0; |
| 436 | 436 | |
| 437 | 437 | $this->db->begin(); |
| 438 | 438 | |
| 439 | 439 | if ($this->hasChildren() > 0) { |
| 440 | - dol_syslog(get_class($this) . "::delete Can't delete record as it has some sub tasks", LOG_WARNING); |
|
| 440 | + dol_syslog(get_class($this)."::delete Can't delete record as it has some sub tasks", LOG_WARNING); |
|
| 441 | 441 | $this->error = 'ErrorRecordHasSubTasks'; |
| 442 | 442 | $this->db->rollback(); |
| 443 | 443 | return 0; |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | $objectisused = $this->isObjectUsed($this->id); |
| 447 | 447 | if (!empty($objectisused)) { |
| 448 | - dol_syslog(get_class($this) . "::delete Can't delete record as it has some child", LOG_WARNING); |
|
| 448 | + dol_syslog(get_class($this)."::delete Can't delete record as it has some child", LOG_WARNING); |
|
| 449 | 449 | $this->error = 'ErrorRecordHasChildren'; |
| 450 | 450 | $this->db->rollback(); |
| 451 | 451 | return 0; |
@@ -463,35 +463,35 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | if (!$error) { |
| 466 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time"; |
|
| 467 | - $sql .= " WHERE fk_task=" . $this->id; |
|
| 466 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; |
|
| 467 | + $sql .= " WHERE fk_task=".$this->id; |
|
| 468 | 468 | |
| 469 | 469 | $resql = $this->db->query($sql); |
| 470 | 470 | if (!$resql) { |
| 471 | 471 | $error++; |
| 472 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 472 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 473 | 473 | } |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | if (!$error) { |
| 477 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields"; |
|
| 478 | - $sql .= " WHERE fk_object=" . $this->id; |
|
| 477 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_extrafields"; |
|
| 478 | + $sql .= " WHERE fk_object=".$this->id; |
|
| 479 | 479 | |
| 480 | 480 | $resql = $this->db->query($sql); |
| 481 | 481 | if (!$resql) { |
| 482 | 482 | $error++; |
| 483 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 483 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | if (!$error) { |
| 488 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task"; |
|
| 489 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 488 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task"; |
|
| 489 | + $sql .= " WHERE rowid=".$this->id; |
|
| 490 | 490 | |
| 491 | 491 | $resql = $this->db->query($sql); |
| 492 | 492 | if (!$resql) { |
| 493 | 493 | $error++; |
| 494 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 494 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | 497 | |
@@ -509,8 +509,8 @@ discard block |
||
| 509 | 509 | // Commit or rollback |
| 510 | 510 | if ($error) { |
| 511 | 511 | foreach ($this->errors as $errmsg) { |
| 512 | - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); |
|
| 513 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 512 | + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
|
| 513 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 514 | 514 | } |
| 515 | 515 | $this->db->rollback(); |
| 516 | 516 | return -1 * $error; |
@@ -520,10 +520,10 @@ discard block |
||
| 520 | 520 | $projectstatic = new Project($this->db); |
| 521 | 521 | $projectstatic->fetch($this->fk_project); |
| 522 | 522 | |
| 523 | - $dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref) . '/' . dol_sanitizeFileName($this->id); |
|
| 524 | - dol_syslog(get_class($this) . "::delete dir=" . $dir, LOG_DEBUG); |
|
| 523 | + $dir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($this->id); |
|
| 524 | + dol_syslog(get_class($this)."::delete dir=".$dir, LOG_DEBUG); |
|
| 525 | 525 | if (file_exists($dir)) { |
| 526 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 526 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 527 | 527 | $res = @dol_delete_dir_recursive($dir); |
| 528 | 528 | if (!$res) { |
| 529 | 529 | $this->error = 'ErrorFailToDeleteDir'; |
@@ -550,14 +550,14 @@ discard block |
||
| 550 | 550 | $ret = 0; |
| 551 | 551 | |
| 552 | 552 | $sql = "SELECT COUNT(*) as nb"; |
| 553 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task"; |
|
| 554 | - $sql .= " WHERE fk_task_parent=" . $this->id; |
|
| 553 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task"; |
|
| 554 | + $sql .= " WHERE fk_task_parent=".$this->id; |
|
| 555 | 555 | |
| 556 | - dol_syslog(get_class($this) . "::hasChildren", LOG_DEBUG); |
|
| 556 | + dol_syslog(get_class($this)."::hasChildren", LOG_DEBUG); |
|
| 557 | 557 | $resql = $this->db->query($sql); |
| 558 | 558 | if (!$resql) { |
| 559 | 559 | $error++; |
| 560 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 560 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 561 | 561 | } else { |
| 562 | 562 | $obj = $this->db->fetch_object($resql); |
| 563 | 563 | if ($obj) |
@@ -583,14 +583,14 @@ discard block |
||
| 583 | 583 | $ret = 0; |
| 584 | 584 | |
| 585 | 585 | $sql = "SELECT COUNT(*) as nb"; |
| 586 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time"; |
|
| 587 | - $sql .= " WHERE fk_task=" . $this->id; |
|
| 586 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time"; |
|
| 587 | + $sql .= " WHERE fk_task=".$this->id; |
|
| 588 | 588 | |
| 589 | - dol_syslog(get_class($this) . "::hasTimeSpent", LOG_DEBUG); |
|
| 589 | + dol_syslog(get_class($this)."::hasTimeSpent", LOG_DEBUG); |
|
| 590 | 590 | $resql = $this->db->query($sql); |
| 591 | 591 | if (!$resql) { |
| 592 | 592 | $error++; |
| 593 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 593 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 594 | 594 | } else { |
| 595 | 595 | $obj = $this->db->fetch_object($resql); |
| 596 | 596 | if ($obj) |
@@ -622,19 +622,19 @@ discard block |
||
| 622 | 622 | global $conf, $langs, $user; |
| 623 | 623 | |
| 624 | 624 | if (!empty($conf->dol_no_mouse_hover)) |
| 625 | - $notooltip = 1; // Force disable tooltips |
|
| 625 | + $notooltip = 1; // Force disable tooltips |
|
| 626 | 626 | |
| 627 | 627 | $result = ''; |
| 628 | - $label = '<u>' . $langs->trans("ShowTask") . '</u>'; |
|
| 628 | + $label = '<u>'.$langs->trans("ShowTask").'</u>'; |
|
| 629 | 629 | if (!empty($this->ref)) |
| 630 | - $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 630 | + $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 631 | 631 | if (!empty($this->label)) |
| 632 | - $label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label; |
|
| 632 | + $label .= '<br><b>'.$langs->trans('LabelTask').':</b> '.$this->label; |
|
| 633 | 633 | if ($this->date_start || $this->date_end) { |
| 634 | - $label .= "<br>" . get_date_range($this->date_start, $this->date_end, '', $langs, 0); |
|
| 634 | + $label .= "<br>".get_date_range($this->date_start, $this->date_end, '', $langs, 0); |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | - $url = DOL_URL_ROOT . '/projet/tasks/' . $mode . '.php?id=' . $this->id . ($option == 'withproject' ? '&withproject=1' : ''); |
|
| 637 | + $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : ''); |
|
| 638 | 638 | // Add param to save lastsearch_values or not |
| 639 | 639 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 640 | 640 | if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) |
@@ -646,26 +646,26 @@ discard block |
||
| 646 | 646 | if (empty($notooltip)) { |
| 647 | 647 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
| 648 | 648 | $label = $langs->trans("ShowTask"); |
| 649 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 649 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 650 | 650 | } |
| 651 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 651 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 652 | 652 | $linkclose .= ' class="classfortooltip"'; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - $linkstart = '<a href="' . $url . '"'; |
|
| 656 | - $linkstart .= $linkclose . '>'; |
|
| 655 | + $linkstart = '<a href="'.$url.'"'; |
|
| 656 | + $linkstart .= $linkclose.'>'; |
|
| 657 | 657 | $linkend = '</a>'; |
| 658 | 658 | |
| 659 | 659 | $picto = 'projecttask'; |
| 660 | 660 | |
| 661 | 661 | $result .= $linkstart; |
| 662 | 662 | if ($withpicto) |
| 663 | - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 663 | + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 664 | 664 | if ($withpicto != 2) |
| 665 | 665 | $result .= $this->ref; |
| 666 | 666 | $result .= $linkend; |
| 667 | 667 | if ($withpicto != 2) |
| 668 | - $result .= (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
|
| 668 | + $result .= (($addlabel && $this->label) ? $sep.dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
|
| 669 | 669 | |
| 670 | 670 | return $result; |
| 671 | 671 | } |
@@ -718,38 +718,38 @@ discard block |
||
| 718 | 718 | // List of tasks (does not care about permissions. Filtering will be done later) |
| 719 | 719 | $sql = "SELECT "; |
| 720 | 720 | if ($filteronprojuser > 0 || $filterontaskuser > 0) |
| 721 | - $sql .= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task |
|
| 721 | + $sql .= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task |
|
| 722 | 722 | $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,"; |
| 723 | 723 | $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; |
| 724 | 724 | $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; |
| 725 | 725 | $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email"; |
| 726 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p"; |
|
| 727 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON p.fk_soc = s.rowid"; |
|
| 726 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
| 727 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; |
|
| 728 | 728 | if ($mode == 0) { |
| 729 | 729 | if ($filteronprojuser > 0) { |
| 730 | - $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec"; |
|
| 731 | - $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc"; |
|
| 730 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
| 731 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
| 732 | 732 | } |
| 733 | - $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t"; |
|
| 733 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 734 | 734 | if ($filterontaskuser > 0) { |
| 735 | - $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec2"; |
|
| 736 | - $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc2"; |
|
| 735 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2"; |
|
| 736 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; |
|
| 737 | 737 | } |
| 738 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 738 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 739 | 739 | $sql .= " AND t.fk_projet = p.rowid"; |
| 740 | 740 | } elseif ($mode == 1) { |
| 741 | 741 | if ($filteronprojuser > 0) { |
| 742 | - $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec"; |
|
| 743 | - $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc"; |
|
| 742 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
| 743 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
| 744 | 744 | } |
| 745 | 745 | if ($filterontaskuser > 0) { |
| 746 | - $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t"; |
|
| 747 | - $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec2"; |
|
| 748 | - $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc2"; |
|
| 746 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 747 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2"; |
|
| 748 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; |
|
| 749 | 749 | } else { |
| 750 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t on t.fk_projet = p.rowid"; |
|
| 750 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; |
|
| 751 | 751 | } |
| 752 | - $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
|
| 752 | + $sql .= " WHERE p.entity IN (".getEntity('project').")"; |
|
| 753 | 753 | } else |
| 754 | 754 | return 'BadValueForParameterMode'; |
| 755 | 755 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | $sql .= " AND p.rowid = ec.element_id"; |
| 758 | 758 | $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; |
| 759 | 759 | $sql .= " AND ctc.element = 'project'"; |
| 760 | - $sql .= " AND ec.fk_socpeople = " . $filteronprojuser; |
|
| 760 | + $sql .= " AND ec.fk_socpeople = ".$filteronprojuser; |
|
| 761 | 761 | $sql .= " AND ec.statut = 4"; |
| 762 | 762 | $sql .= " AND ctc.source = 'internal'"; |
| 763 | 763 | } |
@@ -766,24 +766,24 @@ discard block |
||
| 766 | 766 | $sql .= " AND p.rowid = ec2.element_id"; |
| 767 | 767 | $sql .= " AND ctc2.rowid = ec2.fk_c_type_contact"; |
| 768 | 768 | $sql .= " AND ctc2.element = 'project_task'"; |
| 769 | - $sql .= " AND ec2.fk_socpeople = " . $filterontaskuser; |
|
| 769 | + $sql .= " AND ec2.fk_socpeople = ".$filterontaskuser; |
|
| 770 | 770 | $sql .= " AND ec2.statut = 4"; |
| 771 | 771 | $sql .= " AND ctc2.source = 'internal'"; |
| 772 | 772 | } |
| 773 | 773 | if ($socid) |
| 774 | - $sql .= " AND p.fk_soc = " . $socid; |
|
| 774 | + $sql .= " AND p.fk_soc = ".$socid; |
|
| 775 | 775 | if ($projectid) |
| 776 | - $sql .= " AND p.rowid in (" . $projectid . ")"; |
|
| 776 | + $sql .= " AND p.rowid in (".$projectid.")"; |
|
| 777 | 777 | if ($filteronproj) |
| 778 | 778 | $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); |
| 779 | 779 | if ($filteronprojstatus && $filteronprojstatus != '-1') |
| 780 | - $sql .= " AND p.fk_statut IN (" . $filteronprojstatus . ")"; |
|
| 780 | + $sql .= " AND p.fk_statut IN (".$filteronprojstatus.")"; |
|
| 781 | 781 | if ($morewherefilter) |
| 782 | 782 | $sql .= $morewherefilter; |
| 783 | 783 | $sql .= " ORDER BY p.ref, t.rang, t.dateo"; |
| 784 | 784 | |
| 785 | 785 | //print $sql;exit; |
| 786 | - dol_syslog(get_class($this) . "::getTasksArray", LOG_DEBUG); |
|
| 786 | + dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); |
|
| 787 | 787 | $resql = $this->db->query($sql); |
| 788 | 788 | if ($resql) { |
| 789 | 789 | $num = $this->db->num_rows($resql); |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | $tasks[$i]->projectstatus = $obj->projectstatus; |
| 816 | 816 | $tasks[$i]->label = $obj->label; |
| 817 | 817 | $tasks[$i]->description = $obj->description; |
| 818 | - $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated |
|
| 818 | + $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated |
|
| 819 | 819 | $tasks[$i]->fk_task_parent = $obj->fk_task_parent; |
| 820 | 820 | $tasks[$i]->duration = $obj->duration_effective; |
| 821 | 821 | $tasks[$i]->planned_workload = $obj->planned_workload; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | { |
| 857 | 857 | $arrayroles = array(); |
| 858 | 858 | |
| 859 | - dol_syslog(get_class($this) . "::getUserRolesForProjectsOrTasks userp=" . is_object($userp) . " usert=" . is_object($usert) . " projectid=" . $projectid . " taskid=" . $taskid); |
|
| 859 | + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks userp=".is_object($userp)." usert=".is_object($usert)." projectid=".$projectid." taskid=".$taskid); |
|
| 860 | 860 | |
| 861 | 861 | // We want role of user for a projet or role of user for a task. Both are not possible. |
| 862 | 862 | if (empty($userp) && empty($usert)) { |
@@ -871,44 +871,44 @@ discard block |
||
| 871 | 871 | /* Liste des taches et role sur les projets ou taches */ |
| 872 | 872 | $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source"; |
| 873 | 873 | if ($userp) |
| 874 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as pt"; |
|
| 874 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet as pt"; |
|
| 875 | 875 | if ($usert && $filteronprojstatus > -1) |
| 876 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 876 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt"; |
|
| 877 | 877 | if ($usert && $filteronprojstatus <= -1) |
| 878 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 879 | - $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec"; |
|
| 880 | - $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc"; |
|
| 878 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; |
|
| 879 | + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; |
|
| 880 | + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
|
| 881 | 881 | $sql .= " WHERE pt.rowid = ec.element_id"; |
| 882 | 882 | if ($userp && $filteronprojstatus > -1) |
| 883 | - $sql .= " AND pt.fk_statut = " . $filteronprojstatus; |
|
| 883 | + $sql .= " AND pt.fk_statut = ".$filteronprojstatus; |
|
| 884 | 884 | if ($usert && $filteronprojstatus > -1) |
| 885 | - $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = " . $filteronprojstatus; |
|
| 885 | + $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".$filteronprojstatus; |
|
| 886 | 886 | if ($userp) |
| 887 | 887 | $sql .= " AND ctc.element = 'project'"; |
| 888 | 888 | if ($usert) |
| 889 | 889 | $sql .= " AND ctc.element = 'project_task'"; |
| 890 | 890 | $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; |
| 891 | 891 | if ($userp) |
| 892 | - $sql .= " AND ec.fk_socpeople = " . $userp->id; |
|
| 892 | + $sql .= " AND ec.fk_socpeople = ".$userp->id; |
|
| 893 | 893 | if ($usert) |
| 894 | - $sql .= " AND ec.fk_socpeople = " . $usert->id; |
|
| 894 | + $sql .= " AND ec.fk_socpeople = ".$usert->id; |
|
| 895 | 895 | $sql .= " AND ec.statut = 4"; |
| 896 | 896 | $sql .= " AND ctc.source = 'internal'"; |
| 897 | 897 | if ($projectid) { |
| 898 | 898 | if ($userp) |
| 899 | - $sql .= " AND pt.rowid in (" . $projectid . ")"; |
|
| 899 | + $sql .= " AND pt.rowid in (".$projectid.")"; |
|
| 900 | 900 | if ($usert) |
| 901 | - $sql .= " AND pt.fk_projet in (" . $projectid . ")"; |
|
| 901 | + $sql .= " AND pt.fk_projet in (".$projectid.")"; |
|
| 902 | 902 | } |
| 903 | 903 | if ($taskid) { |
| 904 | 904 | if ($userp) |
| 905 | 905 | $sql .= " ERROR SHOULD NOT HAPPENS"; |
| 906 | 906 | if ($usert) |
| 907 | - $sql .= " AND pt.rowid = " . $taskid; |
|
| 907 | + $sql .= " AND pt.rowid = ".$taskid; |
|
| 908 | 908 | } |
| 909 | 909 | //print $sql; |
| 910 | 910 | |
| 911 | - dol_syslog(get_class($this) . "::getUserRolesForProjectsOrTasks execute request", LOG_DEBUG); |
|
| 911 | + dol_syslog(get_class($this)."::getUserRolesForProjectsOrTasks execute request", LOG_DEBUG); |
|
| 912 | 912 | $resql = $this->db->query($sql); |
| 913 | 913 | if ($resql) { |
| 914 | 914 | $num = $this->db->num_rows($resql); |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | if (empty($arrayroles[$obj->pid])) |
| 919 | 919 | $arrayroles[$obj->pid] = $obj->code; |
| 920 | 920 | else |
| 921 | - $arrayroles[$obj->pid] .= ',' . $obj->code; |
|
| 921 | + $arrayroles[$obj->pid] .= ','.$obj->code; |
|
| 922 | 922 | $i++; |
| 923 | 923 | } |
| 924 | 924 | $this->db->free($resql); |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | { |
| 965 | 965 | global $conf, $langs; |
| 966 | 966 | |
| 967 | - dol_syslog(get_class($this) . "::addTimeSpent", LOG_DEBUG); |
|
| 967 | + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); |
|
| 968 | 968 | |
| 969 | 969 | $ret = 0; |
| 970 | 970 | |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | |
| 983 | 983 | $this->db->begin(); |
| 984 | 984 | |
| 985 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet_task_time ("; |
|
| 985 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; |
|
| 986 | 986 | $sql .= "fk_task"; |
| 987 | 987 | $sql .= ", task_date"; |
| 988 | 988 | $sql .= ", task_datehour"; |
@@ -992,17 +992,17 @@ discard block |
||
| 992 | 992 | $sql .= ", note"; |
| 993 | 993 | $sql .= ") VALUES ("; |
| 994 | 994 | $sql .= $this->id; |
| 995 | - $sql .= ", '" . $this->db->idate($this->timespent_date) . "'"; |
|
| 996 | - $sql .= ", '" . $this->db->idate($this->timespent_datehour) . "'"; |
|
| 997 | - $sql .= ", " . (empty($this->timespent_withhour) ? 0 : 1); |
|
| 998 | - $sql .= ", " . $this->timespent_duration; |
|
| 999 | - $sql .= ", " . $this->timespent_fk_user; |
|
| 1000 | - $sql .= ", " . (isset($this->timespent_note) ? "'" . $this->db->escape($this->timespent_note) . "'" : "null"); |
|
| 995 | + $sql .= ", '".$this->db->idate($this->timespent_date)."'"; |
|
| 996 | + $sql .= ", '".$this->db->idate($this->timespent_datehour)."'"; |
|
| 997 | + $sql .= ", ".(empty($this->timespent_withhour) ? 0 : 1); |
|
| 998 | + $sql .= ", ".$this->timespent_duration; |
|
| 999 | + $sql .= ", ".$this->timespent_fk_user; |
|
| 1000 | + $sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); |
|
| 1001 | 1001 | $sql .= ")"; |
| 1002 | 1002 | |
| 1003 | 1003 | $resql = $this->db->query($sql); |
| 1004 | 1004 | if ($resql) { |
| 1005 | - $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "projet_task_time"); |
|
| 1005 | + $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); |
|
| 1006 | 1006 | $ret = $tasktime_id; |
| 1007 | 1007 | $this->timespent_id = $ret; |
| 1008 | 1008 | |
@@ -1021,23 +1021,23 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | if ($ret > 0) { |
| 1023 | 1023 | // Recalculate amount of time spent for task and update denormalized field |
| 1024 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
|
| 1025 | - $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM " . MAIN_DB_PREFIX . "projet_task_time as ptt where ptt.fk_task = " . $this->id . ")"; |
|
| 1024 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; |
|
| 1025 | + $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->id.")"; |
|
| 1026 | 1026 | if (isset($this->progress)) |
| 1027 | - $sql .= ", progress = " . $this->progress; // Do not overwrite value if not provided |
|
| 1028 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1027 | + $sql .= ", progress = ".$this->progress; // Do not overwrite value if not provided |
|
| 1028 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1029 | 1029 | |
| 1030 | - dol_syslog(get_class($this) . "::addTimeSpent", LOG_DEBUG); |
|
| 1030 | + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); |
|
| 1031 | 1031 | if (!$this->db->query($sql)) { |
| 1032 | 1032 | $this->error = $this->db->lasterror(); |
| 1033 | 1033 | $ret = -2; |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task_time"; |
|
| 1037 | - $sql .= " SET thm = (SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . $this->timespent_fk_user . ")"; // set average hour rate of user |
|
| 1038 | - $sql .= " WHERE rowid = " . $tasktime_id; |
|
| 1036 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time"; |
|
| 1037 | + $sql .= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user |
|
| 1038 | + $sql .= " WHERE rowid = ".$tasktime_id; |
|
| 1039 | 1039 | |
| 1040 | - dol_syslog(get_class($this) . "::addTimeSpent", LOG_DEBUG); |
|
| 1040 | + dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); |
|
| 1041 | 1041 | if (!$this->db->query($sql)) { |
| 1042 | 1042 | $this->error = $this->db->lasterror(); |
| 1043 | 1043 | $ret = -2; |
@@ -1080,26 +1080,26 @@ discard block |
||
| 1080 | 1080 | $sql .= " MIN(t.task_datehour) as min_date,"; |
| 1081 | 1081 | $sql .= " MAX(t.task_datehour) as max_date,"; |
| 1082 | 1082 | $sql .= " SUM(t.task_duration) as total_duration,"; |
| 1083 | - $sql .= " SUM(t.task_duration / 3600 * " . $this->db->ifsql("t.thm IS NULL", 0, "t.thm") . ") as total_amount,"; |
|
| 1083 | + $sql .= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as total_amount,"; |
|
| 1084 | 1084 | $sql .= " COUNT(t.rowid) as nblines,"; |
| 1085 | - $sql .= " SUM(" . $this->db->ifsql("t.thm IS NULL", 1, 0) . ") as nblinesnull"; |
|
| 1086 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time as t"; |
|
| 1085 | + $sql .= " SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; |
|
| 1086 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
|
| 1087 | 1087 | $sql .= " WHERE 1 = 1"; |
| 1088 | 1088 | if ($morewherefilter) |
| 1089 | 1089 | $sql .= $morewherefilter; |
| 1090 | 1090 | if ($id > 0) |
| 1091 | - $sql .= " AND t.fk_task = " . $id; |
|
| 1091 | + $sql .= " AND t.fk_task = ".$id; |
|
| 1092 | 1092 | if ($userid > 0) |
| 1093 | - $sql .= " AND t.fk_user = " . $userid; |
|
| 1093 | + $sql .= " AND t.fk_user = ".$userid; |
|
| 1094 | 1094 | |
| 1095 | - dol_syslog(get_class($this) . "::getSummaryOfTimeSpent", LOG_DEBUG); |
|
| 1095 | + dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); |
|
| 1096 | 1096 | $resql = $this->db->query($sql); |
| 1097 | 1097 | if ($resql) { |
| 1098 | 1098 | $obj = $this->db->fetch_object($resql); |
| 1099 | 1099 | |
| 1100 | - $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead |
|
| 1101 | - $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead |
|
| 1102 | - $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead |
|
| 1100 | + $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead |
|
| 1101 | + $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead |
|
| 1102 | + $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead |
|
| 1103 | 1103 | |
| 1104 | 1104 | $this->timespent_min_date = $this->db->jdate($obj->min_date); |
| 1105 | 1105 | $this->timespent_max_date = $this->db->jdate($obj->max_date); |
@@ -1134,23 +1134,23 @@ discard block |
||
| 1134 | 1134 | |
| 1135 | 1135 | $sql = "SELECT"; |
| 1136 | 1136 | $sql .= " SUM(t.task_duration) as nbseconds,"; |
| 1137 | - $sql .= " SUM(t.task_duration / 3600 * " . $this->db->ifsql("t.thm IS NULL", 0, "t.thm") . ") as amount, SUM(" . $this->db->ifsql("t.thm IS NULL", 1, 0) . ") as nblinesnull"; |
|
| 1138 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time as t"; |
|
| 1139 | - $sql .= " WHERE t.fk_task = " . $id; |
|
| 1137 | + $sql .= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; |
|
| 1138 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
|
| 1139 | + $sql .= " WHERE t.fk_task = ".$id; |
|
| 1140 | 1140 | if (is_object($fuser) && $fuser->id > 0) { |
| 1141 | - $sql .= " AND fk_user = " . $fuser->id; |
|
| 1141 | + $sql .= " AND fk_user = ".$fuser->id; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | if ($dates > 0) { |
| 1144 | 1144 | $datefieldname = "task_datehour"; |
| 1145 | - $sql .= " AND (" . $datefieldname . " >= '" . $this->db->idate($dates) . "' OR " . $datefieldname . " IS NULL)"; |
|
| 1145 | + $sql .= " AND (".$datefieldname." >= '".$this->db->idate($dates)."' OR ".$datefieldname." IS NULL)"; |
|
| 1146 | 1146 | } |
| 1147 | 1147 | if ($datee > 0) { |
| 1148 | 1148 | $datefieldname = "task_datehour"; |
| 1149 | - $sql .= " AND (" . $datefieldname . " <= '" . $this->db->idate($datee) . "' OR " . $datefieldname . " IS NULL)"; |
|
| 1149 | + $sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | //print $sql; |
| 1152 | 1152 | |
| 1153 | - dol_syslog(get_class($this) . "::getSumOfAmount", LOG_DEBUG); |
|
| 1153 | + dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG); |
|
| 1154 | 1154 | $resql = $this->db->query($sql); |
| 1155 | 1155 | if ($resql) { |
| 1156 | 1156 | $obj = $this->db->fetch_object($resql); |
@@ -1186,10 +1186,10 @@ discard block |
||
| 1186 | 1186 | $sql .= " t.task_duration,"; |
| 1187 | 1187 | $sql .= " t.fk_user,"; |
| 1188 | 1188 | $sql .= " t.note"; |
| 1189 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time as t"; |
|
| 1190 | - $sql .= " WHERE t.rowid = " . $id; |
|
| 1189 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; |
|
| 1190 | + $sql .= " WHERE t.rowid = ".$id; |
|
| 1191 | 1191 | |
| 1192 | - dol_syslog(get_class($this) . "::fetchTimeSpent", LOG_DEBUG); |
|
| 1192 | + dol_syslog(get_class($this)."::fetchTimeSpent", LOG_DEBUG); |
|
| 1193 | 1193 | $resql = $this->db->query($sql); |
| 1194 | 1194 | if ($resql) { |
| 1195 | 1195 | if ($this->db->num_rows($resql)) { |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | |
| 1210 | 1210 | return 1; |
| 1211 | 1211 | } else { |
| 1212 | - $this->error = "Error " . $this->db->lasterror(); |
|
| 1212 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 1213 | 1213 | return -1; |
| 1214 | 1214 | } |
| 1215 | 1215 | } |
@@ -1246,15 +1246,15 @@ discard block |
||
| 1246 | 1246 | $sql .= " p.ref as project_ref,"; |
| 1247 | 1247 | $sql .= " p.title as project_label,"; |
| 1248 | 1248 | $sql .= " p.public as public"; |
| 1249 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time as ptt, " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet as p"; |
|
| 1250 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON p.fk_soc = s.rowid"; |
|
| 1249 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; |
|
| 1250 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; |
|
| 1251 | 1251 | $sql .= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid"; |
| 1252 | - $sql .= " AND ptt.fk_user = " . $userobj->id; |
|
| 1253 | - $sql .= " AND pt.entity IN (" . getEntity('project') . ")"; |
|
| 1252 | + $sql .= " AND ptt.fk_user = ".$userobj->id; |
|
| 1253 | + $sql .= " AND pt.entity IN (".getEntity('project').")"; |
|
| 1254 | 1254 | if ($morewherefilter) |
| 1255 | 1255 | $sql .= $morewherefilter; |
| 1256 | 1256 | |
| 1257 | - dol_syslog(get_class($this) . "::fetchAllTimeSpent", LOG_DEBUG); |
|
| 1257 | + dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG); |
|
| 1258 | 1258 | $resql = $this->db->query($sql); |
| 1259 | 1259 | if ($resql) { |
| 1260 | 1260 | $num = $this->db->num_rows($resql); |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $this->db->free($resql); |
| 1295 | 1295 | } else { |
| 1296 | 1296 | dol_print_error($this->db); |
| 1297 | - $this->error = "Error " . $this->db->lasterror(); |
|
| 1297 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 1298 | 1298 | return -1; |
| 1299 | 1299 | } |
| 1300 | 1300 | |
@@ -1322,16 +1322,16 @@ discard block |
||
| 1322 | 1322 | |
| 1323 | 1323 | $this->db->begin(); |
| 1324 | 1324 | |
| 1325 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task_time SET"; |
|
| 1326 | - $sql .= " task_date = '" . $this->db->idate($this->timespent_date) . "',"; |
|
| 1327 | - $sql .= " task_datehour = '" . $this->db->idate($this->timespent_datehour) . "',"; |
|
| 1328 | - $sql .= " task_date_withhour = " . (empty($this->timespent_withhour) ? 0 : 1) . ","; |
|
| 1329 | - $sql .= " task_duration = " . $this->timespent_duration . ","; |
|
| 1330 | - $sql .= " fk_user = " . $this->timespent_fk_user . ","; |
|
| 1331 | - $sql .= " note = " . (isset($this->timespent_note) ? "'" . $this->db->escape($this->timespent_note) . "'" : "null"); |
|
| 1332 | - $sql .= " WHERE rowid = " . $this->timespent_id; |
|
| 1325 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; |
|
| 1326 | + $sql .= " task_date = '".$this->db->idate($this->timespent_date)."',"; |
|
| 1327 | + $sql .= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; |
|
| 1328 | + $sql .= " task_date_withhour = ".(empty($this->timespent_withhour) ? 0 : 1).","; |
|
| 1329 | + $sql .= " task_duration = ".$this->timespent_duration.","; |
|
| 1330 | + $sql .= " fk_user = ".$this->timespent_fk_user.","; |
|
| 1331 | + $sql .= " note = ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); |
|
| 1332 | + $sql .= " WHERE rowid = ".$this->timespent_id; |
|
| 1333 | 1333 | |
| 1334 | - dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG); |
|
| 1334 | + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); |
|
| 1335 | 1335 | if ($this->db->query($sql)) { |
| 1336 | 1336 | if (!$notrigger) { |
| 1337 | 1337 | // Call trigger |
@@ -1354,11 +1354,11 @@ discard block |
||
| 1354 | 1354 | if ($ret == 1 && ($this->timespent_old_duration != $this->timespent_duration)) { |
| 1355 | 1355 | $newDuration = $this->timespent_duration - $this->timespent_old_duration; |
| 1356 | 1356 | |
| 1357 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
|
| 1358 | - $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM " . MAIN_DB_PREFIX . "projet_task_time as ptt where ptt.fk_task = " . $this->db->escape($this->id) . ")"; |
|
| 1359 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1357 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; |
|
| 1358 | + $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->db->escape($this->id).")"; |
|
| 1359 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1360 | 1360 | |
| 1361 | - dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG); |
|
| 1361 | + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); |
|
| 1362 | 1362 | if (!$this->db->query($sql)) { |
| 1363 | 1363 | $this->error = $this->db->lasterror(); |
| 1364 | 1364 | $this->db->rollback(); |
@@ -1386,14 +1386,14 @@ discard block |
||
| 1386 | 1386 | |
| 1387 | 1387 | $this->db->begin(); |
| 1388 | 1388 | |
| 1389 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_time"; |
|
| 1390 | - $sql .= " WHERE rowid = " . $this->timespent_id; |
|
| 1389 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; |
|
| 1390 | + $sql .= " WHERE rowid = ".$this->timespent_id; |
|
| 1391 | 1391 | |
| 1392 | - dol_syslog(get_class($this) . "::delTimeSpent", LOG_DEBUG); |
|
| 1392 | + dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); |
|
| 1393 | 1393 | $resql = $this->db->query($sql); |
| 1394 | 1394 | if (!$resql) { |
| 1395 | 1395 | $error++; |
| 1396 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 1396 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 1397 | 1397 | } |
| 1398 | 1398 | |
| 1399 | 1399 | if (!$error) { |
@@ -1408,11 +1408,11 @@ discard block |
||
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | if (!$error) { |
| 1411 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
|
| 1412 | - $sql .= " SET duration_effective = duration_effective - " . $this->db->escape($this->timespent_duration ? $this->timespent_duration : 0); |
|
| 1413 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1411 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; |
|
| 1412 | + $sql .= " SET duration_effective = duration_effective - ".$this->db->escape($this->timespent_duration ? $this->timespent_duration : 0); |
|
| 1413 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1414 | 1414 | |
| 1415 | - dol_syslog(get_class($this) . "::delTimeSpent", LOG_DEBUG); |
|
| 1415 | + dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); |
|
| 1416 | 1416 | if ($this->db->query($sql)) { |
| 1417 | 1417 | $result = 0; |
| 1418 | 1418 | } else { |
@@ -1424,8 +1424,8 @@ discard block |
||
| 1424 | 1424 | // Commit or rollback |
| 1425 | 1425 | if ($error) { |
| 1426 | 1426 | foreach ($this->errors as $errmsg) { |
| 1427 | - dol_syslog(get_class($this) . "::delTimeSpent " . $errmsg, LOG_ERR); |
|
| 1428 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 1427 | + dol_syslog(get_class($this)."::delTimeSpent ".$errmsg, LOG_ERR); |
|
| 1428 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 1429 | 1429 | } |
| 1430 | 1430 | $this->db->rollback(); |
| 1431 | 1431 | return -1 * $error; |
@@ -1475,8 +1475,8 @@ discard block |
||
| 1475 | 1475 | |
| 1476 | 1476 | $defaultref = ''; |
| 1477 | 1477 | $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; |
| 1478 | - if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) { |
|
| 1479 | - require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php'; |
|
| 1478 | + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) { |
|
| 1479 | + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; |
|
| 1480 | 1480 | $modTask = new $obj; |
| 1481 | 1481 | $defaultref = $modTask->getNextValue(0, $clone_task); |
| 1482 | 1482 | } |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | |
| 1557 | 1557 | //Duplicate file |
| 1558 | 1558 | if ($clone_file) { |
| 1559 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 1559 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 1560 | 1560 | |
| 1561 | 1561 | //retreive project origin ref to know folder to copy |
| 1562 | 1562 | $projectstatic = new Project($this->db); |
@@ -1570,21 +1570,21 @@ discard block |
||
| 1570 | 1570 | $clone_project_ref = $ori_project_ref; |
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | - $clone_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($clone_project_ref) . "/" . dol_sanitizeFileName($clone_task_ref); |
|
| 1574 | - $ori_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($ori_project_ref) . "/" . dol_sanitizeFileName($fromid); |
|
| 1573 | + $clone_task_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($clone_project_ref)."/".dol_sanitizeFileName($clone_task_ref); |
|
| 1574 | + $ori_task_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($ori_project_ref)."/".dol_sanitizeFileName($fromid); |
|
| 1575 | 1575 | |
| 1576 | 1576 | $filearray = dol_dir_list($ori_task_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); |
| 1577 | 1577 | foreach ($filearray as $key => $file) { |
| 1578 | 1578 | if (!file_exists($clone_task_dir)) { |
| 1579 | 1579 | if (dol_mkdir($clone_task_dir) < 0) { |
| 1580 | - $this->error .= $langs->trans('ErrorInternalErrorDetected') . ':dol_mkdir'; |
|
| 1580 | + $this->error .= $langs->trans('ErrorInternalErrorDetected').':dol_mkdir'; |
|
| 1581 | 1581 | $error++; |
| 1582 | 1582 | } |
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | - $rescopy = dol_copy($ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name'], 0, 1); |
|
| 1585 | + $rescopy = dol_copy($ori_task_dir.'/'.$file['name'], $clone_task_dir.'/'.$file['name'], 0, 1); |
|
| 1586 | 1586 | if (is_numeric($rescopy) && $rescopy < 0) { |
| 1587 | - $this->error .= $langs->trans("ErrorFailToCopyFile", $ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name']); |
|
| 1587 | + $this->error .= $langs->trans("ErrorFailToCopyFile", $ori_task_dir.'/'.$file['name'], $clone_task_dir.'/'.$file['name']); |
|
| 1588 | 1588 | $error++; |
| 1589 | 1589 | } |
| 1590 | 1590 | } |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | return $clone_task_id; |
| 1629 | 1629 | } else { |
| 1630 | 1630 | $this->db->rollback(); |
| 1631 | - dol_syslog(get_class($this) . "::createFromClone nbError: " . $error . " error : " . $this->error, LOG_ERR); |
|
| 1631 | + dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : ".$this->error, LOG_ERR); |
|
| 1632 | 1632 | return -1; |
| 1633 | 1633 | } |
| 1634 | 1634 | } |
@@ -1675,17 +1675,17 @@ discard block |
||
| 1675 | 1675 | return $langs->trans($this->statuts_short[$statut]); |
| 1676 | 1676 | } elseif ($mode == 2) { |
| 1677 | 1677 | if ($statut == 0) |
| 1678 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1678 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1679 | 1679 | elseif ($statut == 1) |
| 1680 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1680 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1681 | 1681 | elseif ($statut == 2) |
| 1682 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1682 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1683 | 1683 | elseif ($statut == 3) |
| 1684 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1684 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1685 | 1685 | elseif ($statut == 4) |
| 1686 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1686 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1687 | 1687 | elseif ($statut == 5) |
| 1688 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1688 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts_short[$statut]); |
|
| 1689 | 1689 | } |
| 1690 | 1690 | elseif ($mode == 3) { |
| 1691 | 1691 | if ($statut == 0) |
@@ -1703,17 +1703,17 @@ discard block |
||
| 1703 | 1703 | } |
| 1704 | 1704 | elseif ($mode == 4) { |
| 1705 | 1705 | if ($statut == 0) |
| 1706 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1706 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]); |
|
| 1707 | 1707 | elseif ($statut == 1) |
| 1708 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1708 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1').' '.$langs->trans($this->statuts[$statut]); |
|
| 1709 | 1709 | elseif ($statut == 2) |
| 1710 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1710 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3').' '.$langs->trans($this->statuts[$statut]); |
|
| 1711 | 1711 | elseif ($statut == 3) |
| 1712 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1712 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); |
|
| 1713 | 1713 | elseif ($statut == 4) |
| 1714 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1714 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]); |
|
| 1715 | 1715 | elseif ($statut == 5) |
| 1716 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1716 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5').' '.$langs->trans($this->statuts[$statut]); |
|
| 1717 | 1717 | } |
| 1718 | 1718 | elseif ($mode == 5) { |
| 1719 | 1719 | /* if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); |
@@ -1792,20 +1792,20 @@ discard block |
||
| 1792 | 1792 | $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; |
| 1793 | 1793 | $sql .= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; |
| 1794 | 1794 | $sql .= " t.dateo as date_start, t.datee as datee"; |
| 1795 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p"; |
|
| 1796 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on p.fk_soc = s.rowid"; |
|
| 1795 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
| 1796 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; |
|
| 1797 | 1797 | //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; |
| 1798 | - $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t"; |
|
| 1799 | - $sql .= " WHERE p.entity IN (" . getEntity('project', 0) . ')'; |
|
| 1798 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 1799 | + $sql .= " WHERE p.entity IN (".getEntity('project', 0).')'; |
|
| 1800 | 1800 | $sql .= " AND p.fk_statut = 1"; |
| 1801 | 1801 | $sql .= " AND t.fk_projet = p.rowid"; |
| 1802 | - $sql .= " AND t.progress < 100"; // tasks to do |
|
| 1802 | + $sql .= " AND t.progress < 100"; // tasks to do |
|
| 1803 | 1803 | if (!$user->rights->projet->all->lire) |
| 1804 | - $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1804 | + $sql .= " AND p.rowid IN (".$projectsListId.")"; |
|
| 1805 | 1805 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1806 | 1806 | //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
| 1807 | 1807 | if ($socid) |
| 1808 | - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1808 | + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
| 1809 | 1809 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1810 | 1810 | // if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; |
| 1811 | 1811 | //print $sql; |
@@ -1818,10 +1818,10 @@ discard block |
||
| 1818 | 1818 | $response->label = $langs->trans("OpenedTasks"); |
| 1819 | 1819 | if ($user->rights->projet->all->lire) { |
| 1820 | 1820 | // $response->url = DOL_URL_ROOT . '/projet/tasks/list.php?mainmenu=project'; |
| 1821 | - $response->url = BASE_URI . '?controller=projet/tasks&method=list&mainmenu=project'; |
|
| 1821 | + $response->url = BASE_URI.'?controller=projet/tasks&method=list&mainmenu=project'; |
|
| 1822 | 1822 | } else { |
| 1823 | 1823 | // $response->url = DOL_URL_ROOT . '/projet/tasks/list.php?mode=mine&mainmenu=project'; |
| 1824 | - $response->url = BASE_URI . '?controller=projet/tasks&method=list&mode=mine&mainmenu=project'; |
|
| 1824 | + $response->url = BASE_URI.'?controller=projet/tasks&method=list&mode=mine&mainmenu=project'; |
|
| 1825 | 1825 | $response->img = img_object('', "task"); |
| 1826 | 1826 | } |
| 1827 | 1827 | // This assignment in condition is not a bug. It allows walking the results. |
@@ -1864,21 +1864,21 @@ discard block |
||
| 1864 | 1864 | |
| 1865 | 1865 | // List of tasks (does not care about permissions. Filtering will be done later) |
| 1866 | 1866 | $sql = "SELECT count(p.rowid) as nb"; |
| 1867 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p"; |
|
| 1868 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on p.fk_soc = s.rowid"; |
|
| 1867 | + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
| 1868 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; |
|
| 1869 | 1869 | if (!$user->rights->societe->client->voir && !$socid) |
| 1870 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc = s.rowid"; |
|
| 1871 | - $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t"; |
|
| 1872 | - $sql .= " WHERE p.entity IN (" . getEntity('project', 0) . ')'; |
|
| 1873 | - $sql .= " AND t.fk_projet = p.rowid"; // tasks to do |
|
| 1870 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; |
|
| 1871 | + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 1872 | + $sql .= " WHERE p.entity IN (".getEntity('project', 0).')'; |
|
| 1873 | + $sql .= " AND t.fk_projet = p.rowid"; // tasks to do |
|
| 1874 | 1874 | if ($mine || !$user->rights->projet->all->lire) |
| 1875 | - $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1875 | + $sql .= " AND p.rowid IN (".$projectsListId.")"; |
|
| 1876 | 1876 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1877 | 1877 | //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
| 1878 | 1878 | if ($socid) |
| 1879 | - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1879 | + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
| 1880 | 1880 | if (!$user->rights->societe->client->voir && !$socid) |
| 1881 | - $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id . ") OR (s.rowid IS NULL))"; |
|
| 1881 | + $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id.") OR (s.rowid IS NULL))"; |
|
| 1882 | 1882 | |
| 1883 | 1883 | $resql = $this->db->query($sql); |
| 1884 | 1884 | if ($resql) { |
@@ -244,8 +244,9 @@ discard block |
||
| 244 | 244 | $sql .= ", t2.rang as task_parent_position"; |
| 245 | 245 | } |
| 246 | 246 | $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as t"; |
| 247 | - if (!empty($loadparentdata)) |
|
| 248 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t2 ON t.fk_task_parent = t2.rowid"; |
|
| 247 | + if (!empty($loadparentdata)) { |
|
| 248 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t2 ON t.fk_task_parent = t2.rowid"; |
|
| 249 | + } |
|
| 249 | 250 | $sql .= " WHERE "; |
| 250 | 251 | if (!empty($ref)) { |
| 251 | 252 | $sql .= "t.ref = '" . $this->db->escape($ref) . "'"; |
@@ -560,8 +561,9 @@ discard block |
||
| 560 | 561 | $this->errors[] = "Error " . $this->db->lasterror(); |
| 561 | 562 | } else { |
| 562 | 563 | $obj = $this->db->fetch_object($resql); |
| 563 | - if ($obj) |
|
| 564 | - $ret = $obj->nb; |
|
| 564 | + if ($obj) { |
|
| 565 | + $ret = $obj->nb; |
|
| 566 | + } |
|
| 565 | 567 | $this->db->free($resql); |
| 566 | 568 | } |
| 567 | 569 | |
@@ -593,8 +595,9 @@ discard block |
||
| 593 | 595 | $this->errors[] = "Error " . $this->db->lasterror(); |
| 594 | 596 | } else { |
| 595 | 597 | $obj = $this->db->fetch_object($resql); |
| 596 | - if ($obj) |
|
| 597 | - $ret = $obj->nb; |
|
| 598 | + if ($obj) { |
|
| 599 | + $ret = $obj->nb; |
|
| 600 | + } |
|
| 598 | 601 | $this->db->free($resql); |
| 599 | 602 | } |
| 600 | 603 | |
@@ -621,15 +624,19 @@ discard block |
||
| 621 | 624 | { |
| 622 | 625 | global $conf, $langs, $user; |
| 623 | 626 | |
| 624 | - if (!empty($conf->dol_no_mouse_hover)) |
|
| 625 | - $notooltip = 1; // Force disable tooltips |
|
| 627 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 628 | + $notooltip = 1; |
|
| 629 | + } |
|
| 630 | + // Force disable tooltips |
|
| 626 | 631 | |
| 627 | 632 | $result = ''; |
| 628 | 633 | $label = '<u>' . $langs->trans("ShowTask") . '</u>'; |
| 629 | - if (!empty($this->ref)) |
|
| 630 | - $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 631 | - if (!empty($this->label)) |
|
| 632 | - $label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label; |
|
| 634 | + if (!empty($this->ref)) { |
|
| 635 | + $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 636 | + } |
|
| 637 | + if (!empty($this->label)) { |
|
| 638 | + $label .= '<br><b>' . $langs->trans('LabelTask') . ':</b> ' . $this->label; |
|
| 639 | + } |
|
| 633 | 640 | if ($this->date_start || $this->date_end) { |
| 634 | 641 | $label .= "<br>" . get_date_range($this->date_start, $this->date_end, '', $langs, 0); |
| 635 | 642 | } |
@@ -637,10 +644,12 @@ discard block |
||
| 637 | 644 | $url = DOL_URL_ROOT . '/projet/tasks/' . $mode . '.php?id=' . $this->id . ($option == 'withproject' ? '&withproject=1' : ''); |
| 638 | 645 | // Add param to save lastsearch_values or not |
| 639 | 646 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 640 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) |
|
| 641 | - $add_save_lastsearch_values = 1; |
|
| 642 | - if ($add_save_lastsearch_values) |
|
| 643 | - $url .= '&save_lastsearch_values=1'; |
|
| 647 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 648 | + $add_save_lastsearch_values = 1; |
|
| 649 | + } |
|
| 650 | + if ($add_save_lastsearch_values) { |
|
| 651 | + $url .= '&save_lastsearch_values=1'; |
|
| 652 | + } |
|
| 644 | 653 | |
| 645 | 654 | $linkclose = ''; |
| 646 | 655 | if (empty($notooltip)) { |
@@ -659,13 +668,16 @@ discard block |
||
| 659 | 668 | $picto = 'projecttask'; |
| 660 | 669 | |
| 661 | 670 | $result .= $linkstart; |
| 662 | - if ($withpicto) |
|
| 663 | - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 664 | - if ($withpicto != 2) |
|
| 665 | - $result .= $this->ref; |
|
| 671 | + if ($withpicto) { |
|
| 672 | + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 673 | + } |
|
| 674 | + if ($withpicto != 2) { |
|
| 675 | + $result .= $this->ref; |
|
| 676 | + } |
|
| 666 | 677 | $result .= $linkend; |
| 667 | - if ($withpicto != 2) |
|
| 668 | - $result .= (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
|
| 678 | + if ($withpicto != 2) { |
|
| 679 | + $result .= (($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
|
| 680 | + } |
|
| 669 | 681 | |
| 670 | 682 | return $result; |
| 671 | 683 | } |
@@ -717,8 +729,10 @@ discard block |
||
| 717 | 729 | //print $usert.'-'.$userp.'-'.$projectid.'-'.$socid.'-'.$mode.'<br>'; |
| 718 | 730 | // List of tasks (does not care about permissions. Filtering will be done later) |
| 719 | 731 | $sql = "SELECT "; |
| 720 | - if ($filteronprojuser > 0 || $filterontaskuser > 0) |
|
| 721 | - $sql .= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task |
|
| 732 | + if ($filteronprojuser > 0 || $filterontaskuser > 0) { |
|
| 733 | + $sql .= " DISTINCT"; |
|
| 734 | + } |
|
| 735 | + // We may get several time the same record if user has several roles on same project/task |
|
| 722 | 736 | $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,"; |
| 723 | 737 | $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; |
| 724 | 738 | $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; |
@@ -750,8 +764,9 @@ discard block |
||
| 750 | 764 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t on t.fk_projet = p.rowid"; |
| 751 | 765 | } |
| 752 | 766 | $sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; |
| 753 | - } else |
|
| 754 | - return 'BadValueForParameterMode'; |
|
| 767 | + } else { |
|
| 768 | + return 'BadValueForParameterMode'; |
|
| 769 | + } |
|
| 755 | 770 | |
| 756 | 771 | if ($filteronprojuser > 0) { |
| 757 | 772 | $sql .= " AND p.rowid = ec.element_id"; |
@@ -770,16 +785,21 @@ discard block |
||
| 770 | 785 | $sql .= " AND ec2.statut = 4"; |
| 771 | 786 | $sql .= " AND ctc2.source = 'internal'"; |
| 772 | 787 | } |
| 773 | - if ($socid) |
|
| 774 | - $sql .= " AND p.fk_soc = " . $socid; |
|
| 775 | - if ($projectid) |
|
| 776 | - $sql .= " AND p.rowid in (" . $projectid . ")"; |
|
| 777 | - if ($filteronproj) |
|
| 778 | - $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); |
|
| 779 | - if ($filteronprojstatus && $filteronprojstatus != '-1') |
|
| 780 | - $sql .= " AND p.fk_statut IN (" . $filteronprojstatus . ")"; |
|
| 781 | - if ($morewherefilter) |
|
| 782 | - $sql .= $morewherefilter; |
|
| 788 | + if ($socid) { |
|
| 789 | + $sql .= " AND p.fk_soc = " . $socid; |
|
| 790 | + } |
|
| 791 | + if ($projectid) { |
|
| 792 | + $sql .= " AND p.rowid in (" . $projectid . ")"; |
|
| 793 | + } |
|
| 794 | + if ($filteronproj) { |
|
| 795 | + $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); |
|
| 796 | + } |
|
| 797 | + if ($filteronprojstatus && $filteronprojstatus != '-1') { |
|
| 798 | + $sql .= " AND p.fk_statut IN (" . $filteronprojstatus . ")"; |
|
| 799 | + } |
|
| 800 | + if ($morewherefilter) { |
|
| 801 | + $sql .= $morewherefilter; |
|
| 802 | + } |
|
| 783 | 803 | $sql .= " ORDER BY p.ref, t.rang, t.dateo"; |
| 784 | 804 | |
| 785 | 805 | //print $sql;exit; |
@@ -870,41 +890,54 @@ discard block |
||
| 870 | 890 | |
| 871 | 891 | /* Liste des taches et role sur les projets ou taches */ |
| 872 | 892 | $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source"; |
| 873 | - if ($userp) |
|
| 874 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as pt"; |
|
| 875 | - if ($usert && $filteronprojstatus > -1) |
|
| 876 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 877 | - if ($usert && $filteronprojstatus <= -1) |
|
| 878 | - $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 893 | + if ($userp) { |
|
| 894 | + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as pt"; |
|
| 895 | + } |
|
| 896 | + if ($usert && $filteronprojstatus > -1) { |
|
| 897 | + $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 898 | + } |
|
| 899 | + if ($usert && $filteronprojstatus <= -1) { |
|
| 900 | + $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as pt"; |
|
| 901 | + } |
|
| 879 | 902 | $sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec"; |
| 880 | 903 | $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc"; |
| 881 | 904 | $sql .= " WHERE pt.rowid = ec.element_id"; |
| 882 | - if ($userp && $filteronprojstatus > -1) |
|
| 883 | - $sql .= " AND pt.fk_statut = " . $filteronprojstatus; |
|
| 884 | - if ($usert && $filteronprojstatus > -1) |
|
| 885 | - $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = " . $filteronprojstatus; |
|
| 886 | - if ($userp) |
|
| 887 | - $sql .= " AND ctc.element = 'project'"; |
|
| 888 | - if ($usert) |
|
| 889 | - $sql .= " AND ctc.element = 'project_task'"; |
|
| 905 | + if ($userp && $filteronprojstatus > -1) { |
|
| 906 | + $sql .= " AND pt.fk_statut = " . $filteronprojstatus; |
|
| 907 | + } |
|
| 908 | + if ($usert && $filteronprojstatus > -1) { |
|
| 909 | + $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = " . $filteronprojstatus; |
|
| 910 | + } |
|
| 911 | + if ($userp) { |
|
| 912 | + $sql .= " AND ctc.element = 'project'"; |
|
| 913 | + } |
|
| 914 | + if ($usert) { |
|
| 915 | + $sql .= " AND ctc.element = 'project_task'"; |
|
| 916 | + } |
|
| 890 | 917 | $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; |
| 891 | - if ($userp) |
|
| 892 | - $sql .= " AND ec.fk_socpeople = " . $userp->id; |
|
| 893 | - if ($usert) |
|
| 894 | - $sql .= " AND ec.fk_socpeople = " . $usert->id; |
|
| 918 | + if ($userp) { |
|
| 919 | + $sql .= " AND ec.fk_socpeople = " . $userp->id; |
|
| 920 | + } |
|
| 921 | + if ($usert) { |
|
| 922 | + $sql .= " AND ec.fk_socpeople = " . $usert->id; |
|
| 923 | + } |
|
| 895 | 924 | $sql .= " AND ec.statut = 4"; |
| 896 | 925 | $sql .= " AND ctc.source = 'internal'"; |
| 897 | 926 | if ($projectid) { |
| 898 | - if ($userp) |
|
| 899 | - $sql .= " AND pt.rowid in (" . $projectid . ")"; |
|
| 900 | - if ($usert) |
|
| 901 | - $sql .= " AND pt.fk_projet in (" . $projectid . ")"; |
|
| 927 | + if ($userp) { |
|
| 928 | + $sql .= " AND pt.rowid in (" . $projectid . ")"; |
|
| 929 | + } |
|
| 930 | + if ($usert) { |
|
| 931 | + $sql .= " AND pt.fk_projet in (" . $projectid . ")"; |
|
| 932 | + } |
|
| 902 | 933 | } |
| 903 | 934 | if ($taskid) { |
| 904 | - if ($userp) |
|
| 905 | - $sql .= " ERROR SHOULD NOT HAPPENS"; |
|
| 906 | - if ($usert) |
|
| 907 | - $sql .= " AND pt.rowid = " . $taskid; |
|
| 935 | + if ($userp) { |
|
| 936 | + $sql .= " ERROR SHOULD NOT HAPPENS"; |
|
| 937 | + } |
|
| 938 | + if ($usert) { |
|
| 939 | + $sql .= " AND pt.rowid = " . $taskid; |
|
| 940 | + } |
|
| 908 | 941 | } |
| 909 | 942 | //print $sql; |
| 910 | 943 | |
@@ -915,15 +948,15 @@ discard block |
||
| 915 | 948 | $i = 0; |
| 916 | 949 | while ($i < $num) { |
| 917 | 950 | $obj = $this->db->fetch_object($resql); |
| 918 | - if (empty($arrayroles[$obj->pid])) |
|
| 919 | - $arrayroles[$obj->pid] = $obj->code; |
|
| 920 | - else |
|
| 921 | - $arrayroles[$obj->pid] .= ',' . $obj->code; |
|
| 951 | + if (empty($arrayroles[$obj->pid])) { |
|
| 952 | + $arrayroles[$obj->pid] = $obj->code; |
|
| 953 | + } else { |
|
| 954 | + $arrayroles[$obj->pid] .= ',' . $obj->code; |
|
| 955 | + } |
|
| 922 | 956 | $i++; |
| 923 | 957 | } |
| 924 | 958 | $this->db->free($resql); |
| 925 | - } |
|
| 926 | - else { |
|
| 959 | + } else { |
|
| 927 | 960 | dol_print_error($this->db); |
| 928 | 961 | } |
| 929 | 962 | |
@@ -944,10 +977,11 @@ discard block |
||
| 944 | 977 | $num = count($tab); |
| 945 | 978 | $i = 0; |
| 946 | 979 | while ($i < $num) { |
| 947 | - if ($source == 'thirdparty') |
|
| 948 | - $contactAlreadySelected[$i] = $tab[$i]['socid']; |
|
| 949 | - else |
|
| 950 | - $contactAlreadySelected[$i] = $tab[$i]['id']; |
|
| 980 | + if ($source == 'thirdparty') { |
|
| 981 | + $contactAlreadySelected[$i] = $tab[$i]['socid']; |
|
| 982 | + } else { |
|
| 983 | + $contactAlreadySelected[$i] = $tab[$i]['id']; |
|
| 984 | + } |
|
| 951 | 985 | $i++; |
| 952 | 986 | } |
| 953 | 987 | return $contactAlreadySelected; |
@@ -975,10 +1009,12 @@ discard block |
||
| 975 | 1009 | } |
| 976 | 1010 | |
| 977 | 1011 | // Clean parameters |
| 978 | - if (isset($this->timespent_note)) |
|
| 979 | - $this->timespent_note = trim($this->timespent_note); |
|
| 980 | - if (empty($this->timespent_datehour)) |
|
| 981 | - $this->timespent_datehour = $this->timespent_date; |
|
| 1012 | + if (isset($this->timespent_note)) { |
|
| 1013 | + $this->timespent_note = trim($this->timespent_note); |
|
| 1014 | + } |
|
| 1015 | + if (empty($this->timespent_datehour)) { |
|
| 1016 | + $this->timespent_datehour = $this->timespent_date; |
|
| 1017 | + } |
|
| 982 | 1018 | |
| 983 | 1019 | $this->db->begin(); |
| 984 | 1020 | |
@@ -1023,8 +1059,10 @@ discard block |
||
| 1023 | 1059 | // Recalculate amount of time spent for task and update denormalized field |
| 1024 | 1060 | $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; |
| 1025 | 1061 | $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM " . MAIN_DB_PREFIX . "projet_task_time as ptt where ptt.fk_task = " . $this->id . ")"; |
| 1026 | - if (isset($this->progress)) |
|
| 1027 | - $sql .= ", progress = " . $this->progress; // Do not overwrite value if not provided |
|
| 1062 | + if (isset($this->progress)) { |
|
| 1063 | + $sql .= ", progress = " . $this->progress; |
|
| 1064 | + } |
|
| 1065 | + // Do not overwrite value if not provided |
|
| 1028 | 1066 | $sql .= " WHERE rowid = " . $this->id; |
| 1029 | 1067 | |
| 1030 | 1068 | dol_syslog(get_class($this) . "::addTimeSpent", LOG_DEBUG); |
@@ -1063,10 +1101,12 @@ discard block |
||
| 1063 | 1101 | { |
| 1064 | 1102 | global $langs; |
| 1065 | 1103 | |
| 1066 | - if (is_object($userobj)) |
|
| 1067 | - $userid = $userobj->id; |
|
| 1068 | - else |
|
| 1069 | - $userid = $userobj; // old method |
|
| 1104 | + if (is_object($userobj)) { |
|
| 1105 | + $userid = $userobj->id; |
|
| 1106 | + } else { |
|
| 1107 | + $userid = $userobj; |
|
| 1108 | + } |
|
| 1109 | + // old method |
|
| 1070 | 1110 | |
| 1071 | 1111 | $id = $this->id; |
| 1072 | 1112 | if (empty($id) && empty($userid)) { |
@@ -1085,12 +1125,15 @@ discard block |
||
| 1085 | 1125 | $sql .= " SUM(" . $this->db->ifsql("t.thm IS NULL", 1, 0) . ") as nblinesnull"; |
| 1086 | 1126 | $sql .= " FROM " . MAIN_DB_PREFIX . "projet_task_time as t"; |
| 1087 | 1127 | $sql .= " WHERE 1 = 1"; |
| 1088 | - if ($morewherefilter) |
|
| 1089 | - $sql .= $morewherefilter; |
|
| 1090 | - if ($id > 0) |
|
| 1091 | - $sql .= " AND t.fk_task = " . $id; |
|
| 1092 | - if ($userid > 0) |
|
| 1093 | - $sql .= " AND t.fk_user = " . $userid; |
|
| 1128 | + if ($morewherefilter) { |
|
| 1129 | + $sql .= $morewherefilter; |
|
| 1130 | + } |
|
| 1131 | + if ($id > 0) { |
|
| 1132 | + $sql .= " AND t.fk_task = " . $id; |
|
| 1133 | + } |
|
| 1134 | + if ($userid > 0) { |
|
| 1135 | + $sql .= " AND t.fk_user = " . $userid; |
|
| 1136 | + } |
|
| 1094 | 1137 | |
| 1095 | 1138 | dol_syslog(get_class($this) . "::getSummaryOfTimeSpent", LOG_DEBUG); |
| 1096 | 1139 | $resql = $this->db->query($sql); |
@@ -1127,8 +1170,9 @@ discard block |
||
| 1127 | 1170 | { |
| 1128 | 1171 | global $langs; |
| 1129 | 1172 | |
| 1130 | - if (empty($id)) |
|
| 1131 | - $id = $this->id; |
|
| 1173 | + if (empty($id)) { |
|
| 1174 | + $id = $this->id; |
|
| 1175 | + } |
|
| 1132 | 1176 | |
| 1133 | 1177 | $result = array(); |
| 1134 | 1178 | |
@@ -1251,8 +1295,9 @@ discard block |
||
| 1251 | 1295 | $sql .= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid"; |
| 1252 | 1296 | $sql .= " AND ptt.fk_user = " . $userobj->id; |
| 1253 | 1297 | $sql .= " AND pt.entity IN (" . getEntity('project') . ")"; |
| 1254 | - if ($morewherefilter) |
|
| 1255 | - $sql .= $morewherefilter; |
|
| 1298 | + if ($morewherefilter) { |
|
| 1299 | + $sql .= $morewherefilter; |
|
| 1300 | + } |
|
| 1256 | 1301 | |
| 1257 | 1302 | dol_syslog(get_class($this) . "::fetchAllTimeSpent", LOG_DEBUG); |
| 1258 | 1303 | $resql = $this->db->query($sql); |
@@ -1315,10 +1360,12 @@ discard block |
||
| 1315 | 1360 | $ret = 0; |
| 1316 | 1361 | |
| 1317 | 1362 | // Clean parameters |
| 1318 | - if (empty($this->timespent_datehour)) |
|
| 1319 | - $this->timespent_datehour = $this->timespent_date; |
|
| 1320 | - if (isset($this->timespent_note)) |
|
| 1321 | - $this->timespent_note = trim($this->timespent_note); |
|
| 1363 | + if (empty($this->timespent_datehour)) { |
|
| 1364 | + $this->timespent_datehour = $this->timespent_date; |
|
| 1365 | + } |
|
| 1366 | + if (isset($this->timespent_note)) { |
|
| 1367 | + $this->timespent_note = trim($this->timespent_note); |
|
| 1368 | + } |
|
| 1322 | 1369 | |
| 1323 | 1370 | $this->db->begin(); |
| 1324 | 1371 | |
@@ -1339,13 +1386,14 @@ discard block |
||
| 1339 | 1386 | if ($result < 0) { |
| 1340 | 1387 | $this->db->rollback(); |
| 1341 | 1388 | $ret = -1; |
| 1342 | - } else |
|
| 1343 | - $ret = 1; |
|
| 1389 | + } else { |
|
| 1390 | + $ret = 1; |
|
| 1391 | + } |
|
| 1344 | 1392 | // End call triggers |
| 1345 | - } else |
|
| 1346 | - $ret = 1; |
|
| 1347 | - } |
|
| 1348 | - else { |
|
| 1393 | + } else { |
|
| 1394 | + $ret = 1; |
|
| 1395 | + } |
|
| 1396 | + } else { |
|
| 1349 | 1397 | $this->error = $this->db->lasterror(); |
| 1350 | 1398 | $this->db->rollback(); |
| 1351 | 1399 | $ret = -1; |
@@ -1366,8 +1414,9 @@ discard block |
||
| 1366 | 1414 | } |
| 1367 | 1415 | } |
| 1368 | 1416 | |
| 1369 | - if ($ret >= 0) |
|
| 1370 | - $this->db->commit(); |
|
| 1417 | + if ($ret >= 0) { |
|
| 1418 | + $this->db->commit(); |
|
| 1419 | + } |
|
| 1371 | 1420 | return $ret; |
| 1372 | 1421 | } |
| 1373 | 1422 | |
@@ -1674,48 +1723,48 @@ discard block |
||
| 1674 | 1723 | } elseif ($mode == 1) { |
| 1675 | 1724 | return $langs->trans($this->statuts_short[$statut]); |
| 1676 | 1725 | } elseif ($mode == 2) { |
| 1677 | - if ($statut == 0) |
|
| 1678 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1679 | - elseif ($statut == 1) |
|
| 1680 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1681 | - elseif ($statut == 2) |
|
| 1682 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1683 | - elseif ($statut == 3) |
|
| 1684 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1685 | - elseif ($statut == 4) |
|
| 1686 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1687 | - elseif ($statut == 5) |
|
| 1688 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1689 | - } |
|
| 1690 | - elseif ($mode == 3) { |
|
| 1691 | - if ($statut == 0) |
|
| 1692 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); |
|
| 1693 | - elseif ($statut == 1) |
|
| 1694 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1'); |
|
| 1695 | - elseif ($statut == 2) |
|
| 1696 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3'); |
|
| 1697 | - elseif ($statut == 3) |
|
| 1698 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); |
|
| 1699 | - elseif ($statut == 4) |
|
| 1700 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); |
|
| 1701 | - elseif ($statut == 5) |
|
| 1702 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5'); |
|
| 1703 | - } |
|
| 1704 | - elseif ($mode == 4) { |
|
| 1705 | - if ($statut == 0) |
|
| 1706 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1707 | - elseif ($statut == 1) |
|
| 1708 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1709 | - elseif ($statut == 2) |
|
| 1710 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1711 | - elseif ($statut == 3) |
|
| 1712 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1713 | - elseif ($statut == 4) |
|
| 1714 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1715 | - elseif ($statut == 5) |
|
| 1716 | - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1717 | - } |
|
| 1718 | - elseif ($mode == 5) { |
|
| 1726 | + if ($statut == 0) { |
|
| 1727 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1728 | + } elseif ($statut == 1) { |
|
| 1729 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1730 | + } elseif ($statut == 2) { |
|
| 1731 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1732 | + } elseif ($statut == 3) { |
|
| 1733 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1734 | + } elseif ($statut == 4) { |
|
| 1735 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1736 | + } elseif ($statut == 5) { |
|
| 1737 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts_short[$statut]); |
|
| 1738 | + } |
|
| 1739 | + } elseif ($mode == 3) { |
|
| 1740 | + if ($statut == 0) { |
|
| 1741 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); |
|
| 1742 | + } elseif ($statut == 1) { |
|
| 1743 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1'); |
|
| 1744 | + } elseif ($statut == 2) { |
|
| 1745 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3'); |
|
| 1746 | + } elseif ($statut == 3) { |
|
| 1747 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); |
|
| 1748 | + } elseif ($statut == 4) { |
|
| 1749 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); |
|
| 1750 | + } elseif ($statut == 5) { |
|
| 1751 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5'); |
|
| 1752 | + } |
|
| 1753 | + } elseif ($mode == 4) { |
|
| 1754 | + if ($statut == 0) { |
|
| 1755 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1756 | + } elseif ($statut == 1) { |
|
| 1757 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1758 | + } elseif ($statut == 2) { |
|
| 1759 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1760 | + } elseif ($statut == 3) { |
|
| 1761 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1762 | + } elseif ($statut == 4) { |
|
| 1763 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1764 | + } elseif ($statut == 5) { |
|
| 1765 | + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5') . ' ' . $langs->trans($this->statuts[$statut]); |
|
| 1766 | + } |
|
| 1767 | + } elseif ($mode == 5) { |
|
| 1719 | 1768 | /* if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); |
| 1720 | 1769 | elseif ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); |
| 1721 | 1770 | elseif ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); |
@@ -1800,12 +1849,14 @@ discard block |
||
| 1800 | 1849 | $sql .= " AND p.fk_statut = 1"; |
| 1801 | 1850 | $sql .= " AND t.fk_projet = p.rowid"; |
| 1802 | 1851 | $sql .= " AND t.progress < 100"; // tasks to do |
| 1803 | - if (!$user->rights->projet->all->lire) |
|
| 1804 | - $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1852 | + if (!$user->rights->projet->all->lire) { |
|
| 1853 | + $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1854 | + } |
|
| 1805 | 1855 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1806 | 1856 | //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
| 1807 | - if ($socid) |
|
| 1808 | - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1857 | + if ($socid) { |
|
| 1858 | + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1859 | + } |
|
| 1809 | 1860 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1810 | 1861 | // if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; |
| 1811 | 1862 | //print $sql; |
@@ -1866,19 +1917,23 @@ discard block |
||
| 1866 | 1917 | $sql = "SELECT count(p.rowid) as nb"; |
| 1867 | 1918 | $sql .= " FROM " . MAIN_DB_PREFIX . "projet as p"; |
| 1868 | 1919 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on p.fk_soc = s.rowid"; |
| 1869 | - if (!$user->rights->societe->client->voir && !$socid) |
|
| 1870 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc = s.rowid"; |
|
| 1920 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
| 1921 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc = s.rowid"; |
|
| 1922 | + } |
|
| 1871 | 1923 | $sql .= ", " . MAIN_DB_PREFIX . "projet_task as t"; |
| 1872 | 1924 | $sql .= " WHERE p.entity IN (" . getEntity('project', 0) . ')'; |
| 1873 | 1925 | $sql .= " AND t.fk_projet = p.rowid"; // tasks to do |
| 1874 | - if ($mine || !$user->rights->projet->all->lire) |
|
| 1875 | - $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1926 | + if ($mine || !$user->rights->projet->all->lire) { |
|
| 1927 | + $sql .= " AND p.rowid IN (" . $projectsListId . ")"; |
|
| 1928 | + } |
|
| 1876 | 1929 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 1877 | 1930 | //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
| 1878 | - if ($socid) |
|
| 1879 | - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1880 | - if (!$user->rights->societe->client->voir && !$socid) |
|
| 1881 | - $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id . ") OR (s.rowid IS NULL))"; |
|
| 1931 | + if ($socid) { |
|
| 1932 | + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")"; |
|
| 1933 | + } |
|
| 1934 | + if (!$user->rights->societe->client->voir && !$socid) { |
|
| 1935 | + $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id . ") OR (s.rowid IS NULL))"; |
|
| 1936 | + } |
|
| 1882 | 1937 | |
| 1883 | 1938 | $resql = $this->db->query($sql); |
| 1884 | 1939 | if ($resql) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * \brief List all task of a project |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 29 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 30 | 30 | |
| 31 | 31 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 32 | 32 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
@@ -37,43 +37,43 @@ discard block |
||
| 37 | 37 | // Load translation files required by the page |
| 38 | 38 | $langs->loadLangs(array('projects', 'users', 'companies')); |
| 39 | 39 | |
| 40 | -$action=GETPOST('action','alpha'); |
|
| 41 | -$massaction=GETPOST('massaction','alpha'); |
|
| 42 | -$show_files=GETPOST('show_files','int'); |
|
| 43 | -$confirm=GETPOST('confirm','alpha'); |
|
| 40 | +$action = GETPOST('action', 'alpha'); |
|
| 41 | +$massaction = GETPOST('massaction', 'alpha'); |
|
| 42 | +$show_files = GETPOST('show_files', 'int'); |
|
| 43 | +$confirm = GETPOST('confirm', 'alpha'); |
|
| 44 | 44 | $toselect = GETPOST('toselect', 'array'); |
| 45 | 45 | |
| 46 | -$id=GETPOST('id','int'); |
|
| 46 | +$id = GETPOST('id', 'int'); |
|
| 47 | 47 | |
| 48 | -$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); |
|
| 49 | -$search_categ=GETPOST("search_categ",'alpha'); |
|
| 50 | -$search_project=GETPOST('search_project'); |
|
| 51 | -if (! isset($_GET['search_projectstatus']) && ! isset($_POST['search_projectstatus'])) |
|
| 48 | +$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
|
| 49 | +$search_categ = GETPOST("search_categ", 'alpha'); |
|
| 50 | +$search_project = GETPOST('search_project'); |
|
| 51 | +if (!isset($_GET['search_projectstatus']) && !isset($_POST['search_projectstatus'])) |
|
| 52 | 52 | { |
| 53 | - if ($search_all != '') $search_projectstatus=-1; |
|
| 54 | - else $search_projectstatus=1; |
|
| 53 | + if ($search_all != '') $search_projectstatus = -1; |
|
| 54 | + else $search_projectstatus = 1; |
|
| 55 | 55 | } |
| 56 | -else $search_projectstatus=GETPOST('search_projectstatus'); |
|
| 57 | -$search_project_ref=GETPOST('search_project_ref'); |
|
| 58 | -$search_project_title=GETPOST('search_project_title'); |
|
| 59 | -$search_task_ref=GETPOST('search_task_ref'); |
|
| 60 | -$search_task_label=GETPOST('search_task_label'); |
|
| 61 | -$search_task_description=GETPOST('search_task_description'); |
|
| 62 | -$search_project_user=GETPOST('search_project_user'); |
|
| 63 | -$search_task_user=GETPOST('search_task_user'); |
|
| 64 | - |
|
| 65 | -$mine = $_REQUEST['mode']=='mine' ? 1 : 0; |
|
| 56 | +else $search_projectstatus = GETPOST('search_projectstatus'); |
|
| 57 | +$search_project_ref = GETPOST('search_project_ref'); |
|
| 58 | +$search_project_title = GETPOST('search_project_title'); |
|
| 59 | +$search_task_ref = GETPOST('search_task_ref'); |
|
| 60 | +$search_task_label = GETPOST('search_task_label'); |
|
| 61 | +$search_task_description = GETPOST('search_task_description'); |
|
| 62 | +$search_project_user = GETPOST('search_project_user'); |
|
| 63 | +$search_task_user = GETPOST('search_task_user'); |
|
| 64 | + |
|
| 65 | +$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; |
|
| 66 | 66 | if ($mine) { $search_task_user = $user->id; $mine = 0; } |
| 67 | 67 | |
| 68 | -$search_sday = GETPOST('search_sday','int'); |
|
| 69 | -$search_smonth = GETPOST('search_smonth','int'); |
|
| 70 | -$search_syear = GETPOST('search_syear','int'); |
|
| 71 | -$search_eday = GETPOST('search_eday','int'); |
|
| 72 | -$search_emonth = GETPOST('search_emonth','int'); |
|
| 73 | -$search_eyear = GETPOST('search_eyear','int'); |
|
| 68 | +$search_sday = GETPOST('search_sday', 'int'); |
|
| 69 | +$search_smonth = GETPOST('search_smonth', 'int'); |
|
| 70 | +$search_syear = GETPOST('search_syear', 'int'); |
|
| 71 | +$search_eday = GETPOST('search_eday', 'int'); |
|
| 72 | +$search_emonth = GETPOST('search_emonth', 'int'); |
|
| 73 | +$search_eyear = GETPOST('search_eyear', 'int'); |
|
| 74 | 74 | |
| 75 | 75 | // Initialize context for list |
| 76 | -$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'tasklist'; |
|
| 76 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tasklist'; |
|
| 77 | 77 | |
| 78 | 78 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 79 | 79 | $object = new Task($db); |
@@ -82,25 +82,25 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // fetch optionals attributes and labels |
| 84 | 84 | $extralabels = $extrafields->fetch_name_optionals_label('projet_task'); |
| 85 | -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); |
|
| 85 | +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
|
| 86 | 86 | |
| 87 | 87 | // Security check |
| 88 | -$socid=0; |
|
| 88 | +$socid = 0; |
|
| 89 | 89 | //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. |
| 90 | 90 | if (!$user->rights->projet->lire) accessforbidden(); |
| 91 | 91 | |
| 92 | -$diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id; |
|
| 92 | +$diroutputmassaction = $conf->projet->dir_output.'/tasks/temp/massgeneration/'.$user->id; |
|
| 93 | 93 | |
| 94 | -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; |
|
| 95 | -$sortfield = GETPOST("sortfield",'alpha'); |
|
| 96 | -$sortorder = GETPOST("sortorder",'alpha'); |
|
| 97 | -$page = GETPOST("page",'int'); |
|
| 94 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 95 | +$sortfield = GETPOST("sortfield", 'alpha'); |
|
| 96 | +$sortorder = GETPOST("sortorder", 'alpha'); |
|
| 97 | +$page = GETPOST("page", 'int'); |
|
| 98 | 98 | if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 |
| 99 | 99 | $offset = $limit * $page; |
| 100 | 100 | $pageprev = $page - 1; |
| 101 | 101 | $pagenext = $page + 1; |
| 102 | -if (! $sortfield) $sortfield='p.ref'; |
|
| 103 | -if (! $sortorder) $sortorder='DESC'; |
|
| 102 | +if (!$sortfield) $sortfield = 'p.ref'; |
|
| 103 | +if (!$sortorder) $sortorder = 'DESC'; |
|
| 104 | 104 | |
| 105 | 105 | // List of fields to search into when doing a "search in all" |
| 106 | 106 | $fieldstosearchall = array( |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | 't.description'=>"Description", |
| 110 | 110 | 't.note_public'=>"NotePublic", |
| 111 | 111 | ); |
| 112 | -if (empty($user->socid)) $fieldstosearchall['t.note_private']="NotePrivate"; |
|
| 112 | +if (empty($user->socid)) $fieldstosearchall['t.note_private'] = "NotePrivate"; |
|
| 113 | 113 | |
| 114 | -$arrayfields=array( |
|
| 114 | +$arrayfields = array( |
|
| 115 | 115 | 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), |
| 116 | 116 | 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), |
| 117 | 117 | 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | // Extra fields |
| 132 | 132 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) |
| 133 | 133 | { |
| 134 | - foreach($extrafields->attribute_label as $key => $val) |
|
| 134 | + foreach ($extrafields->attribute_label as $key => $val) |
|
| 135 | 135 | { |
| 136 | - if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); |
|
| 136 | + if (!empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key] = array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key])); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | * Actions |
| 143 | 143 | */ |
| 144 | 144 | |
| 145 | -if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } |
|
| 146 | -if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } |
|
| 145 | +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } |
|
| 146 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; } |
|
| 147 | 147 | |
| 148 | -$parameters=array('socid'=>$socid); |
|
| 149 | -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
| 148 | +$parameters = array('socid'=>$socid); |
|
| 149 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 150 | 150 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 151 | 151 | |
| 152 | 152 | if (empty($reshook)) |
@@ -155,39 +155,39 @@ discard block |
||
| 155 | 155 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 156 | 156 | |
| 157 | 157 | // Purge search criteria |
| 158 | - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers |
|
| 158 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
| 159 | 159 | { |
| 160 | - $search_all=""; |
|
| 161 | - $search_categ=""; |
|
| 162 | - $search_project=""; |
|
| 163 | - $search_projectstatus=-1; |
|
| 164 | - $search_project_ref=""; |
|
| 165 | - $search_project_title=""; |
|
| 166 | - $search_task_ref=""; |
|
| 167 | - $search_task_label=""; |
|
| 168 | - $search_task_description=""; |
|
| 169 | - $search_task_user=-1; |
|
| 170 | - $search_project_user=-1; |
|
| 171 | - $search_sday=''; |
|
| 172 | - $search_smonth=''; |
|
| 173 | - $search_syear=''; |
|
| 174 | - $search_eday=''; |
|
| 175 | - $search_emonth=''; |
|
| 176 | - $search_eyear=''; |
|
| 177 | - $toselect=''; |
|
| 178 | - $search_array_options=array(); |
|
| 160 | + $search_all = ""; |
|
| 161 | + $search_categ = ""; |
|
| 162 | + $search_project = ""; |
|
| 163 | + $search_projectstatus = -1; |
|
| 164 | + $search_project_ref = ""; |
|
| 165 | + $search_project_title = ""; |
|
| 166 | + $search_task_ref = ""; |
|
| 167 | + $search_task_label = ""; |
|
| 168 | + $search_task_description = ""; |
|
| 169 | + $search_task_user = -1; |
|
| 170 | + $search_project_user = -1; |
|
| 171 | + $search_sday = ''; |
|
| 172 | + $search_smonth = ''; |
|
| 173 | + $search_syear = ''; |
|
| 174 | + $search_eday = ''; |
|
| 175 | + $search_emonth = ''; |
|
| 176 | + $search_eyear = ''; |
|
| 177 | + $toselect = ''; |
|
| 178 | + $search_array_options = array(); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | // Mass actions |
| 182 | - $objectclass='Task'; |
|
| 183 | - $objectlabel='Tasks'; |
|
| 182 | + $objectclass = 'Task'; |
|
| 183 | + $objectlabel = 'Tasks'; |
|
| 184 | 184 | $permtoread = $user->rights->projet->lire; |
| 185 | 185 | $permtodelete = $user->rights->projet->supprimer; |
| 186 | 186 | $uploaddir = $conf->projet->dir_output.'/tasks'; |
| 187 | 187 | include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | -if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1; |
|
| 190 | +if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus = 1; |
|
| 191 | 191 | |
| 192 | 192 | |
| 193 | 193 | |
@@ -197,16 +197,16 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | |
| 199 | 199 | $now = dol_now(); |
| 200 | -$form=new Form($db); |
|
| 201 | -$formother=new FormOther($db); |
|
| 202 | -$socstatic=new Societe($db); |
|
| 200 | +$form = new Form($db); |
|
| 201 | +$formother = new FormOther($db); |
|
| 202 | +$socstatic = new Societe($db); |
|
| 203 | 203 | $projectstatic = new Project($db); |
| 204 | -$puser=new User($db); |
|
| 205 | -$tuser=new User($db); |
|
| 204 | +$puser = new User($db); |
|
| 205 | +$tuser = new User($db); |
|
| 206 | 206 | if ($search_project_user > 0) $puser->fetch($search_project_user); |
| 207 | 207 | if ($search_task_user > 0) $tuser->fetch($search_task_user); |
| 208 | 208 | |
| 209 | -$title=$langs->trans("Activities"); |
|
| 209 | +$title = $langs->trans("Activities"); |
|
| 210 | 210 | //if ($search_task_user == $user->id) $title=$langs->trans("MyActivities"); |
| 211 | 211 | |
| 212 | 212 | if ($id) |
@@ -216,68 +216,68 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Get list of project id allowed to user (in a string list separated by coma) |
| 219 | -if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); |
|
| 219 | +if (!$user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); |
|
| 220 | 220 | //var_dump($projectsListId); |
| 221 | 221 | |
| 222 | 222 | // Get id of types of contacts for projects (This list never contains a lot of elements) |
| 223 | -$listofprojectcontacttype=array(); |
|
| 223 | +$listofprojectcontacttype = array(); |
|
| 224 | 224 | $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
| 225 | -$sql.= " WHERE ctc.element = '" . $projectstatic->element . "'"; |
|
| 226 | -$sql.= " AND ctc.source = 'internal'"; |
|
| 225 | +$sql .= " WHERE ctc.element = '".$projectstatic->element."'"; |
|
| 226 | +$sql .= " AND ctc.source = 'internal'"; |
|
| 227 | 227 | $resql = $db->query($sql); |
| 228 | 228 | if ($resql) |
| 229 | 229 | { |
| 230 | - while($obj = $db->fetch_object($resql)) |
|
| 230 | + while ($obj = $db->fetch_object($resql)) |
|
| 231 | 231 | { |
| 232 | - $listofprojectcontacttype[$obj->rowid]=$obj->code; |
|
| 232 | + $listofprojectcontacttype[$obj->rowid] = $obj->code; |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | else dol_print_error($db); |
| 236 | -if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid sql syntax error if not found |
|
| 236 | +if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found |
|
| 237 | 237 | // Get id of types of contacts for tasks (This list never contains a lot of elements) |
| 238 | -$listoftaskcontacttype=array(); |
|
| 238 | +$listoftaskcontacttype = array(); |
|
| 239 | 239 | $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc"; |
| 240 | -$sql.= " WHERE ctc.element = '" . $object->element . "'"; |
|
| 241 | -$sql.= " AND ctc.source = 'internal'"; |
|
| 240 | +$sql .= " WHERE ctc.element = '".$object->element."'"; |
|
| 241 | +$sql .= " AND ctc.source = 'internal'"; |
|
| 242 | 242 | $resql = $db->query($sql); |
| 243 | 243 | if ($resql) |
| 244 | 244 | { |
| 245 | - while($obj = $db->fetch_object($resql)) |
|
| 245 | + while ($obj = $db->fetch_object($resql)) |
|
| 246 | 246 | { |
| 247 | - $listoftaskcontacttype[$obj->rowid]=$obj->code; |
|
| 247 | + $listoftaskcontacttype[$obj->rowid] = $obj->code; |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | else dol_print_error($db); |
| 251 | -if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found |
|
| 251 | +if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found |
|
| 252 | 252 | |
| 253 | -$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. |
|
| 253 | +$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. |
|
| 254 | 254 | $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate"; |
| 255 | -$sql.= ", s.nom as name, s.rowid as socid"; |
|
| 256 | -$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; |
|
| 257 | -$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; |
|
| 255 | +$sql .= ", s.nom as name, s.rowid as socid"; |
|
| 256 | +$sql .= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; |
|
| 257 | +$sql .= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; |
|
| 258 | 258 | // We'll need these fields in order to filter by categ |
| 259 | 259 | if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; |
| 260 | 260 | // Add fields from extrafields |
| 261 | -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
| 261 | +foreach ($extrafields->attribute_label as $key => $val) $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); |
|
| 262 | 262 | // Add fields from hooks |
| 263 | -$parameters=array(); |
|
| 264 | -$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook |
|
| 265 | -$sql.=$hookmanager->resPrint; |
|
| 266 | -$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
| 267 | -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; |
|
| 263 | +$parameters = array(); |
|
| 264 | +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook |
|
| 265 | +$sql .= $hookmanager->resPrint; |
|
| 266 | +$sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
|
| 267 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; |
|
| 268 | 268 | // We'll need this table joined to the select in order to filter by categ |
| 269 | -if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ |
|
| 270 | -$sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 271 | -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
| 272 | -if ($search_project_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; |
|
| 273 | -if ($search_task_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as ect"; |
|
| 274 | -$sql.= " WHERE t.fk_projet = p.rowid"; |
|
| 275 | -$sql.= " AND p.entity IN (".getEntity('project').')'; |
|
| 276 | -if (! $user->rights->projet->all->lire) $sql.=" AND p.rowid IN (".($projectsListId?$projectsListId:'0').")"; // public and assigned to projects, or restricted to company for external users |
|
| 269 | +if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ |
|
| 270 | +$sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; |
|
| 271 | +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as ef on (t.rowid = ef.fk_object)"; |
|
| 272 | +if ($search_project_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ecp"; |
|
| 273 | +if ($search_task_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ect"; |
|
| 274 | +$sql .= " WHERE t.fk_projet = p.rowid"; |
|
| 275 | +$sql .= " AND p.entity IN (".getEntity('project').')'; |
|
| 276 | +if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".($projectsListId ? $projectsListId : '0').")"; // public and assigned to projects, or restricted to company for external users |
|
| 277 | 277 | // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser |
| 278 | -if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
| 279 | -if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); |
|
| 280 | -if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; |
|
| 278 | +if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; |
|
| 279 | +if ($search_categ > 0) $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ); |
|
| 280 | +if ($search_categ == -2) $sql .= " AND cs.fk_categorie IS NULL"; |
|
| 281 | 281 | if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); |
| 282 | 282 | if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); |
| 283 | 283 | if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); |
@@ -286,28 +286,28 @@ discard block |
||
| 286 | 286 | if ($search_smonth > 0) |
| 287 | 287 | { |
| 288 | 288 | if ($search_syear > 0 && empty($search_sday)) |
| 289 | - $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,$search_smonth,false))."' AND '".$db->idate(dol_get_last_day($search_syear,$search_smonth,false))."'"; |
|
| 290 | - else if ($search_syear > 0 && ! empty($search_sday)) |
|
| 291 | - $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_smonth, $search_sday, $search_syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_smonth, $search_sday, $search_syear))."'"; |
|
| 289 | + $sql .= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear, $search_smonth, false))."' AND '".$db->idate(dol_get_last_day($search_syear, $search_smonth, false))."'"; |
|
| 290 | + else if ($search_syear > 0 && !empty($search_sday)) |
|
| 291 | + $sql .= " AND t.dateo BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_smonth, $search_sday, $search_syear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_smonth, $search_sday, $search_syear))."'"; |
|
| 292 | 292 | else |
| 293 | - $sql.= " AND date_format(t.dateo, '%m') = '".$search_smonth."'"; |
|
| 293 | + $sql .= " AND date_format(t.dateo, '%m') = '".$search_smonth."'"; |
|
| 294 | 294 | } |
| 295 | 295 | else if ($search_syear > 0) |
| 296 | 296 | { |
| 297 | - $sql.= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear,1,false))."' AND '".$db->idate(dol_get_last_day($search_syear,12,false))."'"; |
|
| 297 | + $sql .= " AND t.dateo BETWEEN '".$db->idate(dol_get_first_day($search_syear, 1, false))."' AND '".$db->idate(dol_get_last_day($search_syear, 12, false))."'"; |
|
| 298 | 298 | } |
| 299 | 299 | if ($search_emonth > 0) |
| 300 | 300 | { |
| 301 | 301 | if ($search_eyear > 0 && empty($search_eday)) |
| 302 | - $sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,$search_emonth,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,$search_emonth,false))."'"; |
|
| 303 | - else if ($search_eyear > 0 && ! empty($search_eday)) |
|
| 304 | - $sql.= " AND t.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_emonth, $search_eday, $search_eyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_emonth, $search_eday, $search_eyear))."'"; |
|
| 302 | + $sql .= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear, $search_emonth, false))."' AND '".$db->idate(dol_get_last_day($search_eyear, $search_emonth, false))."'"; |
|
| 303 | + else if ($search_eyear > 0 && !empty($search_eday)) |
|
| 304 | + $sql .= " AND t.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_emonth, $search_eday, $search_eyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_emonth, $search_eday, $search_eyear))."'"; |
|
| 305 | 305 | else |
| 306 | - $sql.= " AND date_format(t.datee, '%m') = '".$search_emonth."'"; |
|
| 306 | + $sql .= " AND date_format(t.datee, '%m') = '".$search_emonth."'"; |
|
| 307 | 307 | } |
| 308 | 308 | else if ($search_eyear > 0) |
| 309 | 309 | { |
| 310 | - $sql.= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_eyear,12,false))."'"; |
|
| 310 | + $sql .= " AND t.datee BETWEEN '".$db->idate(dol_get_first_day($search_eyear, 1, false))."' AND '".$db->idate(dol_get_last_day($search_eyear, 12, false))."'"; |
|
| 311 | 311 | } |
| 312 | 312 | if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
| 313 | 313 | if ($search_projectstatus >= 0) |
@@ -315,16 +315,16 @@ discard block |
||
| 315 | 315 | if ($search_projectstatus == 99) $sql .= " AND p.fk_statut <> 2"; |
| 316 | 316 | else $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus); |
| 317 | 317 | } |
| 318 | -if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); |
|
| 319 | -if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; |
|
| 320 | -if ($search_task_user > 0) $sql.= " AND ect.fk_c_type_contact IN (".join(',',array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user; |
|
| 318 | +if ($search_public != '') $sql .= " AND p.public = ".$db->escape($search_public); |
|
| 319 | +if ($search_project_user > 0) $sql .= " AND ecp.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; |
|
| 320 | +if ($search_task_user > 0) $sql .= " AND ect.fk_c_type_contact IN (".join(',', array_keys($listoftaskcontacttype)).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$search_task_user; |
|
| 321 | 321 | // Add where from extra fields |
| 322 | 322 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; |
| 323 | 323 | // Add where from hooks |
| 324 | -$parameters=array(); |
|
| 325 | -$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook |
|
| 326 | -$sql.=$hookmanager->resPrint; |
|
| 327 | -$sql.= $db->order($sortfield,$sortorder); |
|
| 324 | +$parameters = array(); |
|
| 325 | +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
| 326 | +$sql .= $hookmanager->resPrint; |
|
| 327 | +$sql .= $db->order($sortfield, $sortorder); |
|
| 328 | 328 | |
| 329 | 329 | $nbtotalofrecords = ''; |
| 330 | 330 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) |
@@ -338,12 +338,12 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | -$sql.= $db->plimit($limit + 1,$offset); |
|
| 341 | +$sql .= $db->plimit($limit + 1, $offset); |
|
| 342 | 342 | |
| 343 | 343 | dol_syslog("list allowed project", LOG_DEBUG); |
| 344 | 344 | |
| 345 | 345 | $resql = $db->query($sql); |
| 346 | -if (! $resql) |
|
| 346 | +if (!$resql) |
|
| 347 | 347 | { |
| 348 | 348 | dol_print_error($db); |
| 349 | 349 | exit; |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $num = $db->num_rows($resql); |
| 353 | 353 | |
| 354 | -$arrayofselected=is_array($toselect)?$toselect:array(); |
|
| 354 | +$arrayofselected = is_array($toselect) ? $toselect : array(); |
|
| 355 | 355 | |
| 356 | -if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) |
|
| 356 | +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) |
|
| 357 | 357 | { |
| 358 | 358 | $obj = $db->fetch_object($resql); |
| 359 | 359 | $id = $obj->id; |
@@ -361,50 +361,50 @@ discard block |
||
| 361 | 361 | exit; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | -$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; |
|
| 364 | +$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; |
|
| 365 | 365 | llxHeader("", $title, $help_url); |
| 366 | 366 | |
| 367 | -$param=''; |
|
| 368 | -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; |
|
| 369 | -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; |
|
| 370 | -if ($search_sday) $param.='&search_sday='.$search_sday; |
|
| 371 | -if ($search_smonth) $param.='&search_smonth='.$search_smonth; |
|
| 372 | -if ($search_syear) $param.='&search_syear=' .$search_syear; |
|
| 373 | -if ($search_eday) $param.='&search_eday='.$search_eday; |
|
| 374 | -if ($search_emonth) $param.='&search_emonth='.$search_emonth; |
|
| 375 | -if ($search_eyear) $param.='&search_eyear=' .$search_eyear; |
|
| 376 | -if ($socid) $param.='&socid='.$socid; |
|
| 377 | -if ($search_all != '') $param.='&search_all='.$search_all; |
|
| 378 | -if ($search_project_ref != '') $param.='&search_project_ref='.$search_project_ref; |
|
| 379 | -if ($search_project_title != '') $param.='&search_project_title='.$search_project_title; |
|
| 380 | -if ($search_ref != '') $param.='&search_ref='.$search_ref; |
|
| 381 | -if ($search_label != '') $param.='&search_label='.$search_label; |
|
| 382 | -if ($search_societe != '') $param.='&search_societe='.$search_societe; |
|
| 383 | -if ($search_projectstatus != '') $param.='&search_projectstatus='.$search_projectstatus; |
|
| 384 | -if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); |
|
| 385 | -if ($search_public != '') $param.='&search_public='.$search_public; |
|
| 386 | -if ($search_project_user != '') $param.='&search_project_user='.$search_project_user; |
|
| 387 | -if ($search_task_user > 0) $param.='&search_task_user='.$search_task_user; |
|
| 388 | -if ($optioncss != '') $param.='&optioncss='.$optioncss; |
|
| 367 | +$param = ''; |
|
| 368 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; |
|
| 369 | +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; |
|
| 370 | +if ($search_sday) $param .= '&search_sday='.$search_sday; |
|
| 371 | +if ($search_smonth) $param .= '&search_smonth='.$search_smonth; |
|
| 372 | +if ($search_syear) $param .= '&search_syear='.$search_syear; |
|
| 373 | +if ($search_eday) $param .= '&search_eday='.$search_eday; |
|
| 374 | +if ($search_emonth) $param .= '&search_emonth='.$search_emonth; |
|
| 375 | +if ($search_eyear) $param .= '&search_eyear='.$search_eyear; |
|
| 376 | +if ($socid) $param .= '&socid='.$socid; |
|
| 377 | +if ($search_all != '') $param .= '&search_all='.$search_all; |
|
| 378 | +if ($search_project_ref != '') $param .= '&search_project_ref='.$search_project_ref; |
|
| 379 | +if ($search_project_title != '') $param .= '&search_project_title='.$search_project_title; |
|
| 380 | +if ($search_ref != '') $param .= '&search_ref='.$search_ref; |
|
| 381 | +if ($search_label != '') $param .= '&search_label='.$search_label; |
|
| 382 | +if ($search_societe != '') $param .= '&search_societe='.$search_societe; |
|
| 383 | +if ($search_projectstatus != '') $param .= '&search_projectstatus='.$search_projectstatus; |
|
| 384 | +if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'none'))) $param .= '&search_opp_status='.urlencode($search_opp_status); |
|
| 385 | +if ($search_public != '') $param .= '&search_public='.$search_public; |
|
| 386 | +if ($search_project_user != '') $param .= '&search_project_user='.$search_project_user; |
|
| 387 | +if ($search_task_user > 0) $param .= '&search_task_user='.$search_task_user; |
|
| 388 | +if ($optioncss != '') $param .= '&optioncss='.$optioncss; |
|
| 389 | 389 | // Add $param from extra fields |
| 390 | 390 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; |
| 391 | 391 | |
| 392 | 392 | // List of mass actions available |
| 393 | -$arrayofmassactions = array( |
|
| 393 | +$arrayofmassactions = array( |
|
| 394 | 394 | // 'presend'=>$langs->trans("SendByMail"), |
| 395 | 395 | // 'builddoc'=>$langs->trans("PDFMerge"), |
| 396 | 396 | ); |
| 397 | 397 | //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); |
| 398 | -if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); |
|
| 399 | -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); |
|
| 400 | -$massactionbutton=$form->selectMassAction('', $arrayofmassactions); |
|
| 398 | +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = $langs->trans("Delete"); |
|
| 399 | +if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); |
|
| 400 | +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
|
| 401 | 401 | |
| 402 | -$newcardbutton=''; |
|
| 402 | +$newcardbutton = ''; |
|
| 403 | 403 | if ($user->rights->projet->creer) |
| 404 | 404 | { |
| 405 | 405 | $newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/projet/tasks.php?action=create"><span class="valignmiddle">'.$langs->trans('NewTask').'</span>'; |
| 406 | - $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 407 | - $newcardbutton.= '</a>'; |
|
| 406 | + $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
|
| 407 | + $newcardbutton .= '</a>'; |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
@@ -425,143 +425,143 @@ discard block |
||
| 425 | 425 | if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'<br><br>'; |
| 426 | 426 | else |
| 427 | 427 | { |
| 428 | - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("TasksOnProjectsDesc").'<br><br>'; |
|
| 428 | + if ($user->rights->projet->all->lire && !$socid) print $langs->trans("TasksOnProjectsDesc").'<br><br>'; |
|
| 429 | 429 | else print $langs->trans("TasksOnProjectsPublicDesc").'<br><br>'; |
| 430 | 430 | } |
| 431 | 431 | print '</div>'; |
| 432 | 432 | |
| 433 | -$topicmail="Information"; |
|
| 434 | -$modelmail="task"; |
|
| 435 | -$objecttmp=new Task($db); |
|
| 436 | -$trackid='tas'.$object->id; |
|
| 433 | +$topicmail = "Information"; |
|
| 434 | +$modelmail = "task"; |
|
| 435 | +$objecttmp = new Task($db); |
|
| 436 | +$trackid = 'tas'.$object->id; |
|
| 437 | 437 | include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; |
| 438 | 438 | |
| 439 | 439 | if ($search_all) |
| 440 | 440 | { |
| 441 | - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); |
|
| 442 | - print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'</div>'; |
|
| 441 | + foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); |
|
| 442 | + print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | $morehtmlfilter = ''; |
| 446 | 446 | |
| 447 | 447 | // Filter on categories |
| 448 | -if (! empty($conf->categorie->enabled)) |
|
| 448 | +if (!empty($conf->categorie->enabled)) |
|
| 449 | 449 | { |
| 450 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 451 | - $moreforfilter.='<div class="divsearchfield">'; |
|
| 452 | - $moreforfilter.=$langs->trans('ProjectCategories'). ': '; |
|
| 453 | - $moreforfilter.=$formother->select_categories('project', $search_categ, 'search_categ', 1, 'maxwidth300'); |
|
| 454 | - $moreforfilter.='</div>'; |
|
| 450 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 451 | + $moreforfilter .= '<div class="divsearchfield">'; |
|
| 452 | + $moreforfilter .= $langs->trans('ProjectCategories').': '; |
|
| 453 | + $moreforfilter .= $formother->select_categories('project', $search_categ, 'search_categ', 1, 'maxwidth300'); |
|
| 454 | + $moreforfilter .= '</div>'; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | // If the user can view users |
| 458 | -$moreforfilter.='<div class="divsearchfield">'; |
|
| 459 | -$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ' '; |
|
| 460 | -$includeonly=''; |
|
| 461 | -if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); |
|
| 462 | -$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); |
|
| 463 | -$moreforfilter.='</div>'; |
|
| 458 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
| 459 | +$moreforfilter .= $langs->trans('ProjectsWithThisUserAsContact').' '; |
|
| 460 | +$includeonly = ''; |
|
| 461 | +if (empty($user->rights->user->user->lire)) $includeonly = array($user->id); |
|
| 462 | +$moreforfilter .= $form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); |
|
| 463 | +$moreforfilter .= '</div>'; |
|
| 464 | 464 | |
| 465 | 465 | // If the user can view users |
| 466 | -$moreforfilter.='<div class="divsearchfield">'; |
|
| 467 | -$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': '; |
|
| 468 | -$includeonly=''; |
|
| 469 | -if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); |
|
| 470 | -$moreforfilter.=$form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); |
|
| 471 | -$moreforfilter.='</div>'; |
|
| 472 | - |
|
| 473 | -if (! empty($moreforfilter)) |
|
| 466 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
| 467 | +$moreforfilter .= $langs->trans('TasksWithThisUserAsContact').': '; |
|
| 468 | +$includeonly = ''; |
|
| 469 | +if (empty($user->rights->user->user->lire)) $includeonly = array($user->id); |
|
| 470 | +$moreforfilter .= $form->select_dolusers($search_task_user, 'search_task_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); |
|
| 471 | +$moreforfilter .= '</div>'; |
|
| 472 | + |
|
| 473 | +if (!empty($moreforfilter)) |
|
| 474 | 474 | { |
| 475 | 475 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
| 476 | 476 | print $moreforfilter; |
| 477 | - $parameters=array(); |
|
| 478 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
| 477 | + $parameters = array(); |
|
| 478 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
| 479 | 479 | print $hookmanager->resPrint; |
| 480 | 480 | print '</div>'; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | -$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; |
|
| 484 | -$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
| 485 | -if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); |
|
| 483 | +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
|
| 484 | +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
|
| 485 | +if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
|
| 486 | 486 | |
| 487 | 487 | print '<div class="div-table-responsive">'; |
| 488 | -print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n"; |
|
| 488 | +print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n"; |
|
| 489 | 489 | |
| 490 | 490 | print '<tr class="liste_titre_filter">'; |
| 491 | -if (! empty($arrayfields['t.ref']['checked'])) |
|
| 491 | +if (!empty($arrayfields['t.ref']['checked'])) |
|
| 492 | 492 | { |
| 493 | 493 | print '<td class="liste_titre">'; |
| 494 | 494 | print '<input type="text" class="flat" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'" size="4">'; |
| 495 | 495 | print '</td>'; |
| 496 | 496 | } |
| 497 | -if (! empty($arrayfields['t.label']['checked'])) |
|
| 497 | +if (!empty($arrayfields['t.label']['checked'])) |
|
| 498 | 498 | { |
| 499 | 499 | print '<td class="liste_titre">'; |
| 500 | 500 | print '<input type="text" class="flat" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'" size="8">'; |
| 501 | 501 | print '</td>'; |
| 502 | 502 | } |
| 503 | 503 | // Start date |
| 504 | -if (! empty($arrayfields['t.dateo']['checked'])) |
|
| 504 | +if (!empty($arrayfields['t.dateo']['checked'])) |
|
| 505 | 505 | { |
| 506 | 506 | print '<td class="liste_titre center">'; |
| 507 | - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">'; |
|
| 507 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">'; |
|
| 508 | 508 | print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.$search_smonth.'">'; |
| 509 | - $formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5); |
|
| 509 | + $formother->select_year($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5); |
|
| 510 | 510 | print '</td>'; |
| 511 | 511 | } |
| 512 | 512 | // End date |
| 513 | -if (! empty($arrayfields['t.datee']['checked'])) |
|
| 513 | +if (!empty($arrayfields['t.datee']['checked'])) |
|
| 514 | 514 | { |
| 515 | 515 | print '<td class="liste_titre center">'; |
| 516 | - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">'; |
|
| 516 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">'; |
|
| 517 | 517 | print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.$search_emonth.'">'; |
| 518 | - $formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5); |
|
| 518 | + $formother->select_year($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5); |
|
| 519 | 519 | print '</td>'; |
| 520 | 520 | } |
| 521 | -if (! empty($arrayfields['p.ref']['checked'])) |
|
| 521 | +if (!empty($arrayfields['p.ref']['checked'])) |
|
| 522 | 522 | { |
| 523 | 523 | print '<td class="liste_titre">'; |
| 524 | 524 | print '<input type="text" class="flat" name="search_project_ref" value="'.$search_project_ref.'" size="4">'; |
| 525 | 525 | print '</td>'; |
| 526 | 526 | } |
| 527 | -if (! empty($arrayfields['p.title']['checked'])) |
|
| 527 | +if (!empty($arrayfields['p.title']['checked'])) |
|
| 528 | 528 | { |
| 529 | 529 | print '<td class="liste_titre">'; |
| 530 | 530 | print '<input type="text" class="flat" name="search_project_title" value="'.$search_project_title.'" size="6">'; |
| 531 | 531 | print '</td>'; |
| 532 | 532 | } |
| 533 | -if (! empty($arrayfields['s.nom']['checked'])) |
|
| 533 | +if (!empty($arrayfields['s.nom']['checked'])) |
|
| 534 | 534 | { |
| 535 | 535 | print '<td class="liste_titre">'; |
| 536 | 536 | print '<input type="text" class="flat" name="search_societe" value="'.dol_escape_htmltag($search_societe).'" size="4">'; |
| 537 | 537 | print '</td>'; |
| 538 | 538 | } |
| 539 | -if (! empty($arrayfields['p.fk_statut']['checked'])) |
|
| 539 | +if (!empty($arrayfields['p.fk_statut']['checked'])) |
|
| 540 | 540 | { |
| 541 | 541 | print '<td class="liste_titre center">'; |
| 542 | 542 | $arrayofstatus = array(); |
| 543 | - foreach($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); |
|
| 544 | - $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; |
|
| 543 | + foreach ($projectstatic->statuts_short as $key => $val) $arrayofstatus[$key] = $langs->trans($val); |
|
| 544 | + $arrayofstatus['99'] = $langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; |
|
| 545 | 545 | print $form->selectarray('search_projectstatus', $arrayofstatus, $search_projectstatus, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); |
| 546 | 546 | print '</td>'; |
| 547 | 547 | } |
| 548 | -if (! empty($arrayfields['t.planned_workload']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 549 | -if (! empty($arrayfields['t.duration_effective']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 550 | -if (! empty($arrayfields['t.progress_calculated']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 551 | -if (! empty($arrayfields['t.progress']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 548 | +if (!empty($arrayfields['t.planned_workload']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 549 | +if (!empty($arrayfields['t.duration_effective']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 550 | +if (!empty($arrayfields['t.progress_calculated']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 551 | +if (!empty($arrayfields['t.progress']['checked'])) print '<td class="liste_titre"></td>'; |
|
| 552 | 552 | // Extra fields |
| 553 | 553 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; |
| 554 | 554 | // Fields from hook |
| 555 | -$parameters=array('arrayfields'=>$arrayfields); |
|
| 556 | -$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook |
|
| 555 | +$parameters = array('arrayfields'=>$arrayfields); |
|
| 556 | +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook |
|
| 557 | 557 | print $hookmanager->resPrint; |
| 558 | -if (! empty($arrayfields['t.datec']['checked'])) |
|
| 558 | +if (!empty($arrayfields['t.datec']['checked'])) |
|
| 559 | 559 | { |
| 560 | 560 | // Date creation |
| 561 | 561 | print '<td class="liste_titre">'; |
| 562 | 562 | print '</td>'; |
| 563 | 563 | } |
| 564 | -if (! empty($arrayfields['t.tms']['checked'])) |
|
| 564 | +if (!empty($arrayfields['t.tms']['checked'])) |
|
| 565 | 565 | { |
| 566 | 566 | // Date modification |
| 567 | 567 | print '<td class="liste_titre">'; |
@@ -569,44 +569,44 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | // Action column |
| 571 | 571 | print '<td class="liste_titre" align="right">'; |
| 572 | -$searchpicto=$form->showFilterButtons(); |
|
| 572 | +$searchpicto = $form->showFilterButtons(); |
|
| 573 | 573 | print $searchpicto; |
| 574 | 574 | print '</td>'; |
| 575 | 575 | print "</tr>\n"; |
| 576 | 576 | |
| 577 | 577 | print '<tr class="liste_titre">'; |
| 578 | -if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); |
|
| 579 | -if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'],$_SERVER["PHP_SELF"],"t.label","",$param,"",$sortfield,$sortorder); |
|
| 580 | -if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'],$_SERVER["PHP_SELF"],"t.dateo","",$param,'align="center"',$sortfield,$sortorder); |
|
| 581 | -if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'],$_SERVER["PHP_SELF"],"t.datee","",$param,'align="center"',$sortfield,$sortorder); |
|
| 582 | -if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); |
|
| 583 | -if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'],$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); |
|
| 584 | -if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); |
|
| 585 | -if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder); |
|
| 586 | -if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'],$_SERVER["PHP_SELF"],"t.planned_workload","",$param,'align="center"',$sortfield,$sortorder); |
|
| 587 | -if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'],$_SERVER["PHP_SELF"],"t.duration_effective","",$param,'align="center"',$sortfield,$sortorder); |
|
| 588 | -if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'],$_SERVER["PHP_SELF"],"","",$param,'align="center"'); |
|
| 589 | -if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'],$_SERVER["PHP_SELF"],"t.progress","",$param,'align="center"',$sortfield,$sortorder); |
|
| 578 | +if (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); |
|
| 579 | +if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); |
|
| 580 | +if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 581 | +if (!empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 582 | +if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); |
|
| 583 | +if (!empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); |
|
| 584 | +if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); |
|
| 585 | +if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 586 | +if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 587 | +if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 588 | +if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="center"'); |
|
| 589 | +if (!empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, 'align="center"', $sortfield, $sortorder); |
|
| 590 | 590 | // Extra fields |
| 591 | 591 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; |
| 592 | 592 | // Hook fields |
| 593 | -$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); |
|
| 594 | -$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
| 593 | +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); |
|
| 594 | +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
| 595 | 595 | print $hookmanager->resPrint; |
| 596 | -if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
| 597 | -if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); |
|
| 598 | -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); |
|
| 596 | +if (!empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
| 597 | +if (!empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); |
|
| 598 | +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); |
|
| 599 | 599 | print "</tr>\n"; |
| 600 | 600 | |
| 601 | 601 | |
| 602 | -$plannedworkloadoutputformat='allhourmin'; |
|
| 603 | -$timespentoutputformat='allhourmin'; |
|
| 604 | -if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
| 605 | -if (! empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
| 602 | +$plannedworkloadoutputformat = 'allhourmin'; |
|
| 603 | +$timespentoutputformat = 'allhourmin'; |
|
| 604 | +if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; |
|
| 605 | +if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; |
|
| 606 | 606 | |
| 607 | -$i=0; |
|
| 608 | -$totalarray=array(); |
|
| 609 | -while ($i < min($num,$limit)) |
|
| 607 | +$i = 0; |
|
| 608 | +$totalarray = array(); |
|
| 609 | +while ($i < min($num, $limit)) |
|
| 610 | 610 | { |
| 611 | 611 | $obj = $db->fetch_object($resql); |
| 612 | 612 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | $object->label = $obj->label; |
| 616 | 616 | $object->fk_statut = $obj->fk_statut; |
| 617 | 617 | $object->progress = $obj->progress; |
| 618 | - $object->datee = $db->jdate($obj->date_end); // deprecated |
|
| 618 | + $object->datee = $db->jdate($obj->date_end); // deprecated |
|
| 619 | 619 | $object->date_end = $db->jdate($obj->date_end); |
| 620 | 620 | |
| 621 | 621 | $projectstatic->id = $obj->projectid; |
@@ -625,69 +625,69 @@ discard block |
||
| 625 | 625 | $projectstatic->statut = $obj->projectstatus; |
| 626 | 626 | $projectstatic->datee = $db->jdate($obj->projectdatee); |
| 627 | 627 | |
| 628 | - $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? |
|
| 628 | + $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? |
|
| 629 | 629 | if ($userAccess >= 0) |
| 630 | 630 | { |
| 631 | 631 | print '<tr class="oddeven">'; |
| 632 | 632 | |
| 633 | 633 | // Ref |
| 634 | - if (! empty($arrayfields['t.ref']['checked'])) |
|
| 634 | + if (!empty($arrayfields['t.ref']['checked'])) |
|
| 635 | 635 | { |
| 636 | 636 | print '<td>'; |
| 637 | - print $object->getNomUrl(1,'withproject'); |
|
| 637 | + print $object->getNomUrl(1, 'withproject'); |
|
| 638 | 638 | if ($object->hasDelay()) print img_warning("Late"); |
| 639 | 639 | print '</td>'; |
| 640 | - if (! $i) $totalarray['nbfield']++; |
|
| 640 | + if (!$i) $totalarray['nbfield']++; |
|
| 641 | 641 | } |
| 642 | 642 | // Label |
| 643 | - if (! empty($arrayfields['t.label']['checked'])) |
|
| 643 | + if (!empty($arrayfields['t.label']['checked'])) |
|
| 644 | 644 | { |
| 645 | 645 | print '<td>'; |
| 646 | 646 | print $object->label; |
| 647 | 647 | print '</td>'; |
| 648 | - if (! $i) $totalarray['nbfield']++; |
|
| 648 | + if (!$i) $totalarray['nbfield']++; |
|
| 649 | 649 | } |
| 650 | 650 | // Date start |
| 651 | - if (! empty($arrayfields['t.dateo']['checked'])) |
|
| 651 | + if (!empty($arrayfields['t.dateo']['checked'])) |
|
| 652 | 652 | { |
| 653 | 653 | print '<td class="center">'; |
| 654 | - print dol_print_date($db->jdate($obj->date_start),'day'); |
|
| 654 | + print dol_print_date($db->jdate($obj->date_start), 'day'); |
|
| 655 | 655 | print '</td>'; |
| 656 | - if (! $i) $totalarray['nbfield']++; |
|
| 656 | + if (!$i) $totalarray['nbfield']++; |
|
| 657 | 657 | } |
| 658 | 658 | // Date end |
| 659 | - if (! empty($arrayfields['t.datee']['checked'])) |
|
| 659 | + if (!empty($arrayfields['t.datee']['checked'])) |
|
| 660 | 660 | { |
| 661 | 661 | print '<td class="center">'; |
| 662 | - print dol_print_date($db->jdate($obj->date_end),'day'); |
|
| 662 | + print dol_print_date($db->jdate($obj->date_end), 'day'); |
|
| 663 | 663 | print '</td>'; |
| 664 | - if (! $i) $totalarray['nbfield']++; |
|
| 664 | + if (!$i) $totalarray['nbfield']++; |
|
| 665 | 665 | } |
| 666 | 666 | // Project ref |
| 667 | - if (! empty($arrayfields['p.ref']['checked'])) |
|
| 667 | + if (!empty($arrayfields['p.ref']['checked'])) |
|
| 668 | 668 | { |
| 669 | 669 | print '<td class="nowrap">'; |
| 670 | 670 | print $projectstatic->getNomUrl(1, 'task'); |
| 671 | 671 | if ($projectstatic->hasDelay()) print img_warning("Late"); |
| 672 | 672 | print '</td>'; |
| 673 | - if (! $i) $totalarray['nbfield']++; |
|
| 673 | + if (!$i) $totalarray['nbfield']++; |
|
| 674 | 674 | } |
| 675 | 675 | // Project title |
| 676 | - if (! empty($arrayfields['p.title']['checked'])) |
|
| 676 | + if (!empty($arrayfields['p.title']['checked'])) |
|
| 677 | 677 | { |
| 678 | 678 | print '<td>'; |
| 679 | - print dol_trunc($obj->projecttitle,80); |
|
| 679 | + print dol_trunc($obj->projecttitle, 80); |
|
| 680 | 680 | print '</td>'; |
| 681 | - if (! $i) $totalarray['nbfield']++; |
|
| 681 | + if (!$i) $totalarray['nbfield']++; |
|
| 682 | 682 | } |
| 683 | 683 | // Third party |
| 684 | - if (! empty($arrayfields['s.nom']['checked'])) |
|
| 684 | + if (!empty($arrayfields['s.nom']['checked'])) |
|
| 685 | 685 | { |
| 686 | 686 | print '<td>'; |
| 687 | 687 | if ($obj->socid) |
| 688 | 688 | { |
| 689 | - $socstatic->id=$obj->socid; |
|
| 690 | - $socstatic->name=$obj->name; |
|
| 689 | + $socstatic->id = $obj->socid; |
|
| 690 | + $socstatic->name = $obj->name; |
|
| 691 | 691 | print $socstatic->getNomUrl(1); |
| 692 | 692 | } |
| 693 | 693 | else |
@@ -695,23 +695,23 @@ discard block |
||
| 695 | 695 | print ' '; |
| 696 | 696 | } |
| 697 | 697 | print '</td>'; |
| 698 | - if (! $i) $totalarray['nbfield']++; |
|
| 698 | + if (!$i) $totalarray['nbfield']++; |
|
| 699 | 699 | } |
| 700 | 700 | // Project status |
| 701 | - if (! empty($arrayfields['p.fk_statut']['checked'])) |
|
| 701 | + if (!empty($arrayfields['p.fk_statut']['checked'])) |
|
| 702 | 702 | { |
| 703 | 703 | print '<td align="center">'; |
| 704 | 704 | print $projectstatic->getLibStatut(1); |
| 705 | 705 | print '</td>'; |
| 706 | - if (! $i) $totalarray['nbfield']++; |
|
| 706 | + if (!$i) $totalarray['nbfield']++; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | // Planned workload |
| 710 | - if (! empty($arrayfields['t.planned_workload']['checked'])) |
|
| 710 | + if (!empty($arrayfields['t.planned_workload']['checked'])) |
|
| 711 | 711 | { |
| 712 | 712 | print '<td class="center">'; |
| 713 | - $fullhour=convertSecondToTime($obj->planned_workload,$plannedworkloadoutputformat); |
|
| 714 | - $workingdelay=convertSecondToTime($obj->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
| 713 | + $fullhour = convertSecondToTime($obj->planned_workload, $plannedworkloadoutputformat); |
|
| 714 | + $workingdelay = convertSecondToTime($obj->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks |
|
| 715 | 715 | if ($obj->planned_workload != '') |
| 716 | 716 | { |
| 717 | 717 | print $fullhour; |
@@ -720,41 +720,41 @@ discard block |
||
| 720 | 720 | } |
| 721 | 721 | //else print '--:--'; |
| 722 | 722 | print '</td>'; |
| 723 | - if (! $i) $totalarray['nbfield']++; |
|
| 724 | - if (! $i) $totalarray['totalplannedworkloadfield']=$totalarray['nbfield']; |
|
| 723 | + if (!$i) $totalarray['nbfield']++; |
|
| 724 | + if (!$i) $totalarray['totalplannedworkloadfield'] = $totalarray['nbfield']; |
|
| 725 | 725 | $totalarray['totalplannedworkload'] += $obj->planned_workload; |
| 726 | 726 | } |
| 727 | 727 | // Time spent |
| 728 | - if (! empty($arrayfields['t.duration_effective']['checked'])) |
|
| 728 | + if (!empty($arrayfields['t.duration_effective']['checked'])) |
|
| 729 | 729 | { |
| 730 | - $showlineingray=0;$showproject=1; |
|
| 730 | + $showlineingray = 0; $showproject = 1; |
|
| 731 | 731 | print '<td class="center">'; |
| 732 | 732 | if ($showlineingray) print '<i>'; |
| 733 | - else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.($showproject?'':'&withproject=1').'">'; |
|
| 734 | - if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat); |
|
| 733 | + else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.($showproject ? '' : '&withproject=1').'">'; |
|
| 734 | + if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective, $timespentoutputformat); |
|
| 735 | 735 | else print '--:--'; |
| 736 | 736 | if ($showlineingray) print '</i>'; |
| 737 | 737 | else print '</a>'; |
| 738 | 738 | print '</td>'; |
| 739 | - if (! $i) $totalarray['nbfield']++; |
|
| 740 | - if (! $i) $totalarray['totaldurationeffectivefield']=$totalarray['nbfield']; |
|
| 739 | + if (!$i) $totalarray['nbfield']++; |
|
| 740 | + if (!$i) $totalarray['totaldurationeffectivefield'] = $totalarray['nbfield']; |
|
| 741 | 741 | $totalarray['totaldurationeffective'] += $obj->duration_effective; |
| 742 | 742 | } |
| 743 | 743 | // Calculated progress |
| 744 | - if (! empty($arrayfields['t.progress_calculated']['checked'])) |
|
| 744 | + if (!empty($arrayfields['t.progress_calculated']['checked'])) |
|
| 745 | 745 | { |
| 746 | 746 | print '<td class="center">'; |
| 747 | 747 | if ($obj->planned_workload || $obj->duration_effective) |
| 748 | 748 | { |
| 749 | - if ($obj->planned_workload) print round(100 * $obj->duration_effective / $obj->planned_workload,2).' %'; |
|
| 750 | - else print $form->textwithpicto('',$langs->trans('WorkloadNotDefined'), 1, 'help'); |
|
| 749 | + if ($obj->planned_workload) print round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %'; |
|
| 750 | + else print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help'); |
|
| 751 | 751 | } |
| 752 | 752 | print '</td>'; |
| 753 | - if (! $i) $totalarray['nbfield']++; |
|
| 754 | - if (! $i) $totalarray['totalprogress_calculated']=$totalarray['nbfield']; |
|
| 753 | + if (!$i) $totalarray['nbfield']++; |
|
| 754 | + if (!$i) $totalarray['totalprogress_calculated'] = $totalarray['nbfield']; |
|
| 755 | 755 | } |
| 756 | 756 | // Declared progress |
| 757 | - if (! empty($arrayfields['t.progress']['checked'])) |
|
| 757 | + if (!empty($arrayfields['t.progress']['checked'])) |
|
| 758 | 758 | { |
| 759 | 759 | print '<td class="center">'; |
| 760 | 760 | if ($obj->progress != '') |
@@ -762,29 +762,29 @@ discard block |
||
| 762 | 762 | print $obj->progress.' %'; |
| 763 | 763 | } |
| 764 | 764 | print '</td>'; |
| 765 | - if (! $i) $totalarray['nbfield']++; |
|
| 765 | + if (!$i) $totalarray['nbfield']++; |
|
| 766 | 766 | } |
| 767 | 767 | // Extra fields |
| 768 | 768 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; |
| 769 | 769 | // Fields from hook |
| 770 | - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
| 771 | - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook |
|
| 770 | + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); |
|
| 771 | + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook |
|
| 772 | 772 | print $hookmanager->resPrint; |
| 773 | 773 | // Date creation |
| 774 | - if (! empty($arrayfields['t.datec']['checked'])) |
|
| 774 | + if (!empty($arrayfields['t.datec']['checked'])) |
|
| 775 | 775 | { |
| 776 | 776 | print '<td align="center">'; |
| 777 | 777 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); |
| 778 | 778 | print '</td>'; |
| 779 | - if (! $i) $totalarray['nbfield']++; |
|
| 779 | + if (!$i) $totalarray['nbfield']++; |
|
| 780 | 780 | } |
| 781 | 781 | // Date modification |
| 782 | - if (! empty($arrayfields['t.tms']['checked'])) |
|
| 782 | + if (!empty($arrayfields['t.tms']['checked'])) |
|
| 783 | 783 | { |
| 784 | 784 | print '<td align="center">'; |
| 785 | 785 | print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); |
| 786 | 786 | print '</td>'; |
| 787 | - if (! $i) $totalarray['nbfield']++; |
|
| 787 | + if (!$i) $totalarray['nbfield']++; |
|
| 788 | 788 | } |
| 789 | 789 | // Status |
| 790 | 790 | /*if (! empty($arrayfields['p.fk_statut']['checked'])) |
@@ -796,12 +796,12 @@ discard block |
||
| 796 | 796 | print '<td class="nowrap" align="center">'; |
| 797 | 797 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
| 798 | 798 | { |
| 799 | - $selected=0; |
|
| 800 | - if (in_array($obj->id, $arrayofselected)) $selected=1; |
|
| 801 | - print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected?' checked="checked"':'').'>'; |
|
| 799 | + $selected = 0; |
|
| 800 | + if (in_array($obj->id, $arrayofselected)) $selected = 1; |
|
| 801 | + print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
| 802 | 802 | } |
| 803 | 803 | print '</td>'; |
| 804 | - if (! $i) $totalarray['nbfield']++; |
|
| 804 | + if (!$i) $totalarray['nbfield']++; |
|
| 805 | 805 | |
| 806 | 806 | print "</tr>\n"; |
| 807 | 807 | |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield'])) |
| 816 | 816 | { |
| 817 | 817 | print '<tr class="liste_total">'; |
| 818 | - $i=0; |
|
| 818 | + $i = 0; |
|
| 819 | 819 | while ($i < $totalarray['nbfield']) |
| 820 | 820 | { |
| 821 | 821 | $i++; |
@@ -824,8 +824,8 @@ discard block |
||
| 824 | 824 | if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>'; |
| 825 | 825 | else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>'; |
| 826 | 826 | } |
| 827 | - elseif ($totalarray['totalplannedworkloadfield'] == $i) print '<td align="center">'.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).'</td>'; |
|
| 828 | - elseif ($totalarray['totaldurationeffectivefield'] == $i) print '<td align="center">'.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).'</td>'; |
|
| 827 | + elseif ($totalarray['totalplannedworkloadfield'] == $i) print '<td align="center">'.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).'</td>'; |
|
| 828 | + elseif ($totalarray['totaldurationeffectivefield'] == $i) print '<td align="center">'.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).'</td>'; |
|
| 829 | 829 | elseif ($totalarray['totalprogress_calculated'] == $i) print '<td align="center">'.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').'</td>'; |
| 830 | 830 | else print '<td></td>'; |
| 831 | 831 | } |
@@ -834,8 +834,8 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | $db->free($resql); |
| 836 | 836 | |
| 837 | -$parameters=array('sql' => $sql); |
|
| 838 | -$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook |
|
| 837 | +$parameters = array('sql' => $sql); |
|
| 838 | +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook |
|
| 839 | 839 | print $hookmanager->resPrint; |
| 840 | 840 | |
| 841 | 841 | print "</table>"; |
@@ -80,14 +80,14 @@ |
||
| 80 | 80 | */ |
| 81 | 81 | |
| 82 | 82 | if (!is_object($form)) |
| 83 | - { |
|
| 83 | + { |
|
| 84 | 84 | $form = new Form($db); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Title |
| 88 | 88 | $title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION; |
| 89 | 89 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
| 90 | - { |
|
| 90 | + { |
|
| 91 | 91 | $title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 34 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
| 34 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
| 36 | 36 | |
| 37 | 37 | // If not defined, we select menu "home" |
| 38 | 38 | $_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home'; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | // Check if company name is defined (first install) |
| 48 | 48 | if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) { |
| 49 | 49 | //header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
| 50 | - header('Location: ' . BASE_URI . '?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'); |
|
| 50 | + header('Location: '.BASE_URI.'?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'); |
|
| 51 | 51 | exit; |
| 52 | 52 | } |
| 53 | 53 | /* |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | */ |
| 63 | 63 | if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled) |
| 64 | - require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; |
|
| 64 | + require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; |
|
| 65 | 65 | $zone = GETPOST('areacode', 'aZ09'); |
| 66 | 66 | $userid = GETPOST('userid', 'int'); |
| 67 | 67 | $boxorder = GETPOST('boxorder', 'aZ09'); |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Title |
| 88 | -$title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION; |
|
| 88 | +$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION; |
|
| 89 | 89 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
| 90 | 90 | { |
| 91 | - $title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE; |
|
| 91 | + $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | llxHeader('', $title); |
| 95 | 95 | |
| 96 | -$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) |
|
| 96 | +$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) |
|
| 97 | 97 | |
| 98 | 98 | print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'title_home'); |
| 99 | 99 | |
@@ -127,16 +127,16 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | if (empty($user->societe_id)) { |
| 129 | 129 | $boxstat .= '<div class="box">'; |
| 130 | - $boxstat .= '<table summary="' . dol_escape_htmltag($langs->trans("DolibarrStateBoard")) . '" class="noborder boxtable boxtablenobottom nohover" width="100%">'; |
|
| 130 | + $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">'; |
|
| 131 | 131 | $boxstat .= '<tr class="liste_titre">'; |
| 132 | - $boxstat .= '<th class="liste_titre">' . $langs->trans("DolibarrStateBoard") . '</th>'; |
|
| 132 | + $boxstat .= '<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>'; |
|
| 133 | 133 | $boxstat .= '</tr>'; |
| 134 | 134 | $boxstat .= '<tr class="impair"><td class="tdboxstats nohover flexcontainer">'; |
| 135 | 135 | |
| 136 | 136 | $object = new stdClass(); |
| 137 | 137 | $parameters = array(); |
| 138 | 138 | $action = ''; |
| 139 | - $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 139 | + $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 140 | 140 | $boxstat .= $hookmanager->resPrint; |
| 141 | 141 | |
| 142 | 142 | if (empty($reshook)) { |
@@ -164,25 +164,25 @@ discard block |
||
| 164 | 164 | ); |
| 165 | 165 | // Class file containing the method load_state_board for each line |
| 166 | 166 | $includes = array( |
| 167 | - DOL_DOCUMENT_ROOT . "/user/class/user.class.php", |
|
| 168 | - DOL_DOCUMENT_ROOT . "/societe/class/client.class.php", |
|
| 169 | - DOL_DOCUMENT_ROOT . "/societe/class/client.class.php", |
|
| 170 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.class.php", |
|
| 171 | - DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php", |
|
| 172 | - DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php", |
|
| 173 | - DOL_DOCUMENT_ROOT . "/product/class/product.class.php", |
|
| 174 | - DOL_DOCUMENT_ROOT . "/product/class/product.class.php", |
|
| 175 | - DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php", |
|
| 176 | - DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php", |
|
| 177 | - DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php", |
|
| 178 | - DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php", |
|
| 179 | - DOL_DOCUMENT_ROOT . "/fichinter/class/fichinter.class.php", |
|
| 180 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php", |
|
| 181 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php", |
|
| 182 | - DOL_DOCUMENT_ROOT . "/supplier_proposal/class/supplier_proposal.class.php", |
|
| 183 | - DOL_DOCUMENT_ROOT . "/projet/class/project.class.php", |
|
| 184 | - DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php", |
|
| 185 | - DOL_DOCUMENT_ROOT . "/don/class/don.class.php" |
|
| 167 | + DOL_DOCUMENT_ROOT."/user/class/user.class.php", |
|
| 168 | + DOL_DOCUMENT_ROOT."/societe/class/client.class.php", |
|
| 169 | + DOL_DOCUMENT_ROOT."/societe/class/client.class.php", |
|
| 170 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", |
|
| 171 | + DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", |
|
| 172 | + DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", |
|
| 173 | + DOL_DOCUMENT_ROOT."/product/class/product.class.php", |
|
| 174 | + DOL_DOCUMENT_ROOT."/product/class/product.class.php", |
|
| 175 | + DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", |
|
| 176 | + DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", |
|
| 177 | + DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", |
|
| 178 | + DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", |
|
| 179 | + DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", |
|
| 180 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", |
|
| 181 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", |
|
| 182 | + DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", |
|
| 183 | + DOL_DOCUMENT_ROOT."/projet/class/project.class.php", |
|
| 184 | + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", |
|
| 185 | + DOL_DOCUMENT_ROOT."/don/class/don.class.php" |
|
| 186 | 186 | ); |
| 187 | 187 | // Name class containing the method load_state_board for each line |
| 188 | 188 | $classes = array('User', |
@@ -293,25 +293,25 @@ discard block |
||
| 293 | 293 | ); |
| 294 | 294 | */ |
| 295 | 295 | $links = array( |
| 296 | - BASE_URI . '/?controller=user&method=list', |
|
| 297 | - BASE_URI . '/?controller=societe&method=list&type=c&mainmenu=companies', |
|
| 298 | - BASE_URI . '/?controller=societe&method=list&type=p&mainmenu=companies', |
|
| 299 | - BASE_URI . '/?controller=societe&method=list&type=f&mainmenu=companies', |
|
| 300 | - BASE_URI . '/?controller=contact&method=list&mainmenu=companies', |
|
| 301 | - BASE_URI . '/?controller=adherents&method=list&statut=1&mainmenu=members', |
|
| 302 | - BASE_URI . '/?controller=product&method=list&type=0&mainmenu=products', |
|
| 303 | - BASE_URI . '/?controller=product&method=list&type=1&mainmenu=products', |
|
| 304 | - BASE_URI . '/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals', |
|
| 305 | - BASE_URI . '/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders', |
|
| 306 | - BASE_URI . '/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills', |
|
| 307 | - BASE_URI . '/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts', |
|
| 308 | - BASE_URI . '/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter', |
|
| 309 | - BASE_URI . '/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers', |
|
| 310 | - BASE_URI . '/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills', |
|
| 311 | - BASE_URI . '/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=', |
|
| 312 | - BASE_URI . '/?controller=projet&method=list&mainmenu=project', |
|
| 313 | - BASE_URI . '/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport', |
|
| 314 | - BASE_URI . '/?controller=don&method=list&leftmenu=donations' |
|
| 296 | + BASE_URI.'/?controller=user&method=list', |
|
| 297 | + BASE_URI.'/?controller=societe&method=list&type=c&mainmenu=companies', |
|
| 298 | + BASE_URI.'/?controller=societe&method=list&type=p&mainmenu=companies', |
|
| 299 | + BASE_URI.'/?controller=societe&method=list&type=f&mainmenu=companies', |
|
| 300 | + BASE_URI.'/?controller=contact&method=list&mainmenu=companies', |
|
| 301 | + BASE_URI.'/?controller=adherents&method=list&statut=1&mainmenu=members', |
|
| 302 | + BASE_URI.'/?controller=product&method=list&type=0&mainmenu=products', |
|
| 303 | + BASE_URI.'/?controller=product&method=list&type=1&mainmenu=products', |
|
| 304 | + BASE_URI.'/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals', |
|
| 305 | + BASE_URI.'/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders', |
|
| 306 | + BASE_URI.'/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills', |
|
| 307 | + BASE_URI.'/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts', |
|
| 308 | + BASE_URI.'/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter', |
|
| 309 | + BASE_URI.'/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers', |
|
| 310 | + BASE_URI.'/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills', |
|
| 311 | + BASE_URI.'/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=', |
|
| 312 | + BASE_URI.'/?controller=projet&method=list&mainmenu=project', |
|
| 313 | + BASE_URI.'/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport', |
|
| 314 | + BASE_URI.'/?controller=don&method=list&leftmenu=donations' |
|
| 315 | 315 | ); |
| 316 | 316 | // Translation lang files |
| 317 | 317 | $langfile = array("users", |
@@ -356,10 +356,10 @@ discard block |
||
| 356 | 356 | $langs->load($langfile[$key]); |
| 357 | 357 | $text = $langs->trans($titres[$key]); |
| 358 | 358 | //$sep=($conf->dol_use_jmobile?'<br>':' '); |
| 359 | - $boxstat .= '<a href="' . $links[$key] . '" class="boxstatsindicator thumbstat nobold nounderline">'; |
|
| 359 | + $boxstat .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">'; |
|
| 360 | 360 | $boxstat .= '<div class="boxstats">'; |
| 361 | - $boxstat .= '<span class="boxstatstext" title="' . dol_escape_htmltag($text) . '">' . $text . '</span><br>'; |
|
| 362 | - $boxstat .= '<span class="boxstatsindicator">' . img_object("", $icons[$key], 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . '</span>'; |
|
| 361 | + $boxstat .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>'; |
|
| 362 | + $boxstat .= '<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>'; |
|
| 363 | 363 | $boxstat .= '</div>'; |
| 364 | 364 | $boxstat .= '</a>'; |
| 365 | 365 | } |
@@ -393,11 +393,11 @@ discard block |
||
| 393 | 393 | $dashboardlines = array(); |
| 394 | 394 | |
| 395 | 395 | // Do not include sections without management permission |
| 396 | -require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php'; |
|
| 396 | +require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; |
|
| 397 | 397 | |
| 398 | 398 | // Number of actions to do (late) |
| 399 | 399 | if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { |
| 400 | - include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 400 | + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 401 | 401 | $board = new ActionComm($db); |
| 402 | 402 | |
| 403 | 403 | $dashboardlines[] = $board->load_board($user); |
@@ -405,21 +405,21 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | // Number of project opened |
| 407 | 407 | if (!empty($conf->projet->enabled) && $user->rights->projet->lire) { |
| 408 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 408 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 409 | 409 | $board = new Project($db); |
| 410 | 410 | $dashboardlines[] = $board->load_board($user); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | // Number of tasks to do (late) |
| 414 | 414 | if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) { |
| 415 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; |
|
| 415 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
| 416 | 416 | $board = new Task($db); |
| 417 | 417 | $dashboardlines[] = $board->load_board($user); |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Number of commercial proposals opened (expired) |
| 421 | 421 | if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { |
| 422 | - include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 422 | + include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 423 | 423 | $board = new Propal($db); |
| 424 | 424 | $dashboardlines[] = $board->load_board($user, "opened"); |
| 425 | 425 | // Number of commercial proposals CLOSED signed (billed) |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // Number of commercial proposals opened (expired) |
| 430 | 430 | if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { |
| 431 | - include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 431 | + include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 432 | 432 | $board = new SupplierProposal($db); |
| 433 | 433 | $dashboardlines[] = $board->load_board($user, "opened"); |
| 434 | 434 | // Number of commercial proposals CLOSED signed (billed) |
@@ -437,21 +437,21 @@ discard block |
||
| 437 | 437 | |
| 438 | 438 | // Number of customer orders a deal |
| 439 | 439 | if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { |
| 440 | - include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; |
|
| 440 | + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 441 | 441 | $board = new Commande($db); |
| 442 | 442 | $dashboardlines[] = $board->load_board($user); |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // Number of suppliers orders a deal |
| 446 | 446 | if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) { |
| 447 | - include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; |
|
| 447 | + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
| 448 | 448 | $board = new CommandeFournisseur($db); |
| 449 | 449 | $dashboardlines[] = $board->load_board($user); |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // Number of services enabled (delayed) |
| 453 | 453 | if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { |
| 454 | - include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 454 | + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 455 | 455 | $board = new Contrat($db); |
| 456 | 456 | $dashboardlines[] = $board->load_board($user, "inactives"); |
| 457 | 457 | // Number of active services (expired) |
@@ -459,23 +459,23 @@ discard block |
||
| 459 | 459 | } |
| 460 | 460 | // Number of invoices customers (has paid) |
| 461 | 461 | if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { |
| 462 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 462 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 463 | 463 | $board = new Facture($db); |
| 464 | 464 | $dashboardlines[] = $board->load_board($user); |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | // Number of supplier invoices (has paid) |
| 468 | 468 | if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) { |
| 469 | - include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 469 | + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 470 | 470 | $board = new FactureFournisseur($db); |
| 471 | 471 | $dashboardlines[] = $board->load_board($user); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // Number of transactions to conciliate |
| 475 | 475 | if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) { |
| 476 | - include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
| 476 | + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
| 477 | 477 | $board = new Account($db); |
| 478 | - $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate |
|
| 478 | + $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate |
|
| 479 | 479 | if ($nb > 0) { |
| 480 | 480 | $dashboardlines[] = $board->load_board($user); |
| 481 | 481 | } |
@@ -483,28 +483,28 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | // Number of cheque to send |
| 485 | 485 | if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { |
| 486 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; |
|
| 486 | + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; |
|
| 487 | 487 | $board = new RemiseCheque($db); |
| 488 | 488 | $dashboardlines[] = $board->load_board($user); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // Number of foundation members |
| 492 | 492 | if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) { |
| 493 | - include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 493 | + include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 494 | 494 | $board = new Adherent($db); |
| 495 | 495 | $dashboardlines[] = $board->load_board($user); |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | // Number of expense reports to approve |
| 499 | 499 | if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { |
| 500 | - include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; |
|
| 500 | + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
| 501 | 501 | $board = new ExpenseReport($db); |
| 502 | 502 | $dashboardlines[] = $board->load_board($user, 'toapprove'); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | // Number of expense reports to pay |
| 506 | 506 | if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { |
| 507 | - include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; |
|
| 507 | + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
| 508 | 508 | $board = new ExpenseReport($db); |
| 509 | 509 | $dashboardlines[] = $board->load_board($user, 'topay'); |
| 510 | 510 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $object = new stdClass(); |
| 513 | 513 | $parameters = array(); |
| 514 | 514 | $action = ''; |
| 515 | -$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 515 | +$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 516 | 516 | if ($reshook == 0) { |
| 517 | 517 | $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); |
| 518 | 518 | } |
@@ -542,22 +542,22 @@ discard block |
||
| 542 | 542 | //var_dump($totallate); |
| 543 | 543 | $boxwork = ''; |
| 544 | 544 | $boxwork .= '<div class="box">'; |
| 545 | -$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . "\n"; |
|
| 545 | +$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n"; |
|
| 546 | 546 | $boxwork .= '<tr class="liste_titre">'; |
| 547 | -$boxwork .= '<th class="liste_titre">' . $langs->trans("DolibarrWorkBoard") . '</th>'; |
|
| 548 | -$boxwork .= '</tr>' . "\n"; |
|
| 547 | +$boxwork .= '<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>'; |
|
| 548 | +$boxwork .= '</tr>'."\n"; |
|
| 549 | 549 | |
| 550 | 550 | if ($showweather) { |
| 551 | 551 | $boxwork .= '<tr class="nohover">'; |
| 552 | - $boxwork .= '<td class="nohover' . ($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '') . ' center valignmiddle">'; |
|
| 552 | + $boxwork .= '<td class="nohover'.($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '').' center valignmiddle">'; |
|
| 553 | 553 | $text = ''; |
| 554 | 554 | if ($totallate > 0) |
| 555 | 555 | { |
| 556 | - $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')'; |
|
| 556 | + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; |
|
| 557 | 557 | } else { |
| 558 | 558 | $text = $langs->transnoentitiesnoconv("NoItemLate"); |
| 559 | 559 | } |
| 560 | - $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
| 560 | + $text .= '. '.$langs->transnoentitiesnoconv("LateDesc"); |
|
| 561 | 561 | //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); |
| 562 | 562 | $options = 'height="64px"'; |
| 563 | 563 | $boxwork .= showWeather($totallate, $text, $options); |
@@ -577,23 +577,23 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | $textlate = $langs->trans("NActionsLate", $board->nbtodolate); |
| 580 | - $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
| 580 | + $textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; |
|
| 581 | 581 | |
| 582 | 582 | $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">'; |
| 583 | 583 | $boxwork .= '<div class="boxstatscontent">'; |
| 584 | 584 | $sep = ($conf->dol_use_jmobile ? '<br>' : ' '); |
| 585 | - $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' ' . $board->label . '</span><br>'; |
|
| 586 | - $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>'; |
|
| 585 | + $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>'; |
|
| 586 | + $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>'; |
|
| 587 | 587 | if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { |
| 588 | - $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>'; |
|
| 588 | + $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>'; |
|
| 589 | 589 | } |
| 590 | 590 | $boxwork .= '</div>'; |
| 591 | 591 | if ($board->nbtodolate > 0) { |
| 592 | 592 | $boxwork .= '<div class="dashboardlinelatecoin nowrap">'; |
| 593 | - $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late ) . '">'; |
|
| 593 | + $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">'; |
|
| 594 | 594 | //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').''; |
| 595 | - $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"') . ''; |
|
| 596 | - $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">'; |
|
| 595 | + $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').''; |
|
| 596 | + $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">'; |
|
| 597 | 597 | $boxwork .= $board->nbtodolate; |
| 598 | 598 | $boxwork .= '</span>'; |
| 599 | 599 | $boxwork .= '</a>'; |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | |
| 623 | 623 | $boxwork .= '</td></tr>'; |
| 624 | 624 | |
| 625 | -$boxwork .= '</table>'; // End table array of working board |
|
| 625 | +$boxwork .= '</table>'; // End table array of working board |
|
| 626 | 626 | $boxwork .= '</div>'; |
| 627 | 627 | |
| 628 | 628 | print '</div></div></div><div class="clearboth"></div>'; |
@@ -668,11 +668,11 @@ discard block |
||
| 668 | 668 | $message = ''; |
| 669 | 669 | |
| 670 | 670 | // Check if install lock file is present |
| 671 | - $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
| 672 | - if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) { |
|
| 671 | + $lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
| 672 | + if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) { |
|
| 673 | 673 | $langs->load("errors"); |
| 674 | 674 | //if (! empty($message)) $message.='<br>'; |
| 675 | - $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
| 675 | + $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | // Conf files must be in read only mode |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | $langs->load("errors"); |
| 681 | 681 | //$langs->load("other"); |
| 682 | 682 | //if (! empty($message)) $message.='<br>'; |
| 683 | - $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
| 683 | + $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | if ($message) { |
@@ -715,20 +715,20 @@ discard block |
||
| 715 | 715 | $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'; |
| 716 | 716 | |
| 717 | 717 | $level0 = $offset; |
| 718 | - if (!empty($conf->global->{$used_conf . '0'})) { |
|
| 719 | - $level0 = $conf->global->{$used_conf . '0'}; |
|
| 718 | + if (!empty($conf->global->{$used_conf.'0'})) { |
|
| 719 | + $level0 = $conf->global->{$used_conf.'0'}; |
|
| 720 | 720 | } |
| 721 | 721 | $level1 = $offset + 1 * $factor; |
| 722 | - if (!empty($conf->global->{$used_conf . '1'})) { |
|
| 723 | - $level1 = $conf->global->{$used_conf . '1'}; |
|
| 722 | + if (!empty($conf->global->{$used_conf.'1'})) { |
|
| 723 | + $level1 = $conf->global->{$used_conf.'1'}; |
|
| 724 | 724 | } |
| 725 | 725 | $level2 = $offset + 2 * $factor; |
| 726 | - if (!empty($conf->global->{$used_conf . '2'})) { |
|
| 727 | - $level2 = $conf->global->{$used_conf . '2'}; |
|
| 726 | + if (!empty($conf->global->{$used_conf.'2'})) { |
|
| 727 | + $level2 = $conf->global->{$used_conf.'2'}; |
|
| 728 | 728 | } |
| 729 | 729 | $level3 = $offset + 3 * $factor; |
| 730 | - if (!empty($conf->global->{$used_conf . '3'})) { |
|
| 731 | - $level3 = $conf->global->{$used_conf . '3'}; |
|
| 730 | + if (!empty($conf->global->{$used_conf.'3'})) { |
|
| 731 | + $level3 = $conf->global->{$used_conf.'3'}; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | if ($totallate <= $level0) |
@@ -352,8 +352,9 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - if (!empty($langfile[$key])) |
|
| 356 | - $langs->load($langfile[$key]); |
|
| 355 | + if (!empty($langfile[$key])) { |
|
| 356 | + $langs->load($langfile[$key]); |
|
| 357 | + } |
|
| 357 | 358 | $text = $langs->trans($titres[$key]); |
| 358 | 359 | //$sep=($conf->dol_use_jmobile?'<br>':' '); |
| 359 | 360 | $boxstat .= '<a href="' . $links[$key] . '" class="boxstatsindicator thumbstat nobold nounderline">'; |
@@ -524,21 +525,24 @@ discard block |
||
| 524 | 525 | //load_board can return an integer if failed or WorkboardResponse if OK |
| 525 | 526 | $valid_dashboardlines = array(); |
| 526 | 527 | foreach ($dashboardlines as $tmp) { |
| 527 | - if ($tmp instanceof WorkboardResponse) |
|
| 528 | - $valid_dashboardlines[] = $tmp; |
|
| 529 | -} |
|
| 528 | + if ($tmp instanceof WorkboardResponse) { |
|
| 529 | + $valid_dashboardlines[] = $tmp; |
|
| 530 | + } |
|
| 531 | + } |
|
| 530 | 532 | |
| 531 | 533 | // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop |
| 532 | 534 | foreach ($valid_dashboardlines as $board) { |
| 533 | 535 | if ($board->nbtodolate > 0) { |
| 534 | - if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) |
|
| 535 | - $totaltodo += $board->nbtodo; |
|
| 536 | + if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { |
|
| 537 | + $totaltodo += $board->nbtodo; |
|
| 538 | + } |
|
| 536 | 539 | $totallate += $board->nbtodolate; |
| 537 | 540 | } |
| 538 | 541 | } |
| 539 | 542 | //var_dump($totallate, $totaltodo); |
| 540 | -if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) |
|
| 543 | +if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) { |
|
| 541 | 544 | $totallate = round($totallate / $totaltodo * 100, 2); |
| 545 | +} |
|
| 542 | 546 | //var_dump($totallate); |
| 543 | 547 | $boxwork = ''; |
| 544 | 548 | $boxwork .= '<div class="box">'; |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * \ingroup agenda |
| 29 | 29 | * \brief File of class to manage agenda events (actions) |
| 30 | 30 | */ |
| 31 | -require_once DOL_DOCUMENT_ROOT . '/comm/action/class/cactioncomm.class.php'; |
|
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 31 | +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Class to manage agenda events (actions) |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | * @var int |
| 77 | 77 | */ |
| 78 | 78 | public $ref; |
| 79 | - public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) |
|
| 80 | - public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. |
|
| 79 | + public $type_id; // Id into parent table llx_c_actioncomm (used only if option to use type is set) |
|
| 80 | + public $type_code; // Code into parent table llx_c_actioncomm (used only if option to use type is set). With default setup, should be AC_OTH_AUTO or AC_OTH. |
|
| 81 | 81 | public $type_label; |
| 82 | - public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) |
|
| 82 | + public $type; // Label into parent table llx_c_actioncomm (used only if option to use type is set) |
|
| 83 | 83 | public $type_color; // Color into parent table llx_c_actioncomm (used only if option to use type is set) |
| 84 | - public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) |
|
| 84 | + public $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @var string Agenda event label |
| 88 | 88 | */ |
| 89 | 89 | public $label; |
| 90 | - public $datec; // Date creation record (datec) |
|
| 91 | - public $datem; // Date modification record (tms) |
|
| 90 | + public $datec; // Date creation record (datec) |
|
| 91 | + public $datem; // Date modification record (tms) |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * Object user that create action |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * @var int |
| 118 | 118 | */ |
| 119 | 119 | public $usermodid; |
| 120 | - public $datep; // Date action start (datep) |
|
| 121 | - public $datef; // Date action end (datep2) |
|
| 120 | + public $datep; // Date action start (datep) |
|
| 121 | + public $datef; // Date action end (datep2) |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @var int -1=Unkown duration |
| 125 | 125 | * @deprecated |
| 126 | 126 | */ |
| 127 | 127 | public $durationp = -1; |
| 128 | - public $fulldayevent = 0; // 1=Event on full day |
|
| 128 | + public $fulldayevent = 0; // 1=Event on full day |
|
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * Milestone |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | * @deprecated Milestone is already event with end date = start date |
| 134 | 134 | */ |
| 135 | 135 | public $punctual = 1; |
| 136 | - public $percentage; // Percentage |
|
| 137 | - public $location; // Location |
|
| 136 | + public $percentage; // Percentage |
|
| 137 | + public $location; // Location |
|
| 138 | 138 | public $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) |
| 139 | - public $priority; // Small int (0 By default) |
|
| 139 | + public $priority; // Small int (0 By default) |
|
| 140 | 140 | public $userassigned = array(); // Array of user ids |
| 141 | 141 | public $userownerid; // Id of user owner = fk_user_action into table |
| 142 | 142 | public $userdoneid; // Id of user done (deprecated) |
@@ -177,9 +177,9 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public $contact; |
| 179 | 179 | // Properties for links to other objects |
| 180 | - public $fk_element; // Id of record |
|
| 181 | - public $elementid; // Id of record alternative for API |
|
| 182 | - public $elementtype; // Type of record. This if property ->element of object linked to. |
|
| 180 | + public $fk_element; // Id of record |
|
| 181 | + public $elementid; // Id of record alternative for API |
|
| 182 | + public $elementtype; // Type of record. This if property ->element of object linked to. |
|
| 183 | 183 | // Ical |
| 184 | 184 | public $icalname; |
| 185 | 185 | public $icalcolor; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $this->percentage = 100; |
| 248 | 248 | //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; |
| 249 | 249 | if (!empty($this->datep) && !empty($this->datef)) |
| 250 | - $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 250 | + $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | 253 | //if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && !($this->contactid > 0)) |
| 273 | - $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated |
|
| 273 | + $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated |
|
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | $userownerid = $this->userownerid; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $this->type_id = $cactioncomm->id; |
| 292 | 292 | $this->type_code = $cactioncomm->code; |
| 293 | 293 | } else if ($result == 0) { |
| 294 | - $this->error = 'Failed to get record with id ' . $this->type_id . ' code ' . $this->type_code . ' from dictionary "type of events"'; |
|
| 294 | + $this->error = 'Failed to get record with id '.$this->type_id.' code '.$this->type_code.' from dictionary "type of events"'; |
|
| 295 | 295 | return -1; |
| 296 | 296 | } else { |
| 297 | 297 | $this->error = $cactioncomm->error; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $this->db->begin(); |
| 310 | 310 | |
| 311 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm"; |
|
| 311 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; |
|
| 312 | 312 | $sql .= "(datec,"; |
| 313 | 313 | $sql .= "datep,"; |
| 314 | 314 | $sql .= "datep2,"; |
@@ -338,40 +338,40 @@ discard block |
||
| 338 | 338 | $sql .= "email_subject,"; |
| 339 | 339 | $sql .= "errors_to"; |
| 340 | 340 | $sql .= ") VALUES ("; |
| 341 | - $sql .= "'" . $this->db->idate($now) . "', "; |
|
| 342 | - $sql .= (strval($this->datep) != '' ? "'" . $this->db->idate($this->datep) . "'" : "null") . ", "; |
|
| 343 | - $sql .= (strval($this->datef) != '' ? "'" . $this->db->idate($this->datef) . "'" : "null") . ", "; |
|
| 344 | - $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'" . $this->db->escape($this->durationp) . "'" : "null") . ", "; // deprecated |
|
| 345 | - $sql .= (isset($this->type_id) ? $this->type_id : "null") . ","; |
|
| 346 | - $sql .= ($code ? ("'" . $code . "'") : "null") . ", "; |
|
| 347 | - $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null") . ", "; |
|
| 348 | - $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null") . ", "; |
|
| 349 | - $sql .= " '" . $this->db->escape($this->note_private ? $this->note_private : $this->note) . "', "; |
|
| 350 | - $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null") . ", "; |
|
| 351 | - $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null") . ", "; |
|
| 352 | - $sql .= ($userownerid > 0 ? $userownerid : "null") . ", "; |
|
| 353 | - $sql .= ($userdoneid > 0 ? $userdoneid : "null") . ", "; |
|
| 354 | - $sql .= "'" . $this->db->escape($this->label) . "','" . $this->db->escape($this->percentage) . "','" . $this->db->escape($this->priority) . "','" . $this->db->escape($this->fulldayevent) . "','" . $this->db->escape($this->location) . "','" . $this->db->escape($this->punctual) . "', "; |
|
| 355 | - $sql .= "'" . $this->db->escape($this->transparency) . "', "; |
|
| 356 | - $sql .= (!empty($this->fk_element) ? $this->fk_element : "null") . ", "; |
|
| 357 | - $sql .= (!empty($this->elementtype) ? "'" . $this->db->escape($this->elementtype) . "'" : "null") . ", "; |
|
| 358 | - $sql .= $conf->entity . ","; |
|
| 359 | - $sql .= (!empty($this->extraparams) ? "'" . $this->db->escape($this->extraparams) . "'" : "null") . ", "; |
|
| 341 | + $sql .= "'".$this->db->idate($now)."', "; |
|
| 342 | + $sql .= (strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : "null").", "; |
|
| 343 | + $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", "; |
|
| 344 | + $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated |
|
| 345 | + $sql .= (isset($this->type_id) ? $this->type_id : "null").","; |
|
| 346 | + $sql .= ($code ? ("'".$code."'") : "null").", "; |
|
| 347 | + $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; |
|
| 348 | + $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; |
|
| 349 | + $sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', "; |
|
| 350 | + $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", "; |
|
| 351 | + $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; |
|
| 352 | + $sql .= ($userownerid > 0 ? $userownerid : "null").", "; |
|
| 353 | + $sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; |
|
| 354 | + $sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."','".$this->db->escape($this->punctual)."', "; |
|
| 355 | + $sql .= "'".$this->db->escape($this->transparency)."', "; |
|
| 356 | + $sql .= (!empty($this->fk_element) ? $this->fk_element : "null").", "; |
|
| 357 | + $sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", "; |
|
| 358 | + $sql .= $conf->entity.","; |
|
| 359 | + $sql .= (!empty($this->extraparams) ? "'".$this->db->escape($this->extraparams)."'" : "null").", "; |
|
| 360 | 360 | // Fields emails |
| 361 | - $sql .= (!empty($this->email_msgid) ? "'" . $this->db->escape($this->email_msgid) . "'" : "null") . ", "; |
|
| 362 | - $sql .= (!empty($this->email_from) ? "'" . $this->db->escape($this->email_from) . "'" : "null") . ", "; |
|
| 363 | - $sql .= (!empty($this->email_sender) ? "'" . $this->db->escape($this->email_sender) . "'" : "null") . ", "; |
|
| 364 | - $sql .= (!empty($this->email_to) ? "'" . $this->db->escape($this->email_to) . "'" : "null") . ", "; |
|
| 365 | - $sql .= (!empty($this->email_tocc) ? "'" . $this->db->escape($this->email_tocc) . "'" : "null") . ", "; |
|
| 366 | - $sql .= (!empty($this->email_tobcc) ? "'" . $this->db->escape($this->email_tobcc) . "'" : "null") . ", "; |
|
| 367 | - $sql .= (!empty($this->email_subject) ? "'" . $this->db->escape($this->email_subject) . "'" : "null") . ", "; |
|
| 368 | - $sql .= (!empty($this->errors_to) ? "'" . $this->db->escape($this->errors_to) . "'" : "null"); |
|
| 361 | + $sql .= (!empty($this->email_msgid) ? "'".$this->db->escape($this->email_msgid)."'" : "null").", "; |
|
| 362 | + $sql .= (!empty($this->email_from) ? "'".$this->db->escape($this->email_from)."'" : "null").", "; |
|
| 363 | + $sql .= (!empty($this->email_sender) ? "'".$this->db->escape($this->email_sender)."'" : "null").", "; |
|
| 364 | + $sql .= (!empty($this->email_to) ? "'".$this->db->escape($this->email_to)."'" : "null").", "; |
|
| 365 | + $sql .= (!empty($this->email_tocc) ? "'".$this->db->escape($this->email_tocc)."'" : "null").", "; |
|
| 366 | + $sql .= (!empty($this->email_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", "; |
|
| 367 | + $sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "null").", "; |
|
| 368 | + $sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null"); |
|
| 369 | 369 | $sql .= ")"; |
| 370 | 370 | |
| 371 | - dol_syslog(get_class($this) . "::add", LOG_DEBUG); |
|
| 371 | + dol_syslog(get_class($this)."::add", LOG_DEBUG); |
|
| 372 | 372 | $resql = $this->db->query($sql); |
| 373 | 373 | if ($resql) { |
| 374 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "actioncomm", "id"); |
|
| 374 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); |
|
| 375 | 375 | |
| 376 | 376 | // Now insert assignedusers |
| 377 | 377 | if (!$error) { |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | $val = array('id' => $val); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 384 | - $sql .= " VALUES(" . $this->id . ", 'user', " . $val['id'] . ", " . (empty($val['mandatory']) ? '0' : $val['mandatory']) . ", " . (empty($val['transparency']) ? '0' : $val['transparency']) . ", " . (empty($val['answer_status']) ? '0' : $val['answer_status']) . ")"; |
|
| 383 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 384 | + $sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")"; |
|
| 385 | 385 | |
| 386 | 386 | $resql = $this->db->query($sql); |
| 387 | 387 | if (!$resql) { |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | if (!$error) { |
| 396 | 396 | if (!empty($this->socpeopleassigned)) { |
| 397 | 397 | foreach ($this->socpeopleassigned as $id => $Tab) { |
| 398 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 399 | - $sql .= " VALUES(" . $this->id . ", 'socpeople', " . $id . ", 0, 0, 0)"; |
|
| 398 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 399 | + $sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)"; |
|
| 400 | 400 | |
| 401 | 401 | $resql = $this->db->query($sql); |
| 402 | 402 | if (!$resql) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | if (is_object($hookmanager)) { |
| 507 | 507 | $parameters = array('objFrom' => $objFrom); |
| 508 | 508 | $action = ''; |
| 509 | - $reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 509 | + $reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 510 | 510 | if ($reshook < 0) |
| 511 | 511 | $error++; |
| 512 | 512 | } |
@@ -562,19 +562,19 @@ discard block |
||
| 562 | 562 | $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; |
| 563 | 563 | $sql .= " s.nom as socname,"; |
| 564 | 564 | $sql .= " u.firstname, u.lastname as lastname"; |
| 565 | - $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a "; |
|
| 566 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_actioncomm as c ON a.fk_action=c.id "; |
|
| 567 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_author"; |
|
| 568 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on s.rowid = a.fk_soc"; |
|
| 565 | + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; |
|
| 566 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; |
|
| 567 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; |
|
| 568 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; |
|
| 569 | 569 | $sql .= " WHERE "; |
| 570 | 570 | if ($ref) |
| 571 | - $sql .= " a.id=" . $ref; // No field ref, we use id |
|
| 571 | + $sql .= " a.id=".$ref; // No field ref, we use id |
|
| 572 | 572 | elseif ($ref_ext) |
| 573 | - $sql .= " a.ref_ext='" . $this->db->escape($ref_ext) . "'"; |
|
| 573 | + $sql .= " a.ref_ext='".$this->db->escape($ref_ext)."'"; |
|
| 574 | 574 | else |
| 575 | - $sql .= " a.id=" . $id; |
|
| 575 | + $sql .= " a.id=".$id; |
|
| 576 | 576 | |
| 577 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 577 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 578 | 578 | $resql = $this->db->query($sql); |
| 579 | 579 | if ($resql) { |
| 580 | 580 | $num = $this->db->num_rows($resql); |
@@ -590,10 +590,10 @@ discard block |
||
| 590 | 590 | $this->type_code = $obj->type_code; |
| 591 | 591 | $this->type_color = $obj->type_color; |
| 592 | 592 | $this->type_picto = $obj->type_picto; |
| 593 | - $transcode = $langs->trans("Action" . $obj->type_code); |
|
| 594 | - $this->type = (($transcode != "Action" . $obj->type_code) ? $transcode : $obj->type_label); |
|
| 595 | - $transcode = $langs->trans("Action" . $obj->type_code . 'Short'); |
|
| 596 | - $this->type_short = (($transcode != "Action" . $obj->type_code . 'Short') ? $transcode : ''); |
|
| 593 | + $transcode = $langs->trans("Action".$obj->type_code); |
|
| 594 | + $this->type = (($transcode != "Action".$obj->type_code) ? $transcode : $obj->type_label); |
|
| 595 | + $transcode = $langs->trans("Action".$obj->type_code.'Short'); |
|
| 596 | + $this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : ''); |
|
| 597 | 597 | |
| 598 | 598 | $this->code = $obj->code; |
| 599 | 599 | $this->label = $obj->label; |
@@ -612,12 +612,12 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | if (!is_object($this->author)) |
| 614 | 614 | $this->author = new stdClass(); // To avoid warning |
| 615 | - $this->author->id = $obj->fk_user_author; // deprecated |
|
| 616 | - $this->author->firstname = $obj->firstname; // deprecated |
|
| 617 | - $this->author->lastname = $obj->lastname; // deprecated |
|
| 615 | + $this->author->id = $obj->fk_user_author; // deprecated |
|
| 616 | + $this->author->firstname = $obj->firstname; // deprecated |
|
| 617 | + $this->author->lastname = $obj->lastname; // deprecated |
|
| 618 | 618 | if (!is_object($this->usermod)) |
| 619 | 619 | $this->usermod = new stdClass(); // To avoid warning |
| 620 | - $this->usermod->id = $obj->fk_user_mod; // deprecated |
|
| 620 | + $this->usermod->id = $obj->fk_user_mod; // deprecated |
|
| 621 | 621 | |
| 622 | 622 | $this->userownerid = $obj->fk_user_action; |
| 623 | 623 | $this->userdoneid = $obj->fk_user_done; |
@@ -625,14 +625,14 @@ discard block |
||
| 625 | 625 | $this->fulldayevent = $obj->fulldayevent; |
| 626 | 626 | $this->location = $obj->location; |
| 627 | 627 | $this->transparency = $obj->transparency; |
| 628 | - $this->punctual = $obj->punctual; // deprecated |
|
| 628 | + $this->punctual = $obj->punctual; // deprecated |
|
| 629 | 629 | |
| 630 | - $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working |
|
| 631 | - $this->contactid = $obj->fk_contact; // To have fetch_contact method working |
|
| 632 | - $this->fk_project = $obj->fk_project; // To have fetch_project method working |
|
| 630 | + $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working |
|
| 631 | + $this->contactid = $obj->fk_contact; // To have fetch_contact method working |
|
| 632 | + $this->fk_project = $obj->fk_project; // To have fetch_project method working |
|
| 633 | 633 | |
| 634 | - $this->societe->id = $obj->fk_soc; // deprecated |
|
| 635 | - $this->contact->id = $obj->fk_contact; // deprecated |
|
| 634 | + $this->societe->id = $obj->fk_soc; // deprecated |
|
| 635 | + $this->contact->id = $obj->fk_contact; // deprecated |
|
| 636 | 636 | |
| 637 | 637 | $this->fk_element = $obj->elementid; |
| 638 | 638 | $this->elementid = $obj->elementid; |
@@ -658,8 +658,8 @@ discard block |
||
| 658 | 658 | function fetchResources() |
| 659 | 659 | { |
| 660 | 660 | $sql = 'SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency'; |
| 661 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm_resources'; |
|
| 662 | - $sql .= ' WHERE fk_actioncomm = ' . $this->id; |
|
| 661 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm_resources'; |
|
| 662 | + $sql .= ' WHERE fk_actioncomm = '.$this->id; |
|
| 663 | 663 | $sql .= " AND element_type IN ('user', 'socpeople')"; |
| 664 | 664 | $resql = $this->db->query($sql); |
| 665 | 665 | if ($resql) { |
@@ -703,8 +703,8 @@ discard block |
||
| 703 | 703 | { |
| 704 | 704 | // phpcs:enable |
| 705 | 705 | $sql = "SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; |
| 706 | - $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm_resources"; |
|
| 707 | - $sql .= " WHERE element_type = 'user' AND fk_actioncomm = " . $this->id; |
|
| 706 | + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm_resources"; |
|
| 707 | + $sql .= " WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; |
|
| 708 | 708 | $resql2 = $this->db->query($sql); |
| 709 | 709 | if ($resql2) { |
| 710 | 710 | $this->userassigned = array(); |
@@ -742,10 +742,10 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | $this->db->begin(); |
| 744 | 744 | |
| 745 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "actioncomm"; |
|
| 746 | - $sql .= " WHERE id=" . $this->id; |
|
| 745 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; |
|
| 746 | + $sql .= " WHERE id=".$this->id; |
|
| 747 | 747 | |
| 748 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 748 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 749 | 749 | $res = $this->db->query($sql); |
| 750 | 750 | if ($res < 0) { |
| 751 | 751 | $this->error = $this->db->lasterror(); |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | if (!$error) { |
| 756 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "actioncomm_resources"; |
|
| 757 | - $sql .= " WHERE fk_actioncomm=" . $this->id; |
|
| 756 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; |
|
| 757 | + $sql .= " WHERE fk_actioncomm=".$this->id; |
|
| 758 | 758 | |
| 759 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 759 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 760 | 760 | $res = $this->db->query($sql); |
| 761 | 761 | if ($res < 0) { |
| 762 | 762 | $this->error = $this->db->lasterror(); |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | $result = $this->deleteExtraFields(); |
| 770 | 770 | if ($result < 0) { |
| 771 | 771 | $error++; |
| 772 | - dol_syslog(get_class($this) . "::delete error -3 " . $this->error, LOG_ERR); |
|
| 772 | + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); |
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | $this->percentage = 100; |
| 827 | 827 | //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; |
| 828 | 828 | if ($this->datep && $this->datef) |
| 829 | - $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 829 | + $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 830 | 830 | |
| 831 | 831 | |
| 832 | 832 | //if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); |
@@ -849,32 +849,32 @@ discard block |
||
| 849 | 849 | |
| 850 | 850 | $this->db->begin(); |
| 851 | 851 | |
| 852 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "actioncomm "; |
|
| 853 | - $sql .= " SET percent = '" . $this->db->escape($this->percentage) . "'"; |
|
| 852 | + $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; |
|
| 853 | + $sql .= " SET percent = '".$this->db->escape($this->percentage)."'"; |
|
| 854 | 854 | if ($this->type_id > 0) |
| 855 | - $sql .= ", fk_action = '" . $this->db->escape($this->type_id) . "'"; |
|
| 856 | - $sql .= ", label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null"); |
|
| 857 | - $sql .= ", datep = " . (strval($this->datep) != '' ? "'" . $this->db->idate($this->datep) . "'" : 'null'); |
|
| 858 | - $sql .= ", datep2 = " . (strval($this->datef) != '' ? "'" . $this->db->idate($this->datef) . "'" : 'null'); |
|
| 859 | - $sql .= ", durationp = " . (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'" . $this->db->escape($this->durationp) . "'" : "null"); // deprecated |
|
| 860 | - $sql .= ", note = '" . $this->db->escape($this->note_private ? $this->note_private : $this->note) . "'"; |
|
| 861 | - $sql .= ", fk_project =" . ($this->fk_project > 0 ? $this->fk_project : "null"); |
|
| 862 | - $sql .= ", fk_soc =" . ($socid > 0 ? $socid : "null"); |
|
| 863 | - $sql .= ", fk_contact =" . ($contactid > 0 ? $contactid : "null"); |
|
| 864 | - $sql .= ", priority = '" . $this->db->escape($this->priority) . "'"; |
|
| 865 | - $sql .= ", fulldayevent = '" . $this->db->escape($this->fulldayevent) . "'"; |
|
| 866 | - $sql .= ", location = " . ($this->location ? "'" . $this->db->escape($this->location) . "'" : "null"); |
|
| 867 | - $sql .= ", transparency = '" . $this->db->escape($this->transparency) . "'"; |
|
| 868 | - $sql .= ", fk_user_mod = " . $user->id; |
|
| 869 | - $sql .= ", fk_user_action=" . ($userownerid > 0 ? "'" . $userownerid . "'" : "null"); |
|
| 870 | - $sql .= ", fk_user_done=" . ($userdoneid > 0 ? "'" . $userdoneid . "'" : "null"); |
|
| 855 | + $sql .= ", fk_action = '".$this->db->escape($this->type_id)."'"; |
|
| 856 | + $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); |
|
| 857 | + $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); |
|
| 858 | + $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); |
|
| 859 | + $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated |
|
| 860 | + $sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'"; |
|
| 861 | + $sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null"); |
|
| 862 | + $sql .= ", fk_soc =".($socid > 0 ? $socid : "null"); |
|
| 863 | + $sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null"); |
|
| 864 | + $sql .= ", priority = '".$this->db->escape($this->priority)."'"; |
|
| 865 | + $sql .= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'"; |
|
| 866 | + $sql .= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'" : "null"); |
|
| 867 | + $sql .= ", transparency = '".$this->db->escape($this->transparency)."'"; |
|
| 868 | + $sql .= ", fk_user_mod = ".$user->id; |
|
| 869 | + $sql .= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'" : "null"); |
|
| 870 | + $sql .= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'" : "null"); |
|
| 871 | 871 | if (!empty($this->fk_element)) |
| 872 | - $sql .= ", fk_element=" . ($this->fk_element ? $this->db->escape($this->fk_element) : "null"); |
|
| 872 | + $sql .= ", fk_element=".($this->fk_element ? $this->db->escape($this->fk_element) : "null"); |
|
| 873 | 873 | if (!empty($this->elementtype)) |
| 874 | - $sql .= ", elementtype=" . ($this->elementtype ? "'" . $this->db->escape($this->elementtype) . "'" : "null"); |
|
| 875 | - $sql .= " WHERE id=" . $this->id; |
|
| 874 | + $sql .= ", elementtype=".($this->elementtype ? "'".$this->db->escape($this->elementtype)."'" : "null"); |
|
| 875 | + $sql .= " WHERE id=".$this->id; |
|
| 876 | 876 | |
| 877 | - dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 877 | + dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 878 | 878 | if ($this->db->query($sql)) { |
| 879 | 879 | $action = 'update'; |
| 880 | 880 | |
@@ -888,15 +888,15 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | // Now insert assignedusers |
| 890 | 890 | if (!$error) { |
| 891 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "actioncomm_resources where fk_actioncomm = " . $this->id . " AND element_type = 'user'"; |
|
| 891 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources where fk_actioncomm = ".$this->id." AND element_type = 'user'"; |
|
| 892 | 892 | $resql = $this->db->query($sql); |
| 893 | 893 | |
| 894 | 894 | foreach ($this->userassigned as $key => $val) { |
| 895 | 895 | if (!is_array($val)) { // For backward compatibility when val=id |
| 896 | 896 | $val = array('id' => $val); |
| 897 | 897 | } |
| 898 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 899 | - $sql .= " VALUES(" . $this->id . ", 'user', " . $val['id'] . ", " . (empty($val['mandatory']) ? '0' : $val['mandatory']) . ", " . (empty($val['transparency']) ? '0' : $val['transparency']) . ", " . (empty($val['answer_status']) ? '0' : $val['answer_status']) . ")"; |
|
| 898 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 899 | + $sql .= " VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory']) ? '0' : $val['mandatory']).", ".(empty($val['transparency']) ? '0' : $val['transparency']).", ".(empty($val['answer_status']) ? '0' : $val['answer_status']).")"; |
|
| 900 | 900 | |
| 901 | 901 | $resql = $this->db->query($sql); |
| 902 | 902 | if (!$resql) { |
@@ -908,13 +908,13 @@ discard block |
||
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | if (!$error) { |
| 911 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "actioncomm_resources where fk_actioncomm = " . $this->id . " AND element_type = 'socpeople'"; |
|
| 911 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources where fk_actioncomm = ".$this->id." AND element_type = 'socpeople'"; |
|
| 912 | 912 | $resql = $this->db->query($sql); |
| 913 | 913 | |
| 914 | 914 | if (!empty($this->socpeopleassigned)) { |
| 915 | 915 | foreach (array_keys($this->socpeopleassigned) as $id) { |
| 916 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 917 | - $sql .= " VALUES(" . $this->id . ", 'socpeople', " . $id . ", 0, 0, 0)"; |
|
| 916 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; |
|
| 917 | + $sql .= " VALUES(".$this->id.", 'socpeople', ".$id.", 0, 0, 0)"; |
|
| 918 | 918 | |
| 919 | 919 | $resql = $this->db->query($sql); |
| 920 | 920 | if (!$resql) { |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | return 1; |
| 940 | 940 | } else { |
| 941 | 941 | $this->db->rollback(); |
| 942 | - dol_syslog(get_class($this) . "::update " . join(',', $this->errors), LOG_ERR); |
|
| 942 | + dol_syslog(get_class($this)."::update ".join(',', $this->errors), LOG_ERR); |
|
| 943 | 943 | return -2; |
| 944 | 944 | } |
| 945 | 945 | } else { |
@@ -970,15 +970,15 @@ discard block |
||
| 970 | 970 | $resarray = array(); |
| 971 | 971 | |
| 972 | 972 | $sql = "SELECT a.id"; |
| 973 | - $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; |
|
| 974 | - $sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")"; |
|
| 973 | + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; |
|
| 974 | + $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; |
|
| 975 | 975 | if (!empty($socid)) |
| 976 | - $sql .= " AND a.fk_soc = " . $socid; |
|
| 976 | + $sql .= " AND a.fk_soc = ".$socid; |
|
| 977 | 977 | if (!empty($elementtype)) { |
| 978 | 978 | if ($elementtype == 'project') |
| 979 | - $sql .= ' AND a.fk_project = ' . $fk_element; |
|
| 979 | + $sql .= ' AND a.fk_project = '.$fk_element; |
|
| 980 | 980 | else |
| 981 | - $sql .= " AND a.fk_element = " . (int) $fk_element . " AND a.elementtype = '" . $elementtype . "'"; |
|
| 981 | + $sql .= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$elementtype."'"; |
|
| 982 | 982 | } |
| 983 | 983 | if (!empty($filter)) |
| 984 | 984 | $sql .= $filter; |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | $sql .= $db->order($sortfield, $sortorder); |
| 987 | 987 | $sql .= $db->plimit($limit, 0); |
| 988 | 988 | |
| 989 | - dol_syslog(get_class() . "::getActions", LOG_DEBUG); |
|
| 989 | + dol_syslog(get_class()."::getActions", LOG_DEBUG); |
|
| 990 | 990 | $resql = $db->query($sql); |
| 991 | 991 | if ($resql) { |
| 992 | 992 | $num = $db->num_rows($resql); |
@@ -1025,21 +1025,21 @@ discard block |
||
| 1025 | 1025 | $this->nb = array(); |
| 1026 | 1026 | $sql = "SELECT count(a.id) as nb"; |
| 1027 | 1027 | } |
| 1028 | - $sql .= " FROM (" . MAIN_DB_PREFIX . "actioncomm as a"; |
|
| 1028 | + $sql .= " FROM (".MAIN_DB_PREFIX."actioncomm as a"; |
|
| 1029 | 1029 | $sql .= ")"; |
| 1030 | 1030 | if (!$user->rights->societe->client->voir && !$user->societe_id) |
| 1031 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 1032 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; |
|
| 1031 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 1032 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; |
|
| 1033 | 1033 | $sql .= " WHERE 1 = 1"; |
| 1034 | 1034 | if (empty($load_state_board)) |
| 1035 | 1035 | $sql .= " AND a.percent >= 0 AND a.percent < 100"; |
| 1036 | - $sql .= " AND a.entity IN (" . getEntity('agenda') . ")"; |
|
| 1036 | + $sql .= " AND a.entity IN (".getEntity('agenda').")"; |
|
| 1037 | 1037 | if (!$user->rights->societe->client->voir && !$user->societe_id) |
| 1038 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 1038 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; |
|
| 1039 | 1039 | if ($user->societe_id) |
| 1040 | - $sql .= " AND a.fk_soc = " . $user->societe_id; |
|
| 1040 | + $sql .= " AND a.fk_soc = ".$user->societe_id; |
|
| 1041 | 1041 | if (!$user->rights->agenda->allactions->read) |
| 1042 | - $sql .= " AND (a.fk_user_author = " . $user->id . " OR a.fk_user_action = " . $user->id . " OR a.fk_user_done = " . $user->id . ")"; |
|
| 1042 | + $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")"; |
|
| 1043 | 1043 | |
| 1044 | 1044 | $resql = $this->db->query($sql); |
| 1045 | 1045 | if ($resql) { |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | $response->warning_delay = $conf->agenda->warning_delay / 60 / 60 / 24; |
| 1050 | 1050 | $response->label = $langs->trans("ActionsToDo"); |
| 1051 | 1051 | // $response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda'; |
| 1052 | - $response->url = BASE_URI . '?controller=comm/action&method=list&actioncode=0&status=todo&mainmenu=agenda'; |
|
| 1052 | + $response->url = BASE_URI.'?controller=comm/action&method=list&actioncode=0&status=todo&mainmenu=agenda'; |
|
| 1053 | 1053 | if ($user->rights->agenda->allactions->read) { |
| 1054 | 1054 | $response->url .= '&filtert=-1'; |
| 1055 | 1055 | } |
@@ -1093,10 +1093,10 @@ discard block |
||
| 1093 | 1093 | $sql .= ' tms as datem,'; |
| 1094 | 1094 | $sql .= ' fk_user_author,'; |
| 1095 | 1095 | $sql .= ' fk_user_mod'; |
| 1096 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm as a'; |
|
| 1097 | - $sql .= ' WHERE a.id = ' . $id; |
|
| 1096 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; |
|
| 1097 | + $sql .= ' WHERE a.id = '.$id; |
|
| 1098 | 1098 | |
| 1099 | - dol_syslog(get_class($this) . "::info", LOG_DEBUG); |
|
| 1099 | + dol_syslog(get_class($this)."::info", LOG_DEBUG); |
|
| 1100 | 1100 | $result = $this->db->query($sql); |
| 1101 | 1101 | if ($result) { |
| 1102 | 1102 | if ($this->db->num_rows($result)) { |
@@ -1155,11 +1155,11 @@ discard block |
||
| 1155 | 1155 | if ($percent == -1 && !$hidenastatus) |
| 1156 | 1156 | return $langs->trans('StatusNotApplicable'); |
| 1157 | 1157 | elseif ($percent == 0) |
| 1158 | - return $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1158 | + return $langs->trans('StatusActionToDo').' (0%)'; |
|
| 1159 | 1159 | elseif ($percent > 0 && $percent < 100) |
| 1160 | - return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1160 | + return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; |
|
| 1161 | 1161 | elseif ($percent >= 100) |
| 1162 | - return $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1162 | + return $langs->trans('StatusActionDone').' (100%)'; |
|
| 1163 | 1163 | } |
| 1164 | 1164 | elseif ($mode == 1) { |
| 1165 | 1165 | if ($percent == -1 && !$hidenastatus) |
@@ -1167,67 +1167,67 @@ discard block |
||
| 1167 | 1167 | elseif ($percent == 0) |
| 1168 | 1168 | return $langs->trans('StatusActionToDo'); |
| 1169 | 1169 | elseif ($percent > 0 && $percent < 100) |
| 1170 | - return $percent . '%'; |
|
| 1170 | + return $percent.'%'; |
|
| 1171 | 1171 | elseif ($percent >= 100) |
| 1172 | 1172 | return $langs->trans('StatusActionDone'); |
| 1173 | 1173 | } |
| 1174 | 1174 | elseif ($mode == 2) { |
| 1175 | 1175 | if ($percent == -1 && !$hidenastatus) |
| 1176 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1176 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9').' '.$langs->trans('StatusNotApplicable'); |
|
| 1177 | 1177 | elseif ($percent == 0) |
| 1178 | - return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo'); |
|
| 1178 | + return img_picto($langs->trans('StatusActionToDo'), 'statut1').' '.$langs->trans('StatusActionToDo'); |
|
| 1179 | 1179 | elseif ($percent > 0 && $percent < 100) |
| 1180 | - return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $percent . '%'; |
|
| 1180 | + return img_picto($langs->trans('StatusActionInProcess'), 'statut3').' '.$percent.'%'; |
|
| 1181 | 1181 | elseif ($percent >= 100) |
| 1182 | - return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone'); |
|
| 1182 | + return img_picto($langs->trans('StatusActionDone'), 'statut6').' '.$langs->trans('StatusActionDone'); |
|
| 1183 | 1183 | } |
| 1184 | 1184 | elseif ($mode == 3) { |
| 1185 | 1185 | if ($percent == -1 && !$hidenastatus) |
| 1186 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1186 | + return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1187 | 1187 | elseif ($percent == 0) |
| 1188 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionToDo') . ' (0%)', 'statut1'); |
|
| 1188 | + return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)', 'statut1'); |
|
| 1189 | 1189 | elseif ($percent > 0 && $percent < 100) |
| 1190 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)', 'statut3'); |
|
| 1190 | + return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)', 'statut3'); |
|
| 1191 | 1191 | elseif ($percent >= 100) |
| 1192 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionDone') . ' (100%)', 'statut6'); |
|
| 1192 | + return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)', 'statut6'); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | elseif ($mode == 4) { |
| 1195 | 1195 | if ($percent == -1 && !$hidenastatus) |
| 1196 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1196 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9').' '.$langs->trans('StatusNotApplicable'); |
|
| 1197 | 1197 | elseif ($percent == 0) |
| 1198 | - return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1198 | + return img_picto($langs->trans('StatusActionToDo'), 'statut1').' '.$langs->trans('StatusActionToDo').' (0%)'; |
|
| 1199 | 1199 | elseif ($percent > 0 && $percent < 100) |
| 1200 | - return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1200 | + return img_picto($langs->trans('StatusActionInProcess'), 'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)'; |
|
| 1201 | 1201 | elseif ($percent >= 100) |
| 1202 | - return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1202 | + return img_picto($langs->trans('StatusActionDone'), 'statut6').' '.$langs->trans('StatusActionDone').' (100%)'; |
|
| 1203 | 1203 | } |
| 1204 | 1204 | elseif ($mode == 5) { |
| 1205 | 1205 | if ($percent == -1 && !$hidenastatus) |
| 1206 | 1206 | return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
| 1207 | 1207 | elseif ($percent == 0) |
| 1208 | - return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1208 | + return '0% '.img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1209 | 1209 | elseif ($percent > 0 && $percent < 100) |
| 1210 | - return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1210 | + return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%', 'statut3'); |
|
| 1211 | 1211 | elseif ($percent >= 100) |
| 1212 | - return $langs->trans('StatusActionDone') . ' ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1212 | + return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1213 | 1213 | } |
| 1214 | 1214 | elseif ($mode == 6) { |
| 1215 | 1215 | if ($percent == -1 && !$hidenastatus) |
| 1216 | - return $langs->trans('StatusNotApplicable') . ' ' . img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1216 | + return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1217 | 1217 | elseif ($percent == 0) |
| 1218 | - return $langs->trans('StatusActionToDo') . ' (0%) ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1218 | + return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1219 | 1219 | elseif ($percent > 0 && $percent < 100) |
| 1220 | - return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%) ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1220 | + return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%', 'statut3'); |
|
| 1221 | 1221 | elseif ($percent >= 100) |
| 1222 | - return $langs->trans('StatusActionDone') . ' (100%) ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1222 | + return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1223 | 1223 | } |
| 1224 | 1224 | elseif ($mode == 7) { |
| 1225 | 1225 | if ($percent == -1 && !$hidenastatus) |
| 1226 | 1226 | return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
| 1227 | 1227 | elseif ($percent == 0) |
| 1228 | - return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1228 | + return '0% '.img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1229 | 1229 | elseif ($percent > 0 && $percent < 100) |
| 1230 | - return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1230 | + return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%', 'statut3'); |
|
| 1231 | 1231 | elseif ($percent >= 100) |
| 1232 | 1232 | return img_picto($langs->trans('StatusActionDone'), 'statut6'); |
| 1233 | 1233 | } |
@@ -1253,49 +1253,49 @@ discard block |
||
| 1253 | 1253 | global $conf, $langs, $user, $hookmanager, $action; |
| 1254 | 1254 | |
| 1255 | 1255 | if (!empty($conf->dol_no_mouse_hover)) |
| 1256 | - $notooltip = 1; // Force disable tooltips |
|
| 1256 | + $notooltip = 1; // Force disable tooltips |
|
| 1257 | 1257 | |
| 1258 | 1258 | if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) |
| 1259 | 1259 | $option = 'nolink'; |
| 1260 | 1260 | |
| 1261 | 1261 | $label = $this->label; |
| 1262 | 1262 | if (empty($label)) |
| 1263 | - $label = $this->libelle; // For backward compatibility |
|
| 1263 | + $label = $this->libelle; // For backward compatibility |
|
| 1264 | 1264 | |
| 1265 | 1265 | $result = ''; |
| 1266 | 1266 | |
| 1267 | 1267 | // Set label of type |
| 1268 | 1268 | $labeltype = ''; |
| 1269 | 1269 | if ($this->type_code) { |
| 1270 | - $labeltype = ($langs->transnoentities("Action" . $this->type_code) != "Action" . $this->type_code) ? $langs->transnoentities("Action" . $this->type_code) : $this->type_label; |
|
| 1270 | + $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code) ? $langs->transnoentities("Action".$this->type_code) : $this->type_label; |
|
| 1271 | 1271 | } |
| 1272 | 1272 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { |
| 1273 | 1273 | if ($this->type_code != 'AC_OTH_AUTO') |
| 1274 | 1274 | $labeltype = $langs->trans('ActionAC_MANUAL'); |
| 1275 | 1275 | } |
| 1276 | 1276 | |
| 1277 | - $tooltip = '<u>' . $langs->trans('ShowAction') . '</u>'; |
|
| 1277 | + $tooltip = '<u>'.$langs->trans('ShowAction').'</u>'; |
|
| 1278 | 1278 | if (!empty($this->ref)) |
| 1279 | - $tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1279 | + $tooltip .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 1280 | 1280 | if (!empty($label)) |
| 1281 | - $tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label; |
|
| 1281 | + $tooltip .= '<br><b>'.$langs->trans('Title').':</b> '.$label; |
|
| 1282 | 1282 | if (!empty($labeltype)) |
| 1283 | - $tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype; |
|
| 1283 | + $tooltip .= '<br><b>'.$langs->trans('Type').':</b> '.$labeltype; |
|
| 1284 | 1284 | if (!empty($this->location)) |
| 1285 | - $tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location; |
|
| 1285 | + $tooltip .= '<br><b>'.$langs->trans('Location').':</b> '.$this->location; |
|
| 1286 | 1286 | if (!empty($this->note)) |
| 1287 | - $tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . $this->note; |
|
| 1287 | + $tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.$this->note; |
|
| 1288 | 1288 | $linkclose = ''; |
| 1289 | 1289 | if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) |
| 1290 | - $linkclose = ' style="background-color:#' . $this->type_color . '"'; |
|
| 1290 | + $linkclose = ' style="background-color:#'.$this->type_color.'"'; |
|
| 1291 | 1291 | |
| 1292 | 1292 | if (empty($notooltip)) { |
| 1293 | 1293 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
| 1294 | 1294 | $label = $langs->trans("ShowAction"); |
| 1295 | - $linkclose .= ' alt="' . dol_escape_htmltag($tooltip, 1) . '"'; |
|
| 1295 | + $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; |
|
| 1296 | 1296 | } |
| 1297 | - $linkclose .= ' title="' . dol_escape_htmltag($tooltip, 1) . '"'; |
|
| 1298 | - $linkclose .= ' class="' . $classname . ' classfortooltip"'; |
|
| 1297 | + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1).'"'; |
|
| 1298 | + $linkclose .= ' class="'.$classname.' classfortooltip"'; |
|
| 1299 | 1299 | |
| 1300 | 1300 | /* |
| 1301 | 1301 | $hookmanager->initHooks(array('actiondao')); |
@@ -1304,13 +1304,13 @@ discard block |
||
| 1304 | 1304 | $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); |
| 1305 | 1305 | */ |
| 1306 | 1306 | } else |
| 1307 | - $linkclose .= ' class="' . $classname . '"'; |
|
| 1307 | + $linkclose .= ' class="'.$classname.'"'; |
|
| 1308 | 1308 | |
| 1309 | 1309 | $url = ''; |
| 1310 | 1310 | if ($option == 'birthday') |
| 1311 | - $url = DOL_URL_ROOT . '/contact/perso.php?id=' . $this->id; |
|
| 1311 | + $url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id; |
|
| 1312 | 1312 | else |
| 1313 | - $url = DOL_URL_ROOT . '/comm/action/card.php?id=' . $this->id; |
|
| 1313 | + $url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id; |
|
| 1314 | 1314 | if ($option !== 'nolink') { |
| 1315 | 1315 | // Add param to save lastsearch_values or not |
| 1316 | 1316 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
@@ -1320,8 +1320,8 @@ discard block |
||
| 1320 | 1320 | $url .= '&save_lastsearch_values=1'; |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | - $linkstart = '<a href="' . $url . '"'; |
|
| 1324 | - $linkstart .= $linkclose . '>'; |
|
| 1323 | + $linkstart = '<a href="'.$url.'"'; |
|
| 1324 | + $linkstart .= $linkclose.'>'; |
|
| 1325 | 1325 | $linkend = '</a>'; |
| 1326 | 1326 | |
| 1327 | 1327 | if ($option == 'nolink') { |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | $libelleshort = ''; |
| 1338 | 1338 | } |
| 1339 | 1339 | else { |
| 1340 | - $libelle = (empty($this->libelle) ? $label : $this->libelle . (($label && $label != $this->libelle) ? ' ' . $label : '')); |
|
| 1340 | + $libelle = (empty($this->libelle) ? $label : $this->libelle.(($label && $label != $this->libelle) ? ' '.$label : '')); |
|
| 1341 | 1341 | if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) |
| 1342 | 1342 | $libelle = $labeltype; |
| 1343 | 1343 | if ($maxlength < 0) |
@@ -1349,21 +1349,21 @@ discard block |
||
| 1349 | 1349 | if ($withpicto) { |
| 1350 | 1350 | if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { // Add code into () |
| 1351 | 1351 | if ($labeltype) { |
| 1352 | - $libelle .= (preg_match('/' . preg_quote($labeltype, '/') . '/', $libelle) ? '' : ' (' . $langs->transnoentities("Action" . $this->type_code) . ')'); |
|
| 1352 | + $libelle .= (preg_match('/'.preg_quote($labeltype, '/').'/', $libelle) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')'); |
|
| 1353 | 1353 | } |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | $result .= $linkstart; |
| 1358 | 1358 | if ($withpicto) |
| 1359 | - $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction") . ': ' . $libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'valigntextbottom"' : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip valigntextbottom"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1359 | + $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'valigntextbottom"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1360 | 1360 | $result .= $libelleshort; |
| 1361 | 1361 | $result .= $linkend; |
| 1362 | 1362 | |
| 1363 | 1363 | global $action; |
| 1364 | 1364 | $hookmanager->initHooks(array('actiondao')); |
| 1365 | 1365 | $parameters = array('id' => $this->id, 'getnomurl' => $result); |
| 1366 | - $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1366 | + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1367 | 1367 | if ($reshook > 0) |
| 1368 | 1368 | $result = $hookmanager->resPrint; |
| 1369 | 1369 | else |
@@ -1388,11 +1388,11 @@ discard block |
||
| 1388 | 1388 | // phpcs:enable |
| 1389 | 1389 | global $conf, $langs, $dolibarr_main_url_root, $mysoc; |
| 1390 | 1390 | |
| 1391 | - require_once DOL_DOCUMENT_ROOT . "/core/lib/xcal.lib.php"; |
|
| 1392 | - require_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php"; |
|
| 1393 | - require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; |
|
| 1391 | + require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php"; |
|
| 1392 | + require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; |
|
| 1393 | + require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; |
|
| 1394 | 1394 | |
| 1395 | - dol_syslog(get_class($this) . "::build_exportfile Build export file format=" . $format . ", type=" . $type . ", cachedelay=" . $cachedelay . ", filename=" . $filename . ", filters size=" . count($filters), LOG_DEBUG); |
|
| 1395 | + dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); |
|
| 1396 | 1396 | |
| 1397 | 1397 | // Check parameters |
| 1398 | 1398 | if (empty($format)) |
@@ -1403,12 +1403,12 @@ discard block |
||
| 1403 | 1403 | $extension = 'vcs'; |
| 1404 | 1404 | if ($format == 'ical') |
| 1405 | 1405 | $extension = 'ics'; |
| 1406 | - $filename = $format . '.' . $extension; |
|
| 1406 | + $filename = $format.'.'.$extension; |
|
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | // Create dir and define output file (definitive and temporary) |
| 1410 | 1410 | $result = dol_mkdir($conf->agenda->dir_temp); |
| 1411 | - $outputfile = $conf->agenda->dir_temp . '/' . $filename; |
|
| 1411 | + $outputfile = $conf->agenda->dir_temp.'/'.$filename; |
|
| 1412 | 1412 | |
| 1413 | 1413 | $result = 0; |
| 1414 | 1414 | |
@@ -1422,9 +1422,9 @@ discard block |
||
| 1422 | 1422 | |
| 1423 | 1423 | if ($cachedelay) { |
| 1424 | 1424 | $nowgmt = dol_now(); |
| 1425 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 1425 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 1426 | 1426 | if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { |
| 1427 | - dol_syslog(get_class($this) . "::build_exportfile file " . $outputfile . " is not older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . "). Build is canceled"); |
|
| 1427 | + dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); |
|
| 1428 | 1428 | $buildfile = false; |
| 1429 | 1429 | } |
| 1430 | 1430 | } |
@@ -1434,9 +1434,9 @@ discard block |
||
| 1434 | 1434 | $eventarray = array(); |
| 1435 | 1435 | |
| 1436 | 1436 | $sql = "SELECT a.id,"; |
| 1437 | - $sql .= " a.datep,"; // Start |
|
| 1437 | + $sql .= " a.datep,"; // Start |
|
| 1438 | 1438 | $sql .= " a.datep2,"; // End |
| 1439 | - $sql .= " a.durationp,"; // deprecated |
|
| 1439 | + $sql .= " a.durationp,"; // deprecated |
|
| 1440 | 1440 | $sql .= " a.datec, a.tms as datem,"; |
| 1441 | 1441 | $sql .= " a.label, a.code, a.note, a.fk_action as type_id,"; |
| 1442 | 1442 | $sql .= " a.fk_soc,"; |
@@ -1448,31 +1448,31 @@ discard block |
||
| 1448 | 1448 | $sql .= " u.firstname, u.lastname,"; |
| 1449 | 1449 | $sql .= " s.nom as socname,"; |
| 1450 | 1450 | $sql .= " c.id as type_id, c.code as type_code, c.libelle"; |
| 1451 | - $sql .= " FROM (" . MAIN_DB_PREFIX . "c_actioncomm as c, " . MAIN_DB_PREFIX . "actioncomm as a)"; |
|
| 1452 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export |
|
| 1453 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on s.rowid = a.fk_soc"; |
|
| 1451 | + $sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; |
|
| 1452 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export |
|
| 1453 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; |
|
| 1454 | 1454 | // We must filter on assignement table |
| 1455 | 1455 | if ($filters['logint']) |
| 1456 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 1456 | + $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
|
| 1457 | 1457 | $sql .= " WHERE a.fk_action=c.id"; |
| 1458 | - $sql .= " AND a.entity IN (" . getEntity('agenda') . ")"; |
|
| 1458 | + $sql .= " AND a.entity IN (".getEntity('agenda').")"; |
|
| 1459 | 1459 | foreach ($filters as $key => $value) { |
| 1460 | 1460 | if ($key == 'notolderthan' && $value != '') |
| 1461 | - $sql .= " AND a.datep >= '" . $this->db->idate($now - ($value * 24 * 60 * 60)) . "'"; |
|
| 1461 | + $sql .= " AND a.datep >= '".$this->db->idate($now - ($value * 24 * 60 * 60))."'"; |
|
| 1462 | 1462 | if ($key == 'year') |
| 1463 | - $sql .= " AND a.datep BETWEEN '" . $this->db->idate(dol_get_first_day($value, 1)) . "' AND '" . $this->db->idate(dol_get_last_day($value, 12)) . "'"; |
|
| 1463 | + $sql .= " AND a.datep BETWEEN '".$this->db->idate(dol_get_first_day($value, 1))."' AND '".$this->db->idate(dol_get_last_day($value, 12))."'"; |
|
| 1464 | 1464 | if ($key == 'id') |
| 1465 | - $sql .= " AND a.id=" . (is_numeric($value) ? $value : 0); |
|
| 1465 | + $sql .= " AND a.id=".(is_numeric($value) ? $value : 0); |
|
| 1466 | 1466 | if ($key == 'idfrom') |
| 1467 | - $sql .= " AND a.id >= " . (is_numeric($value) ? $value : 0); |
|
| 1467 | + $sql .= " AND a.id >= ".(is_numeric($value) ? $value : 0); |
|
| 1468 | 1468 | if ($key == 'idto') |
| 1469 | - $sql .= " AND a.id <= " . (is_numeric($value) ? $value : 0); |
|
| 1469 | + $sql .= " AND a.id <= ".(is_numeric($value) ? $value : 0); |
|
| 1470 | 1470 | if ($key == 'project') |
| 1471 | - $sql .= " AND a.fk_project=" . (is_numeric($value) ? $value : 0); |
|
| 1471 | + $sql .= " AND a.fk_project=".(is_numeric($value) ? $value : 0); |
|
| 1472 | 1472 | if ($key == 'actiontype') |
| 1473 | - $sql .= " AND c.type = '" . $this->db->escape($value) . "'"; |
|
| 1473 | + $sql .= " AND c.type = '".$this->db->escape($value)."'"; |
|
| 1474 | 1474 | if ($key == 'notactiontype') |
| 1475 | - $sql .= " AND c.type <> '" . $this->db->escape($value) . "'"; |
|
| 1475 | + $sql .= " AND c.type <> '".$this->db->escape($value)."'"; |
|
| 1476 | 1476 | // We must filter on assignement table |
| 1477 | 1477 | if ($key == 'logint') |
| 1478 | 1478 | $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
@@ -1486,7 +1486,7 @@ discard block |
||
| 1486 | 1486 | $userforfilter = new User($this->db); |
| 1487 | 1487 | $result = $userforfilter->fetch('', $logina); |
| 1488 | 1488 | if ($result > 0) |
| 1489 | - $sql .= " AND a.fk_user_author " . $condition . " " . $userforfilter->id; |
|
| 1489 | + $sql .= " AND a.fk_user_author ".$condition." ".$userforfilter->id; |
|
| 1490 | 1490 | elseif ($result < 0 || $condition == '=') |
| 1491 | 1491 | $sql .= " AND a.fk_user_author = 0"; |
| 1492 | 1492 | } |
@@ -1500,16 +1500,16 @@ discard block |
||
| 1500 | 1500 | $userforfilter = new User($this->db); |
| 1501 | 1501 | $result = $userforfilter->fetch('', $logint); |
| 1502 | 1502 | if ($result > 0) |
| 1503 | - $sql .= " AND ar.fk_element = " . $userforfilter->id; |
|
| 1503 | + $sql .= " AND ar.fk_element = ".$userforfilter->id; |
|
| 1504 | 1504 | elseif ($result < 0 || $condition == '=') |
| 1505 | 1505 | $sql .= " AND ar.fk_element = 0"; |
| 1506 | 1506 | } |
| 1507 | 1507 | } |
| 1508 | - $sql .= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import |
|
| 1508 | + $sql .= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import |
|
| 1509 | 1509 | $sql .= " ORDER by datep"; |
| 1510 | 1510 | //print $sql;exit; |
| 1511 | 1511 | |
| 1512 | - dol_syslog(get_class($this) . "::build_exportfile select events", LOG_DEBUG); |
|
| 1512 | + dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG); |
|
| 1513 | 1513 | $resql = $this->db->query($sql); |
| 1514 | 1514 | if ($resql) { |
| 1515 | 1515 | // Note: Output of sql request is encoded in $conf->file->character_set_client |
@@ -1520,28 +1520,28 @@ discard block |
||
| 1520 | 1520 | |
| 1521 | 1521 | // 'eid','startdate','duration','enddate','title','summary','category','email','url','desc','author' |
| 1522 | 1522 | $event = array(); |
| 1523 | - $event['uid'] = 'dolibarragenda-' . $this->db->database_name . '-' . $obj->id . "@" . $_SERVER["SERVER_NAME"]; |
|
| 1523 | + $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; |
|
| 1524 | 1524 | $event['type'] = $type; |
| 1525 | 1525 | $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); |
| 1526 | 1526 | $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); |
| 1527 | 1527 | $duration = ($datestart && $dateend) ? ($dateend - $datestart) : 0; |
| 1528 | - $event['summary'] = $obj->label . ($obj->socname ? " (" . $obj->socname . ")" : ""); |
|
| 1528 | + $event['summary'] = $obj->label.($obj->socname ? " (".$obj->socname.")" : ""); |
|
| 1529 | 1529 | $event['desc'] = $obj->note; |
| 1530 | 1530 | $event['startdate'] = $datestart; |
| 1531 | - $event['enddate'] = $dateend; // Not required with type 'journal' |
|
| 1531 | + $event['enddate'] = $dateend; // Not required with type 'journal' |
|
| 1532 | 1532 | $event['duration'] = $duration; // Not required with type 'journal' |
| 1533 | 1533 | $event['author'] = dolGetFirstLastname($obj->firstname, $obj->lastname); |
| 1534 | 1534 | $event['priority'] = $obj->priority; |
| 1535 | 1535 | $event['fulldayevent'] = $obj->fulldayevent; |
| 1536 | 1536 | $event['location'] = $obj->location; |
| 1537 | - $event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) |
|
| 1537 | + $event['transparency'] = (($obj->transparency > 0) ? 'OPAQUE' : 'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) |
|
| 1538 | 1538 | $event['punctual'] = $obj->punctual; |
| 1539 | 1539 | $event['category'] = $obj->libelle; // libelle type action |
| 1540 | 1540 | // Define $urlwithroot |
| 1541 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
|
| 1542 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1541 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
| 1542 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1543 | 1543 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
| 1544 | - $url = $urlwithroot . '/comm/action/card.php?id=' . $obj->id; |
|
| 1544 | + $url = $urlwithroot.'/comm/action/card.php?id='.$obj->id; |
|
| 1545 | 1545 | $event['url'] = $url; |
| 1546 | 1546 | $event['created'] = $this->db->jdate($obj->datec) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); |
| 1547 | 1547 | $event['modified'] = $this->db->jdate($obj->datem) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); |
@@ -1561,25 +1561,25 @@ discard block |
||
| 1561 | 1561 | // Define title and desc |
| 1562 | 1562 | $more = ''; |
| 1563 | 1563 | if ($login) |
| 1564 | - $more = $langs->transnoentities("User") . ' ' . $login; |
|
| 1564 | + $more = $langs->transnoentities("User").' '.$login; |
|
| 1565 | 1565 | if ($logina) |
| 1566 | - $more = $langs->transnoentities("ActionsAskedBy") . ' ' . $logina; |
|
| 1566 | + $more = $langs->transnoentities("ActionsAskedBy").' '.$logina; |
|
| 1567 | 1567 | if ($logint) |
| 1568 | - $more = $langs->transnoentities("ActionsToDoBy") . ' ' . $logint; |
|
| 1568 | + $more = $langs->transnoentities("ActionsToDoBy").' '.$logint; |
|
| 1569 | 1569 | if ($logind) |
| 1570 | - $more = $langs->transnoentities("ActionsDoneBy") . ' ' . $logind; |
|
| 1570 | + $more = $langs->transnoentities("ActionsDoneBy").' '.$logind; |
|
| 1571 | 1571 | if ($more) { |
| 1572 | - $title = 'Dolibarr actions ' . $mysoc->name . ' - ' . $more; |
|
| 1572 | + $title = 'Dolibarr actions '.$mysoc->name.' - '.$more; |
|
| 1573 | 1573 | $desc = $more; |
| 1574 | - $desc .= ' (' . $mysoc->name . ' - built by Dolibarr)'; |
|
| 1574 | + $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; |
|
| 1575 | 1575 | } else { |
| 1576 | - $title = 'Dolibarr actions ' . $mysoc->name; |
|
| 1576 | + $title = 'Dolibarr actions '.$mysoc->name; |
|
| 1577 | 1577 | $desc = $langs->transnoentities('ListOfActions'); |
| 1578 | - $desc .= ' (' . $mysoc->name . ' - built by Dolibarr)'; |
|
| 1578 | + $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | // Create temp file |
| 1582 | - $outputfiletmp = tempnam($conf->agenda->dir_temp, 'tmp'); // Temporary file (allow call of function by different threads |
|
| 1582 | + $outputfiletmp = tempnam($conf->agenda->dir_temp, 'tmp'); // Temporary file (allow call of function by different threads |
|
| 1583 | 1583 | @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); |
| 1584 | 1584 | |
| 1585 | 1585 | // Write file |
@@ -1594,13 +1594,13 @@ discard block |
||
| 1594 | 1594 | if (dol_move($outputfiletmp, $outputfile, 0, 1)) |
| 1595 | 1595 | $result = 1; |
| 1596 | 1596 | else { |
| 1597 | - $this->error = 'Failed to rename ' . $outputfiletmp . ' into ' . $outputfile; |
|
| 1598 | - dol_syslog(get_class($this) . "::build_exportfile " . $this->error, LOG_ERR); |
|
| 1597 | + $this->error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; |
|
| 1598 | + dol_syslog(get_class($this)."::build_exportfile ".$this->error, LOG_ERR); |
|
| 1599 | 1599 | dol_delete_file($outputfiletmp, 0, 1); |
| 1600 | 1600 | $result = -1; |
| 1601 | 1601 | } |
| 1602 | 1602 | } else { |
| 1603 | - dol_syslog(get_class($this) . "::build_exportfile build_xxxfile function fails to for format=" . $format . " outputfiletmp=" . $outputfile, LOG_ERR); |
|
| 1603 | + dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); |
|
| 1604 | 1604 | dol_delete_file($outputfiletmp, 0, 1); |
| 1605 | 1605 | $langs->load("errors"); |
| 1606 | 1606 | $this->error = $langs->trans("ErrorFailToCreateFile", $outputfile); |
@@ -1713,7 +1713,7 @@ discard block |
||
| 1713 | 1713 | |
| 1714 | 1714 | // TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done |
| 1715 | 1715 | // Delete also very old past events (we do not keep more than 1 month record in past) |
| 1716 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "actioncomm_reminder WHERE dateremind < '" . $this->db->jdate($now - (3600 * 24 * 32)) . "'"; |
|
| 1716 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; |
|
| 1717 | 1717 | $this->db->query($sql); |
| 1718 | 1718 | |
| 1719 | 1719 | $this->db->commit(); |
@@ -233,35 +233,48 @@ discard block |
||
| 233 | 233 | $this->label = dol_trunc(trim($this->label), 128); |
| 234 | 234 | $this->location = dol_trunc(trim($this->location), 128); |
| 235 | 235 | $this->note = dol_htmlcleanlastbr(trim($this->note)); |
| 236 | - if (empty($this->percentage)) |
|
| 237 | - $this->percentage = 0; |
|
| 238 | - if (empty($this->priority) || !is_numeric($this->priority)) |
|
| 239 | - $this->priority = 0; |
|
| 240 | - if (empty($this->fulldayevent)) |
|
| 241 | - $this->fulldayevent = 0; |
|
| 242 | - if (empty($this->punctual)) |
|
| 243 | - $this->punctual = 0; |
|
| 244 | - if (empty($this->transparency)) |
|
| 245 | - $this->transparency = 0; |
|
| 246 | - if ($this->percentage > 100) |
|
| 247 | - $this->percentage = 100; |
|
| 236 | + if (empty($this->percentage)) { |
|
| 237 | + $this->percentage = 0; |
|
| 238 | + } |
|
| 239 | + if (empty($this->priority) || !is_numeric($this->priority)) { |
|
| 240 | + $this->priority = 0; |
|
| 241 | + } |
|
| 242 | + if (empty($this->fulldayevent)) { |
|
| 243 | + $this->fulldayevent = 0; |
|
| 244 | + } |
|
| 245 | + if (empty($this->punctual)) { |
|
| 246 | + $this->punctual = 0; |
|
| 247 | + } |
|
| 248 | + if (empty($this->transparency)) { |
|
| 249 | + $this->transparency = 0; |
|
| 250 | + } |
|
| 251 | + if ($this->percentage > 100) { |
|
| 252 | + $this->percentage = 100; |
|
| 253 | + } |
|
| 248 | 254 | //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; |
| 249 | - if (!empty($this->datep) && !empty($this->datef)) |
|
| 250 | - $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 255 | + if (!empty($this->datep) && !empty($this->datef)) { |
|
| 256 | + $this->durationp = ($this->datef - $this->datep); |
|
| 257 | + } |
|
| 258 | + // deprecated |
|
| 251 | 259 | |
| 252 | 260 | |
| 253 | 261 | //if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); |
| 254 | - if (!empty($this->datep) && !empty($this->datef) && $this->datep > $this->datef) |
|
| 255 | - $this->datef = $this->datep; |
|
| 262 | + if (!empty($this->datep) && !empty($this->datef) && $this->datep > $this->datef) { |
|
| 263 | + $this->datef = $this->datep; |
|
| 264 | + } |
|
| 256 | 265 | //if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; |
| 257 | - if (!isset($this->fk_project) || $this->fk_project < 0) |
|
| 258 | - $this->fk_project = 0; |
|
| 259 | - if ($this->elementtype == 'facture') |
|
| 260 | - $this->elementtype = 'invoice'; |
|
| 261 | - if ($this->elementtype == 'commande') |
|
| 262 | - $this->elementtype = 'order'; |
|
| 263 | - if ($this->elementtype == 'contrat') |
|
| 264 | - $this->elementtype = 'contract'; |
|
| 266 | + if (!isset($this->fk_project) || $this->fk_project < 0) { |
|
| 267 | + $this->fk_project = 0; |
|
| 268 | + } |
|
| 269 | + if ($this->elementtype == 'facture') { |
|
| 270 | + $this->elementtype = 'invoice'; |
|
| 271 | + } |
|
| 272 | + if ($this->elementtype == 'commande') { |
|
| 273 | + $this->elementtype = 'order'; |
|
| 274 | + } |
|
| 275 | + if ($this->elementtype == 'contrat') { |
|
| 276 | + $this->elementtype = 'contract'; |
|
| 277 | + } |
|
| 265 | 278 | |
| 266 | 279 | if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead fo array |
| 267 | 280 | $tmpid = $this->userassigned; |
@@ -269,16 +282,19 @@ discard block |
||
| 269 | 282 | $this->userassigned[$tmpid] = array('id' => $tmpid, 'transparency' => $this->transparency); |
| 270 | 283 | } |
| 271 | 284 | |
| 272 | - if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && !($this->contactid > 0)) |
|
| 273 | - $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated |
|
| 285 | + if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && !($this->contactid > 0)) { |
|
| 286 | + $this->contactid = $this->contact->id; |
|
| 287 | + } |
|
| 288 | + // For backward compatibility. Using this->contact->xx is deprecated |
|
| 274 | 289 | |
| 275 | 290 | |
| 276 | 291 | $userownerid = $this->userownerid; |
| 277 | 292 | $userdoneid = $this->userdoneid; |
| 278 | 293 | |
| 279 | 294 | // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). |
| 280 | - if (empty($this->userassigned) || count($this->userassigned) == 0 || !is_array($this->userassigned)) |
|
| 281 | - $this->userassigned = array($userownerid => array('id' => $userownerid, 'transparency' => $this->transparency)); |
|
| 295 | + if (empty($this->userassigned) || count($this->userassigned) == 0 || !is_array($this->userassigned)) { |
|
| 296 | + $this->userassigned = array($userownerid => array('id' => $userownerid, 'transparency' => $this->transparency)); |
|
| 297 | + } |
|
| 282 | 298 | |
| 283 | 299 | if (!$this->type_id || !$this->type_code) { |
| 284 | 300 | $key = empty($this->type_id) ? $this->type_code : $this->type_id; |
@@ -498,8 +514,9 @@ discard block |
||
| 498 | 514 | |
| 499 | 515 | // Create clone |
| 500 | 516 | $result = $this->create($fuser); |
| 501 | - if ($result < 0) |
|
| 502 | - $error++; |
|
| 517 | + if ($result < 0) { |
|
| 518 | + $error++; |
|
| 519 | + } |
|
| 503 | 520 | |
| 504 | 521 | if (!$error) { |
| 505 | 522 | // Hook of thirdparty module |
@@ -507,8 +524,9 @@ discard block |
||
| 507 | 524 | $parameters = array('objFrom' => $objFrom); |
| 508 | 525 | $action = ''; |
| 509 | 526 | $reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 510 | - if ($reshook < 0) |
|
| 511 | - $error++; |
|
| 527 | + if ($reshook < 0) { |
|
| 528 | + $error++; |
|
| 529 | + } |
|
| 512 | 530 | } |
| 513 | 531 | |
| 514 | 532 | // Call trigger |
@@ -567,12 +585,15 @@ discard block |
||
| 567 | 585 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_author"; |
| 568 | 586 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on s.rowid = a.fk_soc"; |
| 569 | 587 | $sql .= " WHERE "; |
| 570 | - if ($ref) |
|
| 571 | - $sql .= " a.id=" . $ref; // No field ref, we use id |
|
| 572 | - elseif ($ref_ext) |
|
| 573 | - $sql .= " a.ref_ext='" . $this->db->escape($ref_ext) . "'"; |
|
| 574 | - else |
|
| 575 | - $sql .= " a.id=" . $id; |
|
| 588 | + if ($ref) { |
|
| 589 | + $sql .= " a.id=" . $ref; |
|
| 590 | + } |
|
| 591 | + // No field ref, we use id |
|
| 592 | + elseif ($ref_ext) { |
|
| 593 | + $sql .= " a.ref_ext='" . $this->db->escape($ref_ext) . "'"; |
|
| 594 | + } else { |
|
| 595 | + $sql .= " a.id=" . $id; |
|
| 596 | + } |
|
| 576 | 597 | |
| 577 | 598 | dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
| 578 | 599 | $resql = $this->db->query($sql); |
@@ -610,13 +631,17 @@ discard block |
||
| 610 | 631 | $this->authorid = $obj->fk_user_author; |
| 611 | 632 | $this->usermodid = $obj->fk_user_mod; |
| 612 | 633 | |
| 613 | - if (!is_object($this->author)) |
|
| 614 | - $this->author = new stdClass(); // To avoid warning |
|
| 634 | + if (!is_object($this->author)) { |
|
| 635 | + $this->author = new stdClass(); |
|
| 636 | + } |
|
| 637 | + // To avoid warning |
|
| 615 | 638 | $this->author->id = $obj->fk_user_author; // deprecated |
| 616 | 639 | $this->author->firstname = $obj->firstname; // deprecated |
| 617 | 640 | $this->author->lastname = $obj->lastname; // deprecated |
| 618 | - if (!is_object($this->usermod)) |
|
| 619 | - $this->usermod = new stdClass(); // To avoid warning |
|
| 641 | + if (!is_object($this->usermod)) { |
|
| 642 | + $this->usermod = new stdClass(); |
|
| 643 | + } |
|
| 644 | + // To avoid warning |
|
| 620 | 645 | $this->usermod->id = $obj->fk_user_mod; // deprecated |
| 621 | 646 | |
| 622 | 647 | $this->userownerid = $obj->fk_user_action; |
@@ -641,8 +666,7 @@ discard block |
||
| 641 | 666 | $this->fetchResources(); |
| 642 | 667 | } |
| 643 | 668 | $this->db->free($resql); |
| 644 | - } |
|
| 645 | - else { |
|
| 669 | + } else { |
|
| 646 | 670 | $this->error = $this->db->lasterror(); |
| 647 | 671 | return -1; |
| 648 | 672 | } |
@@ -667,16 +691,20 @@ discard block |
||
| 667 | 691 | $this->socpeopleassigned = array(); |
| 668 | 692 | |
| 669 | 693 | // If owner is known, we must but id first into list |
| 670 | - if ($this->userownerid > 0) |
|
| 671 | - $this->userassigned[$this->userownerid] = array('id' => $this->userownerid); // Set first so will be first into list. |
|
| 694 | + if ($this->userownerid > 0) { |
|
| 695 | + $this->userassigned[$this->userownerid] = array('id' => $this->userownerid); |
|
| 696 | + } |
|
| 697 | + // Set first so will be first into list. |
|
| 672 | 698 | |
| 673 | 699 | while ($obj = $this->db->fetch_object($resql)) { |
| 674 | 700 | if ($obj->fk_element > 0) { |
| 675 | 701 | switch ($obj->element_type) { |
| 676 | 702 | case 'user': |
| 677 | 703 | $this->userassigned[$obj->fk_element] = array('id' => $obj->fk_element, 'mandatory' => $obj->mandatory, 'answer_status' => $obj->answer_status, 'transparency' => $obj->transparency); |
| 678 | - if (empty($this->userownerid)) |
|
| 679 | - $this->userownerid = $obj->fk_element; // If not defined (should not happened, we fix this) |
|
| 704 | + if (empty($this->userownerid)) { |
|
| 705 | + $this->userownerid = $obj->fk_element; |
|
| 706 | + } |
|
| 707 | + // If not defined (should not happened, we fix this) |
|
| 680 | 708 | break; |
| 681 | 709 | case 'socpeople': |
| 682 | 710 | $this->socpeopleassigned[$obj->fk_element] = array('id' => $obj->fk_element, 'mandatory' => $obj->mandatory, 'answer_status' => $obj->answer_status, 'transparency' => $obj->transparency); |
@@ -686,8 +714,7 @@ discard block |
||
| 686 | 714 | } |
| 687 | 715 | |
| 688 | 716 | return 1; |
| 689 | - } |
|
| 690 | - else { |
|
| 717 | + } else { |
|
| 691 | 718 | dol_print_error($this->db); |
| 692 | 719 | return -1; |
| 693 | 720 | } |
@@ -710,19 +737,23 @@ discard block |
||
| 710 | 737 | $this->userassigned = array(); |
| 711 | 738 | |
| 712 | 739 | // If owner is known, we must but id first into list |
| 713 | - if ($this->userownerid > 0) |
|
| 714 | - $this->userassigned[$this->userownerid] = array('id' => $this->userownerid); // Set first so will be first into list. |
|
| 740 | + if ($this->userownerid > 0) { |
|
| 741 | + $this->userassigned[$this->userownerid] = array('id' => $this->userownerid); |
|
| 742 | + } |
|
| 743 | + // Set first so will be first into list. |
|
| 715 | 744 | |
| 716 | 745 | while ($obj = $this->db->fetch_object($resql2)) { |
| 717 | - if ($obj->fk_element > 0) |
|
| 718 | - $this->userassigned[$obj->fk_element] = array('id' => $obj->fk_element, 'mandatory' => $obj->mandatory, 'answer_status' => $obj->answer_status, 'transparency' => $obj->transparency); |
|
| 719 | - if (empty($this->userownerid)) |
|
| 720 | - $this->userownerid = $obj->fk_element; // If not defined (should not happened, we fix this) |
|
| 746 | + if ($obj->fk_element > 0) { |
|
| 747 | + $this->userassigned[$obj->fk_element] = array('id' => $obj->fk_element, 'mandatory' => $obj->mandatory, 'answer_status' => $obj->answer_status, 'transparency' => $obj->transparency); |
|
| 748 | + } |
|
| 749 | + if (empty($this->userownerid)) { |
|
| 750 | + $this->userownerid = $obj->fk_element; |
|
| 751 | + } |
|
| 752 | + // If not defined (should not happened, we fix this) |
|
| 721 | 753 | } |
| 722 | 754 | |
| 723 | 755 | return 1; |
| 724 | - } |
|
| 725 | - else { |
|
| 756 | + } else { |
|
| 726 | 757 | dol_print_error($this->db); |
| 727 | 758 | return -1; |
| 728 | 759 | } |
@@ -814,27 +845,36 @@ discard block |
||
| 814 | 845 | // Clean parameters |
| 815 | 846 | $this->label = trim($this->label); |
| 816 | 847 | $this->note = trim($this->note); |
| 817 | - if (empty($this->percentage)) |
|
| 818 | - $this->percentage = 0; |
|
| 819 | - if (empty($this->priority) || !is_numeric($this->priority)) |
|
| 820 | - $this->priority = 0; |
|
| 821 | - if (empty($this->transparency)) |
|
| 822 | - $this->transparency = 0; |
|
| 823 | - if (empty($this->fulldayevent)) |
|
| 824 | - $this->fulldayevent = 0; |
|
| 825 | - if ($this->percentage > 100) |
|
| 826 | - $this->percentage = 100; |
|
| 848 | + if (empty($this->percentage)) { |
|
| 849 | + $this->percentage = 0; |
|
| 850 | + } |
|
| 851 | + if (empty($this->priority) || !is_numeric($this->priority)) { |
|
| 852 | + $this->priority = 0; |
|
| 853 | + } |
|
| 854 | + if (empty($this->transparency)) { |
|
| 855 | + $this->transparency = 0; |
|
| 856 | + } |
|
| 857 | + if (empty($this->fulldayevent)) { |
|
| 858 | + $this->fulldayevent = 0; |
|
| 859 | + } |
|
| 860 | + if ($this->percentage > 100) { |
|
| 861 | + $this->percentage = 100; |
|
| 862 | + } |
|
| 827 | 863 | //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; |
| 828 | - if ($this->datep && $this->datef) |
|
| 829 | - $this->durationp = ($this->datef - $this->datep); // deprecated |
|
| 864 | + if ($this->datep && $this->datef) { |
|
| 865 | + $this->durationp = ($this->datef - $this->datep); |
|
| 866 | + } |
|
| 867 | + // deprecated |
|
| 830 | 868 | |
| 831 | 869 | |
| 832 | 870 | //if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); |
| 833 | - if ($this->datep && $this->datef && $this->datep > $this->datef) |
|
| 834 | - $this->datef = $this->datep; |
|
| 871 | + if ($this->datep && $this->datef && $this->datep > $this->datef) { |
|
| 872 | + $this->datef = $this->datep; |
|
| 873 | + } |
|
| 835 | 874 | //if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; |
| 836 | - if ($this->fk_project < 0) |
|
| 837 | - $this->fk_project = 0; |
|
| 875 | + if ($this->fk_project < 0) { |
|
| 876 | + $this->fk_project = 0; |
|
| 877 | + } |
|
| 838 | 878 | |
| 839 | 879 | // Check parameters |
| 840 | 880 | if ($this->percentage == 0 && $this->userdoneid > 0) { |
@@ -851,8 +891,9 @@ discard block |
||
| 851 | 891 | |
| 852 | 892 | $sql = "UPDATE " . MAIN_DB_PREFIX . "actioncomm "; |
| 853 | 893 | $sql .= " SET percent = '" . $this->db->escape($this->percentage) . "'"; |
| 854 | - if ($this->type_id > 0) |
|
| 855 | - $sql .= ", fk_action = '" . $this->db->escape($this->type_id) . "'"; |
|
| 894 | + if ($this->type_id > 0) { |
|
| 895 | + $sql .= ", fk_action = '" . $this->db->escape($this->type_id) . "'"; |
|
| 896 | + } |
|
| 856 | 897 | $sql .= ", label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null"); |
| 857 | 898 | $sql .= ", datep = " . (strval($this->datep) != '' ? "'" . $this->db->idate($this->datep) . "'" : 'null'); |
| 858 | 899 | $sql .= ", datep2 = " . (strval($this->datef) != '' ? "'" . $this->db->idate($this->datef) . "'" : 'null'); |
@@ -868,10 +909,12 @@ discard block |
||
| 868 | 909 | $sql .= ", fk_user_mod = " . $user->id; |
| 869 | 910 | $sql .= ", fk_user_action=" . ($userownerid > 0 ? "'" . $userownerid . "'" : "null"); |
| 870 | 911 | $sql .= ", fk_user_done=" . ($userdoneid > 0 ? "'" . $userdoneid . "'" : "null"); |
| 871 | - if (!empty($this->fk_element)) |
|
| 872 | - $sql .= ", fk_element=" . ($this->fk_element ? $this->db->escape($this->fk_element) : "null"); |
|
| 873 | - if (!empty($this->elementtype)) |
|
| 874 | - $sql .= ", elementtype=" . ($this->elementtype ? "'" . $this->db->escape($this->elementtype) . "'" : "null"); |
|
| 912 | + if (!empty($this->fk_element)) { |
|
| 913 | + $sql .= ", fk_element=" . ($this->fk_element ? $this->db->escape($this->fk_element) : "null"); |
|
| 914 | + } |
|
| 915 | + if (!empty($this->elementtype)) { |
|
| 916 | + $sql .= ", elementtype=" . ($this->elementtype ? "'" . $this->db->escape($this->elementtype) . "'" : "null"); |
|
| 917 | + } |
|
| 875 | 918 | $sql .= " WHERE id=" . $this->id; |
| 876 | 919 | |
| 877 | 920 | dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
@@ -972,18 +1015,22 @@ discard block |
||
| 972 | 1015 | $sql = "SELECT a.id"; |
| 973 | 1016 | $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; |
| 974 | 1017 | $sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")"; |
| 975 | - if (!empty($socid)) |
|
| 976 | - $sql .= " AND a.fk_soc = " . $socid; |
|
| 1018 | + if (!empty($socid)) { |
|
| 1019 | + $sql .= " AND a.fk_soc = " . $socid; |
|
| 1020 | + } |
|
| 977 | 1021 | if (!empty($elementtype)) { |
| 978 | - if ($elementtype == 'project') |
|
| 979 | - $sql .= ' AND a.fk_project = ' . $fk_element; |
|
| 980 | - else |
|
| 981 | - $sql .= " AND a.fk_element = " . (int) $fk_element . " AND a.elementtype = '" . $elementtype . "'"; |
|
| 982 | - } |
|
| 983 | - if (!empty($filter)) |
|
| 984 | - $sql .= $filter; |
|
| 985 | - if ($sortorder && $sortfield) |
|
| 986 | - $sql .= $db->order($sortfield, $sortorder); |
|
| 1022 | + if ($elementtype == 'project') { |
|
| 1023 | + $sql .= ' AND a.fk_project = ' . $fk_element; |
|
| 1024 | + } else { |
|
| 1025 | + $sql .= " AND a.fk_element = " . (int) $fk_element . " AND a.elementtype = '" . $elementtype . "'"; |
|
| 1026 | + } |
|
| 1027 | + } |
|
| 1028 | + if (!empty($filter)) { |
|
| 1029 | + $sql .= $filter; |
|
| 1030 | + } |
|
| 1031 | + if ($sortorder && $sortfield) { |
|
| 1032 | + $sql .= $db->order($sortfield, $sortorder); |
|
| 1033 | + } |
|
| 987 | 1034 | $sql .= $db->plimit($limit, 0); |
| 988 | 1035 | |
| 989 | 1036 | dol_syslog(get_class() . "::getActions", LOG_DEBUG); |
@@ -1019,27 +1066,32 @@ discard block |
||
| 1019 | 1066 | // phpcs:enable |
| 1020 | 1067 | global $conf, $langs; |
| 1021 | 1068 | |
| 1022 | - if (empty($load_state_board)) |
|
| 1023 | - $sql = "SELECT a.id, a.datep as dp"; |
|
| 1024 | - else { |
|
| 1069 | + if (empty($load_state_board)) { |
|
| 1070 | + $sql = "SELECT a.id, a.datep as dp"; |
|
| 1071 | + } else { |
|
| 1025 | 1072 | $this->nb = array(); |
| 1026 | 1073 | $sql = "SELECT count(a.id) as nb"; |
| 1027 | 1074 | } |
| 1028 | 1075 | $sql .= " FROM (" . MAIN_DB_PREFIX . "actioncomm as a"; |
| 1029 | 1076 | $sql .= ")"; |
| 1030 | - if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
| 1031 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 1077 | + if (!$user->rights->societe->client->voir && !$user->societe_id) { |
|
| 1078 | + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; |
|
| 1079 | + } |
|
| 1032 | 1080 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON a.fk_soc = s.rowid"; |
| 1033 | 1081 | $sql .= " WHERE 1 = 1"; |
| 1034 | - if (empty($load_state_board)) |
|
| 1035 | - $sql .= " AND a.percent >= 0 AND a.percent < 100"; |
|
| 1082 | + if (empty($load_state_board)) { |
|
| 1083 | + $sql .= " AND a.percent >= 0 AND a.percent < 100"; |
|
| 1084 | + } |
|
| 1036 | 1085 | $sql .= " AND a.entity IN (" . getEntity('agenda') . ")"; |
| 1037 | - if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
| 1038 | - $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 1039 | - if ($user->societe_id) |
|
| 1040 | - $sql .= " AND a.fk_soc = " . $user->societe_id; |
|
| 1041 | - if (!$user->rights->agenda->allactions->read) |
|
| 1042 | - $sql .= " AND (a.fk_user_author = " . $user->id . " OR a.fk_user_action = " . $user->id . " OR a.fk_user_done = " . $user->id . ")"; |
|
| 1086 | + if (!$user->rights->societe->client->voir && !$user->societe_id) { |
|
| 1087 | + $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = " . $user->id . ")"; |
|
| 1088 | + } |
|
| 1089 | + if ($user->societe_id) { |
|
| 1090 | + $sql .= " AND a.fk_soc = " . $user->societe_id; |
|
| 1091 | + } |
|
| 1092 | + if (!$user->rights->agenda->allactions->read) { |
|
| 1093 | + $sql .= " AND (a.fk_user_author = " . $user->id . " OR a.fk_user_action = " . $user->id . " OR a.fk_user_done = " . $user->id . ")"; |
|
| 1094 | + } |
|
| 1043 | 1095 | |
| 1044 | 1096 | $resql = $this->db->query($sql); |
| 1045 | 1097 | if ($resql) { |
@@ -1060,19 +1112,21 @@ discard block |
||
| 1060 | 1112 | if (empty($load_state_board)) { |
| 1061 | 1113 | $response->nbtodo++; |
| 1062 | 1114 | $agenda_static->datep = $this->db->jdate($obj->dp); |
| 1063 | - if ($agenda_static->hasDelay()) |
|
| 1064 | - $response->nbtodolate++; |
|
| 1065 | - } else |
|
| 1066 | - $this->nb["actionscomm"] = $obj->nb; |
|
| 1115 | + if ($agenda_static->hasDelay()) { |
|
| 1116 | + $response->nbtodolate++; |
|
| 1117 | + } |
|
| 1118 | + } else { |
|
| 1119 | + $this->nb["actionscomm"] = $obj->nb; |
|
| 1120 | + } |
|
| 1067 | 1121 | } |
| 1068 | 1122 | |
| 1069 | 1123 | $this->db->free($resql); |
| 1070 | - if (empty($load_state_board)) |
|
| 1071 | - return $response; |
|
| 1072 | - else |
|
| 1073 | - return 1; |
|
| 1074 | - } |
|
| 1075 | - else { |
|
| 1124 | + if (empty($load_state_board)) { |
|
| 1125 | + return $response; |
|
| 1126 | + } else { |
|
| 1127 | + return 1; |
|
| 1128 | + } |
|
| 1129 | + } else { |
|
| 1076 | 1130 | dol_print_error($this->db); |
| 1077 | 1131 | $this->error = $this->db->error(); |
| 1078 | 1132 | return -1; |
@@ -1114,12 +1168,12 @@ discard block |
||
| 1114 | 1168 | } |
| 1115 | 1169 | |
| 1116 | 1170 | $this->date_creation = $this->db->jdate($obj->datec); |
| 1117 | - if (!empty($obj->fk_user_mod)) |
|
| 1118 | - $this->date_modification = $this->db->jdate($obj->datem); |
|
| 1171 | + if (!empty($obj->fk_user_mod)) { |
|
| 1172 | + $this->date_modification = $this->db->jdate($obj->datem); |
|
| 1173 | + } |
|
| 1119 | 1174 | } |
| 1120 | 1175 | $this->db->free($result); |
| 1121 | - } |
|
| 1122 | - else { |
|
| 1176 | + } else { |
|
| 1123 | 1177 | dol_print_error($this->db); |
| 1124 | 1178 | } |
| 1125 | 1179 | } |
@@ -1152,84 +1206,85 @@ discard block |
||
| 1152 | 1206 | global $langs; |
| 1153 | 1207 | |
| 1154 | 1208 | if ($mode == 0) { |
| 1155 | - if ($percent == -1 && !$hidenastatus) |
|
| 1156 | - return $langs->trans('StatusNotApplicable'); |
|
| 1157 | - elseif ($percent == 0) |
|
| 1158 | - return $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1159 | - elseif ($percent > 0 && $percent < 100) |
|
| 1160 | - return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1161 | - elseif ($percent >= 100) |
|
| 1162 | - return $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1163 | - } |
|
| 1164 | - elseif ($mode == 1) { |
|
| 1165 | - if ($percent == -1 && !$hidenastatus) |
|
| 1166 | - return $langs->trans('StatusNotApplicable'); |
|
| 1167 | - elseif ($percent == 0) |
|
| 1168 | - return $langs->trans('StatusActionToDo'); |
|
| 1169 | - elseif ($percent > 0 && $percent < 100) |
|
| 1170 | - return $percent . '%'; |
|
| 1171 | - elseif ($percent >= 100) |
|
| 1172 | - return $langs->trans('StatusActionDone'); |
|
| 1173 | - } |
|
| 1174 | - elseif ($mode == 2) { |
|
| 1175 | - if ($percent == -1 && !$hidenastatus) |
|
| 1176 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1177 | - elseif ($percent == 0) |
|
| 1178 | - return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo'); |
|
| 1179 | - elseif ($percent > 0 && $percent < 100) |
|
| 1180 | - return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $percent . '%'; |
|
| 1181 | - elseif ($percent >= 100) |
|
| 1182 | - return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone'); |
|
| 1183 | - } |
|
| 1184 | - elseif ($mode == 3) { |
|
| 1185 | - if ($percent == -1 && !$hidenastatus) |
|
| 1186 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1187 | - elseif ($percent == 0) |
|
| 1188 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionToDo') . ' (0%)', 'statut1'); |
|
| 1189 | - elseif ($percent > 0 && $percent < 100) |
|
| 1190 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)', 'statut3'); |
|
| 1191 | - elseif ($percent >= 100) |
|
| 1192 | - return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionDone') . ' (100%)', 'statut6'); |
|
| 1193 | - } |
|
| 1194 | - elseif ($mode == 4) { |
|
| 1195 | - if ($percent == -1 && !$hidenastatus) |
|
| 1196 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1197 | - elseif ($percent == 0) |
|
| 1198 | - return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1199 | - elseif ($percent > 0 && $percent < 100) |
|
| 1200 | - return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1201 | - elseif ($percent >= 100) |
|
| 1202 | - return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1203 | - } |
|
| 1204 | - elseif ($mode == 5) { |
|
| 1205 | - if ($percent == -1 && !$hidenastatus) |
|
| 1206 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1207 | - elseif ($percent == 0) |
|
| 1208 | - return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1209 | - elseif ($percent > 0 && $percent < 100) |
|
| 1210 | - return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1211 | - elseif ($percent >= 100) |
|
| 1212 | - return $langs->trans('StatusActionDone') . ' ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1213 | - } |
|
| 1214 | - elseif ($mode == 6) { |
|
| 1215 | - if ($percent == -1 && !$hidenastatus) |
|
| 1216 | - return $langs->trans('StatusNotApplicable') . ' ' . img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1217 | - elseif ($percent == 0) |
|
| 1218 | - return $langs->trans('StatusActionToDo') . ' (0%) ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1219 | - elseif ($percent > 0 && $percent < 100) |
|
| 1220 | - return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%) ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1221 | - elseif ($percent >= 100) |
|
| 1222 | - return $langs->trans('StatusActionDone') . ' (100%) ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1223 | - } |
|
| 1224 | - elseif ($mode == 7) { |
|
| 1225 | - if ($percent == -1 && !$hidenastatus) |
|
| 1226 | - return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1227 | - elseif ($percent == 0) |
|
| 1228 | - return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1229 | - elseif ($percent > 0 && $percent < 100) |
|
| 1230 | - return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1231 | - elseif ($percent >= 100) |
|
| 1232 | - return img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1209 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1210 | + return $langs->trans('StatusNotApplicable'); |
|
| 1211 | + } elseif ($percent == 0) { |
|
| 1212 | + return $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1213 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1214 | + return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1215 | + } elseif ($percent >= 100) { |
|
| 1216 | + return $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1217 | + } |
|
| 1218 | + } elseif ($mode == 1) { |
|
| 1219 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1220 | + return $langs->trans('StatusNotApplicable'); |
|
| 1221 | + } elseif ($percent == 0) { |
|
| 1222 | + return $langs->trans('StatusActionToDo'); |
|
| 1223 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1224 | + return $percent . '%'; |
|
| 1225 | + } elseif ($percent >= 100) { |
|
| 1226 | + return $langs->trans('StatusActionDone'); |
|
| 1227 | + } |
|
| 1228 | + } elseif ($mode == 2) { |
|
| 1229 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1230 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1231 | + } elseif ($percent == 0) { |
|
| 1232 | + return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo'); |
|
| 1233 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1234 | + return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $percent . '%'; |
|
| 1235 | + } elseif ($percent >= 100) { |
|
| 1236 | + return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone'); |
|
| 1237 | + } |
|
| 1238 | + } elseif ($mode == 3) { |
|
| 1239 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1240 | + return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1241 | + } elseif ($percent == 0) { |
|
| 1242 | + return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionToDo') . ' (0%)', 'statut1'); |
|
| 1243 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1244 | + return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)', 'statut3'); |
|
| 1245 | + } elseif ($percent >= 100) { |
|
| 1246 | + return img_picto($langs->trans("Status") . ': ' . $langs->trans('StatusActionDone') . ' (100%)', 'statut6'); |
|
| 1247 | + } |
|
| 1248 | + } elseif ($mode == 4) { |
|
| 1249 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1250 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9') . ' ' . $langs->trans('StatusNotApplicable'); |
|
| 1251 | + } elseif ($percent == 0) { |
|
| 1252 | + return img_picto($langs->trans('StatusActionToDo'), 'statut1') . ' ' . $langs->trans('StatusActionToDo') . ' (0%)'; |
|
| 1253 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1254 | + return img_picto($langs->trans('StatusActionInProcess'), 'statut3') . ' ' . $langs->trans('StatusActionInProcess') . ' (' . $percent . '%)'; |
|
| 1255 | + } elseif ($percent >= 100) { |
|
| 1256 | + return img_picto($langs->trans('StatusActionDone'), 'statut6') . ' ' . $langs->trans('StatusActionDone') . ' (100%)'; |
|
| 1257 | + } |
|
| 1258 | + } elseif ($mode == 5) { |
|
| 1259 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1260 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1261 | + } elseif ($percent == 0) { |
|
| 1262 | + return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1263 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1264 | + return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1265 | + } elseif ($percent >= 100) { |
|
| 1266 | + return $langs->trans('StatusActionDone') . ' ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1267 | + } |
|
| 1268 | + } elseif ($mode == 6) { |
|
| 1269 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1270 | + return $langs->trans('StatusNotApplicable') . ' ' . img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1271 | + } elseif ($percent == 0) { |
|
| 1272 | + return $langs->trans('StatusActionToDo') . ' (0%) ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1273 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1274 | + return $langs->trans('StatusActionInProcess') . ' (' . $percent . '%) ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1275 | + } elseif ($percent >= 100) { |
|
| 1276 | + return $langs->trans('StatusActionDone') . ' (100%) ' . img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1277 | + } |
|
| 1278 | + } elseif ($mode == 7) { |
|
| 1279 | + if ($percent == -1 && !$hidenastatus) { |
|
| 1280 | + return img_picto($langs->trans('StatusNotApplicable'), 'statut9'); |
|
| 1281 | + } elseif ($percent == 0) { |
|
| 1282 | + return '0% ' . img_picto($langs->trans('StatusActionToDo'), 'statut1'); |
|
| 1283 | + } elseif ($percent > 0 && $percent < 100) { |
|
| 1284 | + return $percent . '% ' . img_picto($langs->trans('StatusActionInProcess') . ' - ' . $percent . '%', 'statut3'); |
|
| 1285 | + } elseif ($percent >= 100) { |
|
| 1286 | + return img_picto($langs->trans('StatusActionDone'), 'statut6'); |
|
| 1287 | + } |
|
| 1233 | 1288 | } |
| 1234 | 1289 | |
| 1235 | 1290 | return ''; |
@@ -1252,15 +1307,20 @@ discard block |
||
| 1252 | 1307 | { |
| 1253 | 1308 | global $conf, $langs, $user, $hookmanager, $action; |
| 1254 | 1309 | |
| 1255 | - if (!empty($conf->dol_no_mouse_hover)) |
|
| 1256 | - $notooltip = 1; // Force disable tooltips |
|
| 1310 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 1311 | + $notooltip = 1; |
|
| 1312 | + } |
|
| 1313 | + // Force disable tooltips |
|
| 1257 | 1314 | |
| 1258 | - if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) |
|
| 1259 | - $option = 'nolink'; |
|
| 1315 | + if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id)) { |
|
| 1316 | + $option = 'nolink'; |
|
| 1317 | + } |
|
| 1260 | 1318 | |
| 1261 | 1319 | $label = $this->label; |
| 1262 | - if (empty($label)) |
|
| 1263 | - $label = $this->libelle; // For backward compatibility |
|
| 1320 | + if (empty($label)) { |
|
| 1321 | + $label = $this->libelle; |
|
| 1322 | + } |
|
| 1323 | + // For backward compatibility |
|
| 1264 | 1324 | |
| 1265 | 1325 | $result = ''; |
| 1266 | 1326 | |
@@ -1270,24 +1330,31 @@ discard block |
||
| 1270 | 1330 | $labeltype = ($langs->transnoentities("Action" . $this->type_code) != "Action" . $this->type_code) ? $langs->transnoentities("Action" . $this->type_code) : $this->type_label; |
| 1271 | 1331 | } |
| 1272 | 1332 | if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { |
| 1273 | - if ($this->type_code != 'AC_OTH_AUTO') |
|
| 1274 | - $labeltype = $langs->trans('ActionAC_MANUAL'); |
|
| 1333 | + if ($this->type_code != 'AC_OTH_AUTO') { |
|
| 1334 | + $labeltype = $langs->trans('ActionAC_MANUAL'); |
|
| 1335 | + } |
|
| 1275 | 1336 | } |
| 1276 | 1337 | |
| 1277 | 1338 | $tooltip = '<u>' . $langs->trans('ShowAction') . '</u>'; |
| 1278 | - if (!empty($this->ref)) |
|
| 1279 | - $tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1280 | - if (!empty($label)) |
|
| 1281 | - $tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label; |
|
| 1282 | - if (!empty($labeltype)) |
|
| 1283 | - $tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype; |
|
| 1284 | - if (!empty($this->location)) |
|
| 1285 | - $tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location; |
|
| 1286 | - if (!empty($this->note)) |
|
| 1287 | - $tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . $this->note; |
|
| 1339 | + if (!empty($this->ref)) { |
|
| 1340 | + $tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1341 | + } |
|
| 1342 | + if (!empty($label)) { |
|
| 1343 | + $tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label; |
|
| 1344 | + } |
|
| 1345 | + if (!empty($labeltype)) { |
|
| 1346 | + $tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype; |
|
| 1347 | + } |
|
| 1348 | + if (!empty($this->location)) { |
|
| 1349 | + $tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location; |
|
| 1350 | + } |
|
| 1351 | + if (!empty($this->note)) { |
|
| 1352 | + $tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . $this->note; |
|
| 1353 | + } |
|
| 1288 | 1354 | $linkclose = ''; |
| 1289 | - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) |
|
| 1290 | - $linkclose = ' style="background-color:#' . $this->type_color . '"'; |
|
| 1355 | + if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) { |
|
| 1356 | + $linkclose = ' style="background-color:#' . $this->type_color . '"'; |
|
| 1357 | + } |
|
| 1291 | 1358 | |
| 1292 | 1359 | if (empty($notooltip)) { |
| 1293 | 1360 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
@@ -1303,21 +1370,25 @@ discard block |
||
| 1303 | 1370 | $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
| 1304 | 1371 | $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); |
| 1305 | 1372 | */ |
| 1306 | - } else |
|
| 1307 | - $linkclose .= ' class="' . $classname . '"'; |
|
| 1373 | + } else { |
|
| 1374 | + $linkclose .= ' class="' . $classname . '"'; |
|
| 1375 | + } |
|
| 1308 | 1376 | |
| 1309 | 1377 | $url = ''; |
| 1310 | - if ($option == 'birthday') |
|
| 1311 | - $url = DOL_URL_ROOT . '/contact/perso.php?id=' . $this->id; |
|
| 1312 | - else |
|
| 1313 | - $url = DOL_URL_ROOT . '/comm/action/card.php?id=' . $this->id; |
|
| 1378 | + if ($option == 'birthday') { |
|
| 1379 | + $url = DOL_URL_ROOT . '/contact/perso.php?id=' . $this->id; |
|
| 1380 | + } else { |
|
| 1381 | + $url = DOL_URL_ROOT . '/comm/action/card.php?id=' . $this->id; |
|
| 1382 | + } |
|
| 1314 | 1383 | if ($option !== 'nolink') { |
| 1315 | 1384 | // Add param to save lastsearch_values or not |
| 1316 | 1385 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 1317 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) |
|
| 1318 | - $add_save_lastsearch_values = 1; |
|
| 1319 | - if ($add_save_lastsearch_values) |
|
| 1320 | - $url .= '&save_lastsearch_values=1'; |
|
| 1386 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 1387 | + $add_save_lastsearch_values = 1; |
|
| 1388 | + } |
|
| 1389 | + if ($add_save_lastsearch_values) { |
|
| 1390 | + $url .= '&save_lastsearch_values=1'; |
|
| 1391 | + } |
|
| 1321 | 1392 | } |
| 1322 | 1393 | |
| 1323 | 1394 | $linkstart = '<a href="' . $url . '"'; |
@@ -1332,18 +1403,20 @@ discard block |
||
| 1332 | 1403 | |
| 1333 | 1404 | if ($withpicto == 2) { |
| 1334 | 1405 | $libelle = $label; |
| 1335 | - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) |
|
| 1336 | - $libelle = $labeltype; |
|
| 1406 | + if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { |
|
| 1407 | + $libelle = $labeltype; |
|
| 1408 | + } |
|
| 1337 | 1409 | $libelleshort = ''; |
| 1338 | - } |
|
| 1339 | - else { |
|
| 1410 | + } else { |
|
| 1340 | 1411 | $libelle = (empty($this->libelle) ? $label : $this->libelle . (($label && $label != $this->libelle) ? ' ' . $label : '')); |
| 1341 | - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) |
|
| 1342 | - $libelle = $labeltype; |
|
| 1343 | - if ($maxlength < 0) |
|
| 1344 | - $libelleshort = $this->ref; |
|
| 1345 | - else |
|
| 1346 | - $libelleshort = dol_trunc($libelle, $maxlength); |
|
| 1412 | + if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) { |
|
| 1413 | + $libelle = $labeltype; |
|
| 1414 | + } |
|
| 1415 | + if ($maxlength < 0) { |
|
| 1416 | + $libelleshort = $this->ref; |
|
| 1417 | + } else { |
|
| 1418 | + $libelleshort = dol_trunc($libelle, $maxlength); |
|
| 1419 | + } |
|
| 1347 | 1420 | } |
| 1348 | 1421 | |
| 1349 | 1422 | if ($withpicto) { |
@@ -1355,8 +1428,9 @@ discard block |
||
| 1355 | 1428 | } |
| 1356 | 1429 | |
| 1357 | 1430 | $result .= $linkstart; |
| 1358 | - if ($withpicto) |
|
| 1359 | - $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction") . ': ' . $libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'valigntextbottom"' : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip valigntextbottom"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1431 | + if ($withpicto) { |
|
| 1432 | + $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction") . ': ' . $libelle), ($overwritepicto ? $overwritepicto : 'action'), ($notooltip ? 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'valigntextbottom"' : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip valigntextbottom"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1433 | + } |
|
| 1360 | 1434 | $result .= $libelleshort; |
| 1361 | 1435 | $result .= $linkend; |
| 1362 | 1436 | |
@@ -1364,10 +1438,11 @@ discard block |
||
| 1364 | 1438 | $hookmanager->initHooks(array('actiondao')); |
| 1365 | 1439 | $parameters = array('id' => $this->id, 'getnomurl' => $result); |
| 1366 | 1440 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1367 | - if ($reshook > 0) |
|
| 1368 | - $result = $hookmanager->resPrint; |
|
| 1369 | - else |
|
| 1370 | - $result .= $hookmanager->resPrint; |
|
| 1441 | + if ($reshook > 0) { |
|
| 1442 | + $result = $hookmanager->resPrint; |
|
| 1443 | + } else { |
|
| 1444 | + $result .= $hookmanager->resPrint; |
|
| 1445 | + } |
|
| 1371 | 1446 | |
| 1372 | 1447 | return $result; |
| 1373 | 1448 | } |
@@ -1395,14 +1470,16 @@ discard block |
||
| 1395 | 1470 | dol_syslog(get_class($this) . "::build_exportfile Build export file format=" . $format . ", type=" . $type . ", cachedelay=" . $cachedelay . ", filename=" . $filename . ", filters size=" . count($filters), LOG_DEBUG); |
| 1396 | 1471 | |
| 1397 | 1472 | // Check parameters |
| 1398 | - if (empty($format)) |
|
| 1399 | - return -1; |
|
| 1473 | + if (empty($format)) { |
|
| 1474 | + return -1; |
|
| 1475 | + } |
|
| 1400 | 1476 | |
| 1401 | 1477 | // Clean parameters |
| 1402 | 1478 | if (!$filename) { |
| 1403 | 1479 | $extension = 'vcs'; |
| 1404 | - if ($format == 'ical') |
|
| 1405 | - $extension = 'ics'; |
|
| 1480 | + if ($format == 'ical') { |
|
| 1481 | + $extension = 'ics'; |
|
| 1482 | + } |
|
| 1406 | 1483 | $filename = $format . '.' . $extension; |
| 1407 | 1484 | } |
| 1408 | 1485 | |
@@ -1452,30 +1529,40 @@ discard block |
||
| 1452 | 1529 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export |
| 1453 | 1530 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s on s.rowid = a.fk_soc"; |
| 1454 | 1531 | // We must filter on assignement table |
| 1455 | - if ($filters['logint']) |
|
| 1456 | - $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 1532 | + if ($filters['logint']) { |
|
| 1533 | + $sql .= ", " . MAIN_DB_PREFIX . "actioncomm_resources as ar"; |
|
| 1534 | + } |
|
| 1457 | 1535 | $sql .= " WHERE a.fk_action=c.id"; |
| 1458 | 1536 | $sql .= " AND a.entity IN (" . getEntity('agenda') . ")"; |
| 1459 | 1537 | foreach ($filters as $key => $value) { |
| 1460 | - if ($key == 'notolderthan' && $value != '') |
|
| 1461 | - $sql .= " AND a.datep >= '" . $this->db->idate($now - ($value * 24 * 60 * 60)) . "'"; |
|
| 1462 | - if ($key == 'year') |
|
| 1463 | - $sql .= " AND a.datep BETWEEN '" . $this->db->idate(dol_get_first_day($value, 1)) . "' AND '" . $this->db->idate(dol_get_last_day($value, 12)) . "'"; |
|
| 1464 | - if ($key == 'id') |
|
| 1465 | - $sql .= " AND a.id=" . (is_numeric($value) ? $value : 0); |
|
| 1466 | - if ($key == 'idfrom') |
|
| 1467 | - $sql .= " AND a.id >= " . (is_numeric($value) ? $value : 0); |
|
| 1468 | - if ($key == 'idto') |
|
| 1469 | - $sql .= " AND a.id <= " . (is_numeric($value) ? $value : 0); |
|
| 1470 | - if ($key == 'project') |
|
| 1471 | - $sql .= " AND a.fk_project=" . (is_numeric($value) ? $value : 0); |
|
| 1472 | - if ($key == 'actiontype') |
|
| 1473 | - $sql .= " AND c.type = '" . $this->db->escape($value) . "'"; |
|
| 1474 | - if ($key == 'notactiontype') |
|
| 1475 | - $sql .= " AND c.type <> '" . $this->db->escape($value) . "'"; |
|
| 1538 | + if ($key == 'notolderthan' && $value != '') { |
|
| 1539 | + $sql .= " AND a.datep >= '" . $this->db->idate($now - ($value * 24 * 60 * 60)) . "'"; |
|
| 1540 | + } |
|
| 1541 | + if ($key == 'year') { |
|
| 1542 | + $sql .= " AND a.datep BETWEEN '" . $this->db->idate(dol_get_first_day($value, 1)) . "' AND '" . $this->db->idate(dol_get_last_day($value, 12)) . "'"; |
|
| 1543 | + } |
|
| 1544 | + if ($key == 'id') { |
|
| 1545 | + $sql .= " AND a.id=" . (is_numeric($value) ? $value : 0); |
|
| 1546 | + } |
|
| 1547 | + if ($key == 'idfrom') { |
|
| 1548 | + $sql .= " AND a.id >= " . (is_numeric($value) ? $value : 0); |
|
| 1549 | + } |
|
| 1550 | + if ($key == 'idto') { |
|
| 1551 | + $sql .= " AND a.id <= " . (is_numeric($value) ? $value : 0); |
|
| 1552 | + } |
|
| 1553 | + if ($key == 'project') { |
|
| 1554 | + $sql .= " AND a.fk_project=" . (is_numeric($value) ? $value : 0); |
|
| 1555 | + } |
|
| 1556 | + if ($key == 'actiontype') { |
|
| 1557 | + $sql .= " AND c.type = '" . $this->db->escape($value) . "'"; |
|
| 1558 | + } |
|
| 1559 | + if ($key == 'notactiontype') { |
|
| 1560 | + $sql .= " AND c.type <> '" . $this->db->escape($value) . "'"; |
|
| 1561 | + } |
|
| 1476 | 1562 | // We must filter on assignement table |
| 1477 | - if ($key == 'logint') |
|
| 1478 | - $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 1563 | + if ($key == 'logint') { |
|
| 1564 | + $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; |
|
| 1565 | + } |
|
| 1479 | 1566 | if ($key == 'logina') { |
| 1480 | 1567 | $logina = $value; |
| 1481 | 1568 | $condition = '='; |
@@ -1485,10 +1572,11 @@ discard block |
||
| 1485 | 1572 | } |
| 1486 | 1573 | $userforfilter = new User($this->db); |
| 1487 | 1574 | $result = $userforfilter->fetch('', $logina); |
| 1488 | - if ($result > 0) |
|
| 1489 | - $sql .= " AND a.fk_user_author " . $condition . " " . $userforfilter->id; |
|
| 1490 | - elseif ($result < 0 || $condition == '=') |
|
| 1491 | - $sql .= " AND a.fk_user_author = 0"; |
|
| 1575 | + if ($result > 0) { |
|
| 1576 | + $sql .= " AND a.fk_user_author " . $condition . " " . $userforfilter->id; |
|
| 1577 | + } elseif ($result < 0 || $condition == '=') { |
|
| 1578 | + $sql .= " AND a.fk_user_author = 0"; |
|
| 1579 | + } |
|
| 1492 | 1580 | } |
| 1493 | 1581 | if ($key == 'logint') { |
| 1494 | 1582 | $logint = $value; |
@@ -1499,10 +1587,11 @@ discard block |
||
| 1499 | 1587 | } |
| 1500 | 1588 | $userforfilter = new User($this->db); |
| 1501 | 1589 | $result = $userforfilter->fetch('', $logint); |
| 1502 | - if ($result > 0) |
|
| 1503 | - $sql .= " AND ar.fk_element = " . $userforfilter->id; |
|
| 1504 | - elseif ($result < 0 || $condition == '=') |
|
| 1505 | - $sql .= " AND ar.fk_element = 0"; |
|
| 1590 | + if ($result > 0) { |
|
| 1591 | + $sql .= " AND ar.fk_element = " . $userforfilter->id; |
|
| 1592 | + } elseif ($result < 0 || $condition == '=') { |
|
| 1593 | + $sql .= " AND ar.fk_element = 0"; |
|
| 1594 | + } |
|
| 1506 | 1595 | } |
| 1507 | 1596 | } |
| 1508 | 1597 | $sql .= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import |
@@ -1560,14 +1649,18 @@ discard block |
||
| 1560 | 1649 | |
| 1561 | 1650 | // Define title and desc |
| 1562 | 1651 | $more = ''; |
| 1563 | - if ($login) |
|
| 1564 | - $more = $langs->transnoentities("User") . ' ' . $login; |
|
| 1565 | - if ($logina) |
|
| 1566 | - $more = $langs->transnoentities("ActionsAskedBy") . ' ' . $logina; |
|
| 1567 | - if ($logint) |
|
| 1568 | - $more = $langs->transnoentities("ActionsToDoBy") . ' ' . $logint; |
|
| 1569 | - if ($logind) |
|
| 1570 | - $more = $langs->transnoentities("ActionsDoneBy") . ' ' . $logind; |
|
| 1652 | + if ($login) { |
|
| 1653 | + $more = $langs->transnoentities("User") . ' ' . $login; |
|
| 1654 | + } |
|
| 1655 | + if ($logina) { |
|
| 1656 | + $more = $langs->transnoentities("ActionsAskedBy") . ' ' . $logina; |
|
| 1657 | + } |
|
| 1658 | + if ($logint) { |
|
| 1659 | + $more = $langs->transnoentities("ActionsToDoBy") . ' ' . $logint; |
|
| 1660 | + } |
|
| 1661 | + if ($logind) { |
|
| 1662 | + $more = $langs->transnoentities("ActionsDoneBy") . ' ' . $logind; |
|
| 1663 | + } |
|
| 1571 | 1664 | if ($more) { |
| 1572 | 1665 | $title = 'Dolibarr actions ' . $mysoc->name . ' - ' . $more; |
| 1573 | 1666 | $desc = $more; |
@@ -1583,17 +1676,18 @@ discard block |
||
| 1583 | 1676 | @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); |
| 1584 | 1677 | |
| 1585 | 1678 | // Write file |
| 1586 | - if ($format == 'vcal') |
|
| 1587 | - $result = build_calfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1588 | - elseif ($format == 'ical') |
|
| 1589 | - $result = build_calfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1590 | - elseif ($format == 'rss') |
|
| 1591 | - $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1679 | + if ($format == 'vcal') { |
|
| 1680 | + $result = build_calfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1681 | + } elseif ($format == 'ical') { |
|
| 1682 | + $result = build_calfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1683 | + } elseif ($format == 'rss') { |
|
| 1684 | + $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp); |
|
| 1685 | + } |
|
| 1592 | 1686 | |
| 1593 | 1687 | if ($result >= 0) { |
| 1594 | - if (dol_move($outputfiletmp, $outputfile, 0, 1)) |
|
| 1595 | - $result = 1; |
|
| 1596 | - else { |
|
| 1688 | + if (dol_move($outputfiletmp, $outputfile, 0, 1)) { |
|
| 1689 | + $result = 1; |
|
| 1690 | + } else { |
|
| 1597 | 1691 | $this->error = 'Failed to rename ' . $outputfiletmp . ' into ' . $outputfile; |
| 1598 | 1692 | dol_syslog(get_class($this) . "::build_exportfile " . $this->error, LOG_ERR); |
| 1599 | 1693 | dol_delete_file($outputfiletmp, 0, 1); |