Merge pull request #18737 from marc-dll/12.0_FIX_projet_task_time_user_filter

FIX: task time: can't filter by user with pgsql + show error message
This commit is contained in:
Laurent Destailleur 2021-09-17 11:31:45 +02:00 committed by GitHub
commit 1c43a83a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1058,7 +1058,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);
@ -1069,6 +1069,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
{