Clean code
This commit is contained in:
parent
722cc5f3f9
commit
8b58de50d5
@ -467,22 +467,24 @@ if (empty($reshook)) {
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
|
||||
|
||||
$delayForRequest = $object->getConfCP('delayForRequest');
|
||||
//$delayForRequest = $delayForRequest * (60*60*24);
|
||||
|
||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
// option to warn the validator in case of too short delay
|
||||
if ($object->getConfCP('AlertValidatorDelay')) {
|
||||
if ($object->date_debut < $nextMonth) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."\n";
|
||||
if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
|
||||
$delayForRequest = 0; // TODO Set delay depending of holiday leave type
|
||||
if ($delayForRequest) {
|
||||
$nowplusdelay = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
if ($object->date_debut < $nowplusdelay) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// option to notify the validator if the balance is less than the request
|
||||
if ($object->getConfCP('AlertValidatorSolde')) {
|
||||
if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
|
||||
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
|
||||
|
||||
if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
|
||||
$message .= "\n";
|
||||
$message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
|
||||
@ -925,12 +927,6 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
||||
}
|
||||
|
||||
|
||||
$delayForRequest = $object->getConfCP('delayForRequest', 1);
|
||||
//$delayForRequest = $delayForRequest * (60*60*24);
|
||||
|
||||
$nextMonth = dol_time_plus_duree($now, $delayForRequest, 'd');
|
||||
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
$("input.button-save").click("submit", function(e) {
|
||||
|
||||
@ -1601,7 +1601,7 @@ class Holiday extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le solde de congés payés pour un utilisateur
|
||||
* Return balance of holiday for one user
|
||||
*
|
||||
* @param int $user_id ID de l'utilisateur
|
||||
* @param int $fk_type Filter on type
|
||||
|
||||
Loading…
Reference in New Issue
Block a user