NEW Add more information to holiday mailings (#25461)

* Add more information to holiday mailings

* Fix leave type in mailings
This commit is contained in:
Alban Durrheimer 2023-07-25 23:17:09 +02:00 committed by GitHub
parent 37937f2a46
commit c86b608a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 2 deletions

View File

@ -522,11 +522,29 @@ if (empty($reshook)) {
}
}
$typeleaves = $object->getTypes(1, -1);
$labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']);
if ($object->halfday == 2) {
$starthalfdaykey = "Afternoon";
$endhalfdaykey = "Morning";
} elseif ($object->halfday == -1) {
$starthalfdaykey = "Afternoon";
$endhalfdaykey = "Afternoon";
} elseif ($object->halfday == 1) {
$starthalfdaykey = "Morning";
$endhalfdaykey = "Morning";
} elseif ($object->halfday == 2) {
$starthalfdaykey = "Morning";
$endhalfdaykey = "Afternoon";
}
$link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id;
$message .= "<ul>";
$message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Type")." : ".(empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv($starthalfdaykey)." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')." ".$langs->transnoentitiesnoconv($endhalfdaykey)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>\n";

View File

@ -747,11 +747,29 @@ function sendMail($id, $cancreate, $now, $autoValidation)
}
}
$typeleaves = $object->getTypes(1, -1);
$labeltoshow = (($typeleaves[$object->fk_type]['code'] && $langs->trans($typeleaves[$object->fk_type]['code']) != $typeleaves[$object->fk_type]['code']) ? $langs->trans($typeleaves[$object->fk_type]['code']) : $typeleaves[$object->fk_type]['label']);
if ($object->halfday == 2) {
$starthalfdaykey = "Afternoon";
$endhalfdaykey = "Morning";
} elseif ($object->halfday == -1) {
$starthalfdaykey = "Afternoon";
$endhalfdaykey = "Afternoon";
} elseif ($object->halfday == 1) {
$starthalfdaykey = "Morning";
$endhalfdaykey = "Morning";
} elseif ($object->halfday == 2) {
$starthalfdaykey = "Morning";
$endhalfdaykey = "Afternoon";
}
$link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id;
$message .= "<ul>";
$message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Type")." : ".(empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv($starthalfdaykey)." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')." ".$langs->transnoentitiesnoconv($endhalfdaykey)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>\n";