Fixing style errors.

This commit is contained in:
stickler-ci 2022-01-28 22:03:08 +00:00
parent a8dd73d007
commit a8344d9059
3 changed files with 84 additions and 84 deletions

View File

@ -254,7 +254,7 @@ class Projects extends DolibarrApi
$timespent = $line->getSummaryOfTimeSpent(0); $timespent = $line->getSummaryOfTimeSpent(0);
} }
if ($includetimespent == 2) { if ($includetimespent == 2) {
$timespent = $line->fetchTimeSpentOnTask(); $timespent = $line->fetchTimeSpentOnTask();
} }
array_push($result, $this->_cleanObjectDatas($line)); array_push($result, $this->_cleanObjectDatas($line));
} }

View File

@ -84,7 +84,7 @@ class Tasks extends DolibarrApi
$timespent = $this->task->getSummaryOfTimeSpent(0); $timespent = $this->task->getSummaryOfTimeSpent(0);
} }
if ($includetimespent == 2) { if ($includetimespent == 2) {
$timespent = $this->task->fetchTimeSpentOnTask(); $timespent = $this->task->fetchTimeSpentOnTask();
} }
return $this->_cleanObjectDatas($this->task); return $this->_cleanObjectDatas($this->task);

View File

@ -1280,7 +1280,7 @@ class Task extends CommonObject
} }
return $ret; return $ret;
} }
/** /**
* Fetch records of time spent of this task * Fetch records of time spent of this task
* *
@ -1289,88 +1289,88 @@ class Task extends CommonObject
*/ */
public function fetchTimeSpentOnTask($morewherefilter = '') public function fetchTimeSpentOnTask($morewherefilter = '')
{ {
global $langs; global $langs;
$arrayres = array(); $arrayres = array();
$sql = "SELECT"; $sql = "SELECT";
$sql .= " s.rowid as socid,"; $sql .= " s.rowid as socid,";
$sql .= " s.nom as thirdparty_name,"; $sql .= " s.nom as thirdparty_name,";
$sql .= " s.email as thirdparty_email,"; $sql .= " s.email as thirdparty_email,";
$sql .= " ptt.rowid,"; $sql .= " ptt.rowid,";
$sql .= " ptt.fk_task,"; $sql .= " ptt.fk_task,";
$sql .= " ptt.task_date,"; $sql .= " ptt.task_date,";
$sql .= " ptt.task_datehour,"; $sql .= " ptt.task_datehour,";
$sql .= " ptt.task_date_withhour,"; $sql .= " ptt.task_date_withhour,";
$sql .= " ptt.task_duration,"; $sql .= " ptt.task_duration,";
$sql .= " ptt.fk_user,"; $sql .= " ptt.fk_user,";
$sql .= " ptt.note,"; $sql .= " ptt.note,";
$sql .= " ptt.thm,"; $sql .= " ptt.thm,";
$sql .= " pt.rowid as task_id,"; $sql .= " pt.rowid as task_id,";
$sql .= " pt.ref as task_ref,"; $sql .= " pt.ref as task_ref,";
$sql .= " pt.label as task_label,"; $sql .= " pt.label as task_label,";
$sql .= " p.rowid as project_id,"; $sql .= " p.rowid as project_id,";
$sql .= " p.ref as project_ref,"; $sql .= " p.ref as project_ref,";
$sql .= " p.title as project_label,"; $sql .= " p.title as project_label,";
$sql .= " p.public as public"; $sql .= " p.public as public";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
$sql .= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid"; $sql .= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid";
$sql .= " AND pt.rowid = ".((int) $this->id); $sql .= " AND pt.rowid = ".((int) $this->id);
$sql .= " AND pt.entity IN (".getEntity('project').")"; $sql .= " AND pt.entity IN (".getEntity('project').")";
if ($morewherefilter) { if ($morewherefilter) {
$sql .= $morewherefilter; $sql .= $morewherefilter;
} }
dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$newobj = new stdClass(); $newobj = new stdClass();
$newobj->socid = $obj->socid; $newobj->socid = $obj->socid;
$newobj->thirdparty_name = $obj->thirdparty_name; $newobj->thirdparty_name = $obj->thirdparty_name;
$newobj->thirdparty_email = $obj->thirdparty_email; $newobj->thirdparty_email = $obj->thirdparty_email;
$newobj->fk_project = $obj->project_id; $newobj->fk_project = $obj->project_id;
$newobj->project_ref = $obj->project_ref; $newobj->project_ref = $obj->project_ref;
$newobj->project_label = $obj->project_label; $newobj->project_label = $obj->project_label;
$newobj->public = $obj->project_public; $newobj->public = $obj->project_public;
$newobj->fk_task = $obj->task_id; $newobj->fk_task = $obj->task_id;
$newobj->task_ref = $obj->task_ref; $newobj->task_ref = $obj->task_ref;
$newobj->task_label = $obj->task_label; $newobj->task_label = $obj->task_label;
$newobj->timespent_line_id = $obj->rowid; $newobj->timespent_line_id = $obj->rowid;
$newobj->timespent_line_date = $this->db->jdate($obj->task_date); $newobj->timespent_line_date = $this->db->jdate($obj->task_date);
$newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour); $newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour);
$newobj->timespent_line_withhour = $obj->task_date_withhour; $newobj->timespent_line_withhour = $obj->task_date_withhour;
$newobj->timespent_line_duration = $obj->task_duration; $newobj->timespent_line_duration = $obj->task_duration;
$newobj->timespent_line_fk_user = $obj->fk_user; $newobj->timespent_line_fk_user = $obj->fk_user;
$newobj->timespent_line_thm = $obj->thm; // hourly rate $newobj->timespent_line_thm = $obj->thm; // hourly rate
$newobj->timespent_line_note = $obj->note; $newobj->timespent_line_note = $obj->note;
$arrayres[] = $newobj; $arrayres[] = $newobj;
$i++; $i++;
} }
$this->db->free($resql); $this->db->free($resql);
$this->lines = $arrayres; $this->lines = $arrayres;
return 1; return 1;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
return -1; return -1;
} }
} }
/** /**
* Calculate total of time spent for task * Calculate total of time spent for task