diff --git a/view/timespent_list.php b/view/timespent_list.php index 07b9bce..58e604e 100644 --- a/view/timespent_list.php +++ b/view/timespent_list.php @@ -119,14 +119,19 @@ 'p.rowid' => array('fieldalias' => 'projectid', 'type'=> 'text', 'label' => "ProjectId", 'visible' => 0), 'pt.rowid' => array('fieldalias' => 'taskid', 'type' => 'Task:projet/class/task.class.php:1', 'label' => "Task", 'checked' => 1, 'position' => 30, 'visible' => 1), 'label' => array('tablealias' => 'pt.', 'type' => 'text', 'label' => "Label", 'checked' => 1, 'position' => 40, 'visible' => 1), - 'task_date' => array('tablealias' => 'ptt.', 'type' => 'datetime', 'label' => "Date", 'checked' => 1, 'position' => 50, 'visible' => 1), - 'fk_user' => array('tablealias' => 'ptt.', 'fieldalias' => 'fk_user', 'type' => 'User:user/class/user.class.php', 'label' => "User", 'checked' => 1, 'position' => 60, 'visible' => 1), - 'task_duration' => array('tablealias' => 'ptt.', 'type' => 'duration', 'label' => "Duration", 'checked' => 1, 'position' => 70, 'visible' => 1, 'isameasure'=>1), + 'fk_user' => array('tablealias' => 'ptt.', 'fieldalias' => 'fk_user', 'type' => 'User:user/class/user.class.php:1:(t.employee:=:1) AND (t.fk_soc:IS:NULL) AND (statut:=:1)', 'label' => "User", 'checked' => 1, 'position' => 60, 'visible' => 1), 'note' => array('tablealias' => 'ptt.', 'type' => 'text', 'label' => "Note", 'checked' => 1, 'position' => 80, 'visible' => 1), 'thm' => array('tablealias' => 'ptt.', 'type' => 'price', 'label' => "Value", 'checked' => 1, 'position' => 90, 'visible' => 1, 'isameasure'=>1), 'invoice_id' => array('tablealias' => 'ptt.', 'fieldalias' => 'invoice_id', 'type' => 'Facture:compta/facture/class/facture.class.php:1', 'label' => "Facture", 'checked' => 1, 'position' => 100, 'visible' => 1), 'ts.rowid' => array('fieldalias' => 'timesheetid', 'type' => 'TimeSheet:custom/dolisirh/class/timesheet.class.php:1', 'label' => "TimeSheet", 'checked' => 1, 'position' => 110, 'visible' => 1), ); +if ($versionEighteenOrMore) { + $arrayfields['element_date'] = array('tablealias' => 'ptt.', 'type' => 'datetime', 'label' => "Date", 'checked' => 1, 'position' => 50, 'visible' => 1); + $arrayfields['element_duration'] = array('tablealias' => 'ptt.', 'type' => 'duration', 'label' => "Duration", 'checked' => 1, 'position' => 70, 'visible' => 1, 'isameasure'=>1); +} else { + $arrayfields['task_date'] = array('tablealias' => 'ptt.', 'type' => 'datetime', 'label' => "Date", 'checked' => 1, 'position' => 50, 'visible' => 1); + $arrayfields['task_duration'] = array('tablealias' => 'ptt.', 'type' => 'duration', 'label' => "Duration", 'checked' => 1, 'position' => 70, 'visible' => 1, 'isameasure'=>1); +} // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { @@ -248,7 +253,7 @@ $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'projet_task as pt ON p.rowid = pt.fk_projet'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'projet_task_extrafields as ef ON pt.rowid = ef.fk_object'; if ($versionEighteenOrMore) { - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'element_time as ptt ON (ptt.fk_element = t.rowid AND ptt.elementtype = "task")'; + $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'element_time as ptt ON (ptt.fk_element = pt.rowid AND ptt.elementtype = "task")'; } else { $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'projet_task_time as ptt ON pt.rowid = ptt.fk_task'; }