Fix: Search broken in holiday list
This commit is contained in:
parent
d5d2b3a2fc
commit
0797323664
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/holiday/list.php
|
||||
* \ingroup holiday
|
||||
* \brief List of holiday.
|
||||
* \brief List of holiday
|
||||
*/
|
||||
|
||||
require('../main.inc.php');
|
||||
@ -63,10 +63,10 @@ $month_start = GETPOST('month_start');
|
||||
$year_start = GETPOST('year_start');
|
||||
$month_end = GETPOST('month_end');
|
||||
$year_end = GETPOST('year_end');
|
||||
$search_employe = GETPOST('search_employe');
|
||||
$search_employee = GETPOST('search_employee');
|
||||
$search_valideur = GETPOST('search_valideur');
|
||||
$search_statut = GETPOST('select_statut');
|
||||
$type = GETPOST('type','int');
|
||||
$search_type = GETPOST('search_type','int');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
@ -91,10 +91,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$year_start="";
|
||||
$month_end="";
|
||||
$year_end="";
|
||||
$search_employe="";
|
||||
$search_employee="";
|
||||
$search_valideur="";
|
||||
$search_statut="";
|
||||
$type='';
|
||||
$search_type='';
|
||||
}
|
||||
|
||||
|
||||
@ -121,13 +121,13 @@ llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
|
||||
$order = $db->order($sortfield,$sortorder).$db->plimit($limit + 1, $offset);
|
||||
|
||||
// WHERE
|
||||
// Ref
|
||||
if(!empty($search_ref))
|
||||
{
|
||||
$filter.= " AND cp.rowid LIKE '%".$db->escape($search_ref)."%'\n";
|
||||
}
|
||||
|
||||
// DATE START
|
||||
// Start date
|
||||
if($year_start > 0) {
|
||||
if($month_start > 0) {
|
||||
$filter .= " AND (cp.date_debut BETWEEN '".$db->idate(dol_get_first_day($year_start,$month_start,1))."' AND '".$db->idate(dol_get_last_day($year_start,$month_start,1))."')";
|
||||
@ -142,7 +142,7 @@ if($year_start > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// DATE FIN
|
||||
// End date
|
||||
if($year_end > 0) {
|
||||
if($month_end > 0) {
|
||||
$filter .= " AND (cp.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,$month_end,1))."' AND '".$db->idate(dol_get_last_day($year_end,$month_end,1))."')";
|
||||
@ -157,7 +157,7 @@ if($year_end > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// DATE CREATE
|
||||
// Create date
|
||||
if($year_create > 0) {
|
||||
if($month_create > 0) {
|
||||
$filter .= " AND (cp.date_create BETWEEN '".$db->idate(dol_get_first_day($year_create,$month_create,1))."' AND '".$db->idate(dol_get_last_day($year_create,$month_create,1))."')";
|
||||
@ -172,17 +172,22 @@ if($year_create > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// EMPLOYE
|
||||
if(!empty($search_employe) && $search_employe != -1) {
|
||||
$filter.= " AND cp.fk_user = '".$db->escape($search_employe)."'\n";
|
||||
// Employee
|
||||
if(!empty($search_employee) && $search_employee != -1) {
|
||||
$filter.= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
|
||||
}
|
||||
|
||||
// VALIDEUR
|
||||
// Validator
|
||||
if(!empty($search_valideur) && $search_valideur != -1) {
|
||||
$filter.= " AND cp.fk_validator = '".$db->escape($search_valideur)."'\n";
|
||||
}
|
||||
|
||||
// STATUT
|
||||
// Type
|
||||
if (!empty($search_type) && $search_type != -1) {
|
||||
$filter.= ' AND cp.fk_type IN ('.$db->escape($search_type).')';
|
||||
}
|
||||
|
||||
// Status
|
||||
if(!empty($search_statut) && $search_statut != -1) {
|
||||
$filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n";
|
||||
}
|
||||
@ -194,7 +199,6 @@ if (!empty($sall))
|
||||
|
||||
if (empty($user->rights->holiday->read_all)) $filter.=' AND cp.fk_user IN ('.join(',',$childids).')';
|
||||
|
||||
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;
|
||||
@ -297,34 +301,34 @@ if ($sall)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// FILTRES
|
||||
// Filters
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" size="4" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
|
||||
// DATE CREATE
|
||||
// Create date
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_create" value="'.dol_escape_htmltag($month_create).'">';
|
||||
$formother->select_year($year_create,'year_create',1, $min_year, 0);
|
||||
print '</td>';
|
||||
|
||||
// UTILISATEUR
|
||||
// User
|
||||
if ($user->rights->holiday->write_all)
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
print $form->select_dolusers($search_employe,"search_employe",1,"",0,'','',0,0,0,'',0,'','maxwidth200');
|
||||
print $form->select_dolusers($search_employee,"search_employee",1,"",0,'','',0,0,0,'',0,'','maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
print $form->select_dolusers($user->id,"search_employe",1,"",1,'','',0,0,0,'',0,'','maxwidth200');
|
||||
print $form->select_dolusers($user->id,"search_employee",1,"",1,'','',0,0,0,'',0,'','maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// APPROVER
|
||||
// Approve
|
||||
if($user->rights->holiday->write_all)
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
@ -352,30 +356,30 @@ foreach($typeleaves as $key => $val)
|
||||
//$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
|
||||
$arraytypeleaves[$val['rowid']]=$labeltoshow;
|
||||
}
|
||||
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('type'):''), 1);
|
||||
print $form->selectarray('search_type', $arraytypeleaves, (GETPOST('search_type')?GETPOST('search_type'):''), 1);
|
||||
print '</td>';
|
||||
|
||||
// DUREE
|
||||
// Duration
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// DATE DEBUT
|
||||
// Start date
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.dol_escape_htmltag($month_start).'">';
|
||||
$formother->select_year($year_start,'year_start',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// DATE FIN
|
||||
// End date
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.dol_escape_htmltag($month_end).'">';
|
||||
$formother->select_year($year_end,'year_end',1, $min_year, $max_year);
|
||||
print '</td>';
|
||||
|
||||
// STATUT
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone maxwidth200" align="right">';
|
||||
$holiday->selectStatutCP($search_statut);
|
||||
print '</td>';
|
||||
|
||||
// ACTION
|
||||
// Actions
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
@ -404,7 +408,7 @@ if (! empty($holiday->holiday))
|
||||
|
||||
foreach($holiday->holiday as $infos_CP)
|
||||
{
|
||||
// Utilisateur
|
||||
// User
|
||||
$userstatic->id=$infos_CP['fk_user'];
|
||||
$userstatic->lastname=$infos_CP['user_lastname'];
|
||||
$userstatic->firstname=$infos_CP['user_firstname'];
|
||||
@ -412,7 +416,7 @@ if (! empty($holiday->holiday))
|
||||
$userstatic->statut=$infos_CP['user_statut'];
|
||||
$userstatic->photo=$infos_CP['user_photo'];
|
||||
|
||||
// Valideur
|
||||
// Validator
|
||||
$approbatorstatic->id=$infos_CP['fk_validator'];
|
||||
$approbatorstatic->lastname=$infos_CP['validator_lastname'];
|
||||
$approbatorstatic->firstname=$infos_CP['validator_firstname'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user