From 02c573b3cc69cd9ef95faf38a522c89bc68e06bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jul 2016 11:18:22 +0200 Subject: [PATCH] NEW Can filter on type of leave requests in list --- htdocs/holiday/list.php | 52 +++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8489f57187e..013ee177726 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -66,6 +66,21 @@ $year_end = GETPOST('year_end'); $search_employe = GETPOST('search_employe'); $search_valideur = GETPOST('search_valideur'); $search_statut = GETPOST('select_statut'); +$type = GETPOST('type','int'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 'cp.rowid'=>'Ref', + 'cp.description'=>'Description', + 'uu.lastname'=>'EmployeeLastname', + 'uu.firstname'=>'EmployeeFirstname' +); + + + +/* + * Actions + */ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { @@ -79,23 +94,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_employe=""; $search_valideur=""; $search_statut=""; + $type=''; } -// List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'cp.rowid'=>'Ref', - 'cp.description'=>'Description', - 'uu.lastname'=>'EmployeeLastname', - 'uu.firstname'=>'EmployeeFirstname' -); - - -/* - * Actions - */ - -// None - /* @@ -193,6 +194,8 @@ 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.')'; + // Récupération de l'ID de l'utilisateur $user_id = $user->id; @@ -302,12 +305,12 @@ print "\n"; // FILTRES print ''; -print ''; +print ''; print ''; print ''; // DATE CREATE -print ''; +print ''; print ''; $formother->select_year($year_create,'year_create',1, $min_year, 0); print ''; @@ -346,20 +349,29 @@ else } // Type -print ''; +print ''; +$typeleaves=$holidaystatic->getTypes(1,-1); +$arraytypeleaves=array(); +foreach($typeleaves as $key => $val) +{ + $labeltoshow = $val['label']; + //$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 ''; // DUREE print ' '; // DATE DEBUT -print ''; +print ''; print ''; $formother->select_year($year_start,'year_start',1, $min_year, $max_year); print ''; // DATE FIN -print ''; +print ''; print ''; $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print '';