From 5ed8340d0e5ebfc6655298daf13e73e5dd685cf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Jun 2017 15:22:44 +0200 Subject: [PATCH] Fix no record found into lists --- htdocs/expensereport/list.php | 5 ++++- htdocs/holiday/list.php | 13 +++++++------ htdocs/modulebuilder/template/myobject_list.php | 9 +++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index d2c5db3426d..34f1cfebf38 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -684,7 +684,10 @@ if ($resql) } else { - print ''.''.$langs->trans("NoRecordFound").''; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + + print ''.''.$langs->trans("NoRecordFound").''; } // Show total line diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 2b917927067..925a210cb00 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -194,7 +194,7 @@ if (!empty($sall)) if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; -if ($type) $filter.=' AND cp.fk_type IN ('.$type.')'; +if ($type > 0) $filter.=' AND cp.fk_type IN ('.$db->escape($type).')'; // Récupération de l'ID de l'utilisateur $user_id = $user->id; @@ -206,17 +206,18 @@ if ($id > 0) $fuser->getrights(); $user_id = $fuser->id; } + // Récupération des congés payés de l'utilisateur ou de tous les users if (empty($user->rights->holiday->read_all) || $id > 0) { - $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday + $result = $holiday->fetchByUser($user_id,$order,$filter); // Load array $holiday->holiday } else { - $holiday_payes = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday + $result = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday } // Si erreur SQL -if ($holiday_payes == '-1') +if ($result == '-1') { print load_fiche_titre($langs->trans('CPTitreMenu'), '', 'title_hrm.png'); @@ -446,9 +447,9 @@ if (! empty($holiday->holiday)) } // Si il n'y a pas d'enregistrement suite à une recherche -if($holiday_payes == '2') +if ($result == '2') { - print ''; + print ''; print ''.$langs->trans('NoRecordFound').''; print ''; } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ef3cb110224..57958bb25b8 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -535,6 +535,15 @@ if (isset($totalarray['totalhtfield'])) print ''; } +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + + $db->free($resql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);