';
- // Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '| ';
- $searchpicto = $form->showFilterButtons('left');
- print $searchpicto;
- print ' | ';
- }
- if (!empty($arrayfields['cp.ref']['checked'])) {
- print '';
- print '';
- print ' | ';
- }
-
- if (!empty($arrayfields['cp.fk_user']['checked'])) {
- $morefilter = '';
- if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
- $morefilter = 'AND employee = 1';
- }
-
- // User
- $disabled = 0;
- // If into the tab holiday of a user ($id is set in such a case)
- if ($id && !GETPOSTISSET('search_employee')) {
- $search_employee = $id;
- $disabled = 1;
- }
+ print '';
+ print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
+ print ' | ';
+}
+// Approver
+if (!empty($arrayfields['cp.fk_validator']['checked'])) {
+ if ($user->hasRight('holiday', 'readall')) {
print '';
- print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
- print ' | ';
- }
-
- // Approver
- if (!empty($arrayfields['cp.fk_validator']['checked'])) {
- if ($user->hasRight('holiday', 'readall')) {
- print '';
- $validator = new UserGroup($db);
- $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
- $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
- $valideurarray = array();
- foreach ($valideurobjects as $val) {
- $valideurarray[$val] = $val;
- }
- print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
- print ' | ';
- } else {
- print ' | ';
- }
- }
-
- // Type
- if (!empty($arrayfields['cp.fk_type']['checked'])) {
- print '';
- if (empty($mysoc->country_id)) {
- setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors');
- } else {
- $typeleaves = $holidaystatic->getTypes(1, -1);
- $arraytypeleaves = array();
- foreach ($typeleaves as $key => $val) {
- $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
- //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
- $arraytypeleaves[$val['rowid']] = $labeltoshow;
- }
- print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
+ $validator = new UserGroup($db);
+ $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id;
+ $valideurobjects = $validator->listUsersForGroup($excludefilter, 1);
+ $valideurarray = array();
+ foreach ($valideurobjects as $val) {
+ $valideurarray[$val] = $val;
}
+ print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125');
print ' | ';
- }
-
- // Duration
- if (!empty($arrayfields['duration']['checked'])) {
+ } else {
print ' | ';
}
+}
- // Start date
- if (!empty($arrayfields['cp.date_debut']['checked'])) {
- print '';
- print '';
- print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year);
- print ' | ';
+// Type
+if (!empty($arrayfields['cp.fk_type']['checked'])) {
+ print '';
+ if (empty($mysoc->country_id)) {
+ setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors');
+ } else {
+ $typeleaves = $holidaystatic->getTypes(1, -1);
+ $arraytypeleaves = array();
+ foreach ($typeleaves as $key => $val) {
+ $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
+ //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':'');
+ $arraytypeleaves[$val['rowid']] = $labeltoshow;
+ }
+ print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
}
+ print ' | ';
+}
- // End date
- if (!empty($arrayfields['cp.date_fin']['checked'])) {
- print '';
- print '';
- print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year);
- print ' | ';
- }
+// Duration
+if (!empty($arrayfields['duration']['checked'])) {
+ print ' | ';
+}
- // Date validation
- if (!empty($arrayfields['cp.date_valid']['checked'])) {
- print '';
- print ' | ';
- }
+// Start date
+if (!empty($arrayfields['cp.date_debut']['checked'])) {
+ print '';
+ print '';
+ print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year);
+ print ' | ';
+}
- // Date appoval
- if (!empty($arrayfields['cp.date_approval']['checked'])) {
- print '';
- print ' | ';
- }
+// End date
+if (!empty($arrayfields['cp.date_fin']['checked'])) {
+ print '';
+ print '';
+ print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year);
+ print ' | ';
+}
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields);
- $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
+// Date validation
+if (!empty($arrayfields['cp.date_valid']['checked'])) {
+ print '';
+ print ' | ';
+}
- // Create date
- if (!empty($arrayfields['cp.date_create']['checked'])) {
- print '';
- print '';
- print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0);
- print ' | ';
- }
+// Date appoval
+if (!empty($arrayfields['cp.date_approval']['checked'])) {
+ print '';
+ print ' | ';
+}
- // Create date
- if (!empty($arrayfields['cp.tms']['checked'])) {
- print '';
- print '';
- print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0);
- print ' | ';
- }
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
- // Status
- if (!empty($arrayfields['cp.statut']['checked'])) {
- print '';
- $object->selectStatutCP($search_status, 'search_status', 'minwidth125');
- print ' | ';
- }
+// Fields from hook
+$parameters = array('arrayfields'=>$arrayfields);
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
- // Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '';
- $searchpicto = $form->showFilterButtons();
- print $searchpicto;
- print ' | ';
- }
+// Create date
+if (!empty($arrayfields['cp.date_create']['checked'])) {
+ print '';
+ print '';
+ print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0);
+ print ' | ';
+}
- print "
\n";
+// Create date
+if (!empty($arrayfields['cp.tms']['checked'])) {
+ print '';
- print '';
+ $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
+ $totalduration += $nbopenedday;
+
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print ' | ';
+ print ' ';
+ }
+
+ $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid'];
+
+ // Output Kanban
+ if ($massactionbutton || $massaction) {
+ $selected = 0;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ if (empty($typeleaves[$obj->fk_type])) {
+ $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type);
+ } else {
+ $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
}
- $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid'];
-
- // Output Kanban
- if ($massactionbutton || $massaction) {
+ $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow);
+ }
+ print $holidaystatic->getKanbanView('', $arraydata);
+ if ($i == ($imaxinloop - 1)) {
+ print ' ';
+ print ' | ';
+ }
+ } else {
+ // Show here line of result
+ $j = 0;
+ print ' ';
+ // Action column
+ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print '| ';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
- if (in_array($object->id, $arrayofselected)) {
+ if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
- if (empty($typeleaves[$obj->fk_type])) {
- $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type);
- } else {
- $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
- }
-
- $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow);
- print $holidaystatic->getKanbanView('', $arraydata);
- }
- if ($i == ($imaxinloop - 1)) {
- print '';
- print ' | ';
- }
- } else {
- print ' ';
- // Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '| ';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->rowid, $arrayofselected)) {
- $selected = 1;
- }
- print '';
- }
- print ' | ';
- }
- if (!empty($arrayfields['cp.ref']['checked'])) {
- print '';
- print $holidaystatic->getNomUrl(1, 1);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.fk_user']['checked'])) {
- print ''.$userstatic->getNomUrl(-1, 'leave').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.fk_validator']['checked'])) {
- print ''.$approbatorstatic->getNomUrl(-1).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.fk_type']['checked'])) {
- if (empty($typeleaves[$obj->fk_type])) {
- $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type);
- } else {
- $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
- }
-
- print '';
- print $labeltypeleavetoshow;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['duration']['checked'])) {
- print '';
- $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
- $totalduration += $nbopenedday;
- print $nbopenedday;
- //print ' '.$langs->trans('DurationDays');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.date_debut']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_debut), 'day');
- print ' ('.$langs->trans($listhalfday[$starthalfday]).')';
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.date_fin']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_fin), 'day');
- print ' ('.$langs->trans($listhalfday[$endhalfday]).')';
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date validation
- if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
- print '';
- print dol_print_date($db->jdate($obj->date_valid), 'day');
- print ' | ';
- if (!$i) $totalarray['nbfield']++;
- }
- // Date approval
- if (!empty($arrayfields['cp.date_approval']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_approval), 'day');
- print ' | ';
- if (!$i) $totalarray['nbfield']++;
- }
-
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
-
- // Date creation
- if (!empty($arrayfields['cp.date_create']['checked'])) {
- print ''.dol_print_date($date, 'dayhour').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.tms']['checked'])) {
- print ''.dol_print_date($date_modif, 'dayhour').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- if (!empty($arrayfields['cp.statut']['checked'])) {
- print ''.$holidaystatic->getLibStatut(5).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print '';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->rowid, $arrayofselected)) {
- $selected = 1;
- }
- print '';
- }
- print ' | ';
+ print '';
}
+ print '';
if (!$i) {
$totalarray['nbfield']++;
}
-
- print ' '."\n";
}
- $i++;
- }
-
- // Add a line for total if there is a total to show
- if (!empty($arrayfields['duration']['checked'])) {
- print ' ';
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print ' | ';
- }
- foreach ($arrayfields as $key => $val) {
- if (!empty($val['checked'])) {
- if ($key == 'duration') {
- print ''.$totalduration.' '.$langs->trans('DurationDays').' | ';
- } else {
- print ' | ';
- }
+ if (!empty($arrayfields['cp.ref']['checked'])) {
+ print '';
+ print $holidaystatic->getNomUrl(1, 1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- // status
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
- print ' | ';
+ if (!empty($arrayfields['cp.fk_user']['checked'])) {
+ print ''.$userstatic->getNomUrl(-1, 'leave').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print ' ';
+ if (!empty($arrayfields['cp.fk_validator']['checked'])) {
+ print ' '.$approbatorstatic->getNomUrl(-1).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['cp.fk_type']['checked'])) {
+ if (empty($typeleaves[$obj->fk_type])) {
+ $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type);
+ } else {
+ $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
+ }
+
+ print ' ';
+ print $labeltypeleavetoshow;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['duration']['checked'])) {
+ print ' ';
+ $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
+ $totalduration += $nbopenedday;
+ print $nbopenedday;
+ //print ' '.$langs->trans('DurationDays');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['cp.date_debut']['checked'])) {
+ print ' ';
+ print dol_print_date($db->jdate($obj->date_debut), 'day');
+ print ' ('.$langs->trans($listhalfday[$starthalfday]).')';
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['cp.date_fin']['checked'])) {
+ print ' ';
+ print dol_print_date($db->jdate($obj->date_fin), 'day');
+ print ' ('.$langs->trans($listhalfday[$endhalfday]).')';
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date validation
+ if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
+ print ' ';
+ print dol_print_date($db->jdate($obj->date_valid), 'day');
+ print ' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+ // Date approval
+ if (!empty($arrayfields['cp.date_approval']['checked'])) {
+ print ' ';
+ print dol_print_date($db->jdate($obj->date_approval), 'day');
+ print ' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+
+ // Date creation
+ if (!empty($arrayfields['cp.date_create']['checked'])) {
+ print ' '.dol_print_date($date, 'dayhour').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['cp.tms']['checked'])) {
+ print ' '.dol_print_date($date_modif, 'dayhour').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ if (!empty($arrayfields['cp.statut']['checked'])) {
+ print ' '.$holidaystatic->getLibStatut(5).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Action column
+ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ print ' ';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ print ' |
'."\n";
}
+ $i++;
}
- // Si il n'y a pas d'enregistrement suite à une recherche
- if ($num == 0) {
- $colspan = 1;
+ // Add a line for total if there is a total to show
+ if (!empty($arrayfields['duration']['checked'])) {
+ print '