From a8344d9059bfd76e74a15bdb53b5aa68c602e5b0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 28 Jan 2022 22:03:08 +0000 Subject: [PATCH] Fixing style errors. --- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/projet/class/api_tasks.class.php | 2 +- htdocs/projet/class/task.class.php | 164 ++++++++++----------- 3 files changed, 84 insertions(+), 84 deletions(-) diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 880a087d10c..59576b961d4 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -254,7 +254,7 @@ class Projects extends DolibarrApi $timespent = $line->getSummaryOfTimeSpent(0); } if ($includetimespent == 2) { - $timespent = $line->fetchTimeSpentOnTask(); + $timespent = $line->fetchTimeSpentOnTask(); } array_push($result, $this->_cleanObjectDatas($line)); } diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 21b5e49f44e..cafb60f2865 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -84,7 +84,7 @@ class Tasks extends DolibarrApi $timespent = $this->task->getSummaryOfTimeSpent(0); } if ($includetimespent == 2) { - $timespent = $this->task->fetchTimeSpentOnTask(); + $timespent = $this->task->fetchTimeSpentOnTask(); } return $this->_cleanObjectDatas($this->task); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 0254be49ef6..0656fd0bf96 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1280,7 +1280,7 @@ class Task extends CommonObject } return $ret; } - + /** * Fetch records of time spent of this task * @@ -1289,88 +1289,88 @@ class Task extends CommonObject */ public function fetchTimeSpentOnTask($morewherefilter = '') { - global $langs; - - $arrayres = array(); - - $sql = "SELECT"; - $sql .= " s.rowid as socid,"; - $sql .= " s.nom as thirdparty_name,"; - $sql .= " s.email as thirdparty_email,"; - $sql .= " ptt.rowid,"; - $sql .= " ptt.fk_task,"; - $sql .= " ptt.task_date,"; - $sql .= " ptt.task_datehour,"; - $sql .= " ptt.task_date_withhour,"; - $sql .= " ptt.task_duration,"; - $sql .= " ptt.fk_user,"; - $sql .= " ptt.note,"; - $sql .= " ptt.thm,"; - $sql .= " pt.rowid as task_id,"; - $sql .= " pt.ref as task_ref,"; - $sql .= " pt.label as task_label,"; - $sql .= " p.rowid as project_id,"; - $sql .= " p.ref as project_ref,"; - $sql .= " p.title as project_label,"; - $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 .= " 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 .= " AND pt.rowid = ".((int) $this->id); - $sql .= " AND pt.entity IN (".getEntity('project').")"; - if ($morewherefilter) { - $sql .= $morewherefilter; - } - - dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - - $newobj = new stdClass(); - - $newobj->socid = $obj->socid; - $newobj->thirdparty_name = $obj->thirdparty_name; - $newobj->thirdparty_email = $obj->thirdparty_email; - - $newobj->fk_project = $obj->project_id; - $newobj->project_ref = $obj->project_ref; - $newobj->project_label = $obj->project_label; - $newobj->public = $obj->project_public; - - $newobj->fk_task = $obj->task_id; - $newobj->task_ref = $obj->task_ref; - $newobj->task_label = $obj->task_label; - - $newobj->timespent_line_id = $obj->rowid; - $newobj->timespent_line_date = $this->db->jdate($obj->task_date); - $newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour); - $newobj->timespent_line_withhour = $obj->task_date_withhour; - $newobj->timespent_line_duration = $obj->task_duration; - $newobj->timespent_line_fk_user = $obj->fk_user; - $newobj->timespent_line_thm = $obj->thm; // hourly rate - $newobj->timespent_line_note = $obj->note; - - $arrayres[] = $newobj; - - $i++; - } - - $this->db->free($resql); - - $this->lines = $arrayres; - return 1; - } else { - dol_print_error($this->db); - $this->error = "Error ".$this->db->lasterror(); - return -1; - } + global $langs; + + $arrayres = array(); + + $sql = "SELECT"; + $sql .= " s.rowid as socid,"; + $sql .= " s.nom as thirdparty_name,"; + $sql .= " s.email as thirdparty_email,"; + $sql .= " ptt.rowid,"; + $sql .= " ptt.fk_task,"; + $sql .= " ptt.task_date,"; + $sql .= " ptt.task_datehour,"; + $sql .= " ptt.task_date_withhour,"; + $sql .= " ptt.task_duration,"; + $sql .= " ptt.fk_user,"; + $sql .= " ptt.note,"; + $sql .= " ptt.thm,"; + $sql .= " pt.rowid as task_id,"; + $sql .= " pt.ref as task_ref,"; + $sql .= " pt.label as task_label,"; + $sql .= " p.rowid as project_id,"; + $sql .= " p.ref as project_ref,"; + $sql .= " p.title as project_label,"; + $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 .= " 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 .= " AND pt.rowid = ".((int) $this->id); + $sql .= " AND pt.entity IN (".getEntity('project').")"; + if ($morewherefilter) { + $sql .= $morewherefilter; + } + + dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $newobj = new stdClass(); + + $newobj->socid = $obj->socid; + $newobj->thirdparty_name = $obj->thirdparty_name; + $newobj->thirdparty_email = $obj->thirdparty_email; + + $newobj->fk_project = $obj->project_id; + $newobj->project_ref = $obj->project_ref; + $newobj->project_label = $obj->project_label; + $newobj->public = $obj->project_public; + + $newobj->fk_task = $obj->task_id; + $newobj->task_ref = $obj->task_ref; + $newobj->task_label = $obj->task_label; + + $newobj->timespent_line_id = $obj->rowid; + $newobj->timespent_line_date = $this->db->jdate($obj->task_date); + $newobj->timespent_line_datehour = $this->db->jdate($obj->task_datehour); + $newobj->timespent_line_withhour = $obj->task_date_withhour; + $newobj->timespent_line_duration = $obj->task_duration; + $newobj->timespent_line_fk_user = $obj->fk_user; + $newobj->timespent_line_thm = $obj->thm; // hourly rate + $newobj->timespent_line_note = $obj->note; + + $arrayres[] = $newobj; + + $i++; + } + + $this->db->free($resql); + + $this->lines = $arrayres; + return 1; + } else { + dol_print_error($this->db); + $this->error = "Error ".$this->db->lasterror(); + return -1; + } } - + /** * Calculate total of time spent for task