Link and filter on ountry for holiday types

This commit is contained in:
Laurent Destailleur 2026-02-03 11:22:23 +01:00
parent fe6b6a8e42
commit de4dd2e735
5 changed files with 52 additions and 10 deletions

View file

@ -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);

View file

@ -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 '<div class="urllink">';
print img_picto('', 'url', 'class="pictofixedwidth"').' <a href="'.DOL_URL_ROOT.'/admin/dict.php?id=28&search_country_id='.($conf->entity).'">'.$langs->trans("ClickHereToGoToDictionary", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionary"), $langs->transnoentitiesnoconv("LeaveType")).'</a>';
print '</div>';
print '<br><br>';
/*
* Type of leaves
*/
print load_fiche_titre($langs->trans("DictionaryPublicHolidays"), '', '');
print '<div class="urllink">';
print img_picto('', 'url', 'class="pictofixedwidth"').' <a href="'.DOL_URL_ROOT.'/admin/dict.php?id=32&search_country_id='.($conf->entity).'">'.$langs->trans("ClickHereToGoToDictionary", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionary"), $langs->transnoentitiesnoconv("DictionaryPublicHolidays")).'</a>';
print '</div>';
print '<br><br>';
/*
* Other options
*/

View file

@ -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']).': <strong>'.($nb_type ? price2num($nb_type) : 0).'</strong><br>';
//$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
$out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': <strong>'.($nb_type ? price2num($nb_type) : 0).'</strong>';
if ($val['newbymonth'] > 0) {
$out .= ' &nbsp; <span class="opacitymedium">+'.$val['newbymonth'].' / '.$langs->trans("Month").'</span>';
}
$out .= '';
$out .= '<br>';
}
print ' &nbsp; &nbsp; ';

View file

@ -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;

View file

@ -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.