From 3de793d88f5a7db9c108348bd6b2f85bebbe559d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 10 Apr 2018 15:28:05 +0200 Subject: [PATCH] fix #8436 --- htdocs/holiday/list.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index d99afde8c3d..25ff2f42849 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -458,15 +458,19 @@ else // Type print ''; -$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; +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); } -print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1); print ''; // Duration @@ -521,7 +525,7 @@ if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids) $result = 0; } // Lines -elseif (! empty($holiday->holiday)) +elseif (! empty($holiday->holiday) && !empty($mysoc->country_id)) { $userstatic = new User($db); $approbatorstatic = new User($db);