From de4dd2e7354955fddcf3a283f41d7b021b43206a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2026 11:22:23 +0100 Subject: [PATCH] Link and filter on ountry for holiday types --- htdocs/admin/dict.php | 8 ++++-- htdocs/admin/holiday.php | 35 ++++++++++++++++++++++---- htdocs/holiday/card.php | 8 ++++-- htdocs/holiday/class/holiday.class.php | 10 +++++++- htdocs/langs/en_US/other.lang | 1 + 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 6102cd87d24..3429318196b 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1053,7 +1053,7 @@ if (empty($reshook)) { // Modify entry $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET "; - // Modifie valeur des champs + // Modifie value of fields if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) { $sql .= $tabrowid[$id]."="; $sql .= "'".$db->escape($rowid)."', "; @@ -1478,7 +1478,11 @@ if ($id > 0) { $sql .= " WHERE 1 = 1"; } if ($search_country_id > 0) { - $sql .= " AND c.rowid = ".((int) $search_country_id); + if ($id == DICT_HRM_PUBLIC_HOLIDAY || $id == DICT_HOLIDAY_TYPES) { + $sql .= " AND (c.rowid IS NULL OR c.rowid = 0 OR c.rowid = ".((int) $search_country_id).")"; + } else { + $sql .= " AND c.rowid = ".((int) $search_country_id); + } } if ($search_code != '') { $sql .= natural_search($tablecode, $search_code); diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index ca8d0732c7e..03354845281 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -27,11 +27,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "errors", "holiday")); @@ -448,6 +447,32 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { } +/* + * Type of leaves + */ + +print load_fiche_titre($langs->trans("LeaveType"), '', ''); + +print ''; + +print '

'; + + +/* + * Type of leaves + */ + +print load_fiche_titre($langs->trans("DictionaryPublicHolidays"), '', ''); + +print ''; + +print '

'; + + /* * Other options */ diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 8d04c94df01..539e198dec9 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1127,8 +1127,12 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val['rowid']); $nb_holiday += $nb_type; - $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).'
'; - //$out .= ' - '.$val['label'].': '.($nb_type ?price2num($nb_type) : 0).'
'; + $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).''; + if ($val['newbymonth'] > 0) { + $out .= '   +'.$val['newbymonth'].' / '.$langs->trans("Month").''; + } + $out .= ''; + $out .= '
'; } print '     '; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 643b4bb151e..493271fd352 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2381,7 +2381,15 @@ class Holiday extends CommonObject if ($num) { $types = array(); while ($obj = $this->db->fetch_object($result)) { - $types[$obj->rowid] = array('id' => $obj->rowid, 'rowid' => $obj->rowid, 'code' => $obj->code, 'label' => $obj->label, 'affect' => $obj->affect, 'delay' => $obj->delay, 'newbymonth' => $obj->newbymonth); + $types[$obj->rowid] = array( + 'id' => $obj->rowid, + 'rowid' => $obj->rowid, + 'code' => $obj->code, + 'label' => $obj->label, + 'affect' => $obj->affect, + 'delay' => $obj->delay, + 'newbymonth' => $obj->newbymonth + ); } return $types; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index e6d721aac8a..5faaefa5069 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -268,6 +268,7 @@ RequestToResetPasswordReceived=A request to change your password has been receiv NewKeyIs=This is your new keys to login NewKeyWillBe=Your new key to login to software will be ClickHereToGoTo=Click here to go to %s +ClickHereToGoToDictionary=Click here to edit the dictionary setup (also available from menu %s - %s - %s) YouMustClickToChange=You must however first click on the following link to validate this password change ConfirmPasswordChange=Confirm password change ForgetIfNothing=If you didn't request this change, just forget this email. Your credentials are kept safe.