Fix no record found into lists

This commit is contained in:
Laurent Destailleur 2017-06-22 15:22:44 +02:00
parent 1b96bb4221
commit 5ed8340d0e
3 changed files with 20 additions and 7 deletions

View File

@ -684,7 +684,10 @@ if ($resql)
} }
else else
{ {
print '<tr '.$bc[false].'>'.'<td colspan="9" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; $colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr>'.'<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
} }
// Show total line // Show total line

View File

@ -194,7 +194,7 @@ if (!empty($sall))
if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')'; 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 // Récupération de l'ID de l'utilisateur
$user_id = $user->id; $user_id = $user->id;
@ -206,17 +206,18 @@ if ($id > 0)
$fuser->getrights(); $fuser->getrights();
$user_id = $fuser->id; $user_id = $fuser->id;
} }
// Récupération des congés payés de l'utilisateur ou de tous les users // 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) 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 else
{ {
$holiday_payes = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday $result = $holiday->fetchAll($order,$filter); // Load array $holiday->holiday
} }
// Si erreur SQL // Si erreur SQL
if ($holiday_payes == '-1') if ($result == '-1')
{ {
print load_fiche_titre($langs->trans('CPTitreMenu'), '', 'title_hrm.png'); 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 // Si il n'y a pas d'enregistrement suite à une recherche
if($holiday_payes == '2') if ($result == '2')
{ {
print '<tr '.$bc[false].'>'; print '<tr>';
print '<td colspan="10" class="opacitymedium">'.$langs->trans('NoRecordFound').'</td>'; print '<td colspan="10" class="opacitymedium">'.$langs->trans('NoRecordFound').'</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -535,6 +535,15 @@ if (isset($totalarray['totalhtfield']))
print '</tr>'; print '</tr>';
} }
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);