diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d094fb0bab4..95bc8d0d1c8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -782,7 +782,9 @@ class ActionComm extends CommonObject $this->elementid = $obj->elementid; $this->elementtype = $obj->elementtype; - $this->fetchResources(); + $this->fetch_optionals(); + + $this->fetchResources(); } $this->db->free($resql); } else { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 00b47070e78..db2e1508e92 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1006,7 +1006,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($search_note) $sql .= natural_search('t.note', $search_note); if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label); - if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); + if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user, 2); if ($search_valuebilled == '1') $sql .= ' AND t.invoice_id > 0'; if ($search_valuebilled == '0') $sql .= ' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)'; $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); @@ -1017,6 +1017,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); + + if (! $resql) { + dol_print_error($db); + exit; + } + $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 {