diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index 93560b9bb7c..57fe16ea23e 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -281,7 +281,7 @@ if (empty($reshook)) { // Check if there is already holiday for this period pour chaque user $verifCP = $object->verifDateHolidayCP($u, $date_debut, $date_fin, $halfday); if (!$verifCP) { - setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); + //setEventMessages($langs->trans("alreadyCPexist"), null, 'errors'); $userError = new User($db); $result = $userError->fetch($u); @@ -342,7 +342,7 @@ if (empty($reshook)) { // If no SQL error we redirect to the request card if (!$error) { $db->commit(); - header('Location: '.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1'); + header('Location: '.DOL_URL_ROOT.'/holiday/list.php'); exit; } else { $db->rollback(); @@ -414,10 +414,27 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { if( $("input[name=autoValidation]").is(":checked") ){ $("#AutoSendMail").prop("disabled", false); + $("#AutoSendMail").prop("checked", true); + } else { $("#AutoSendMail").prop("disabled", true); + $("#AutoSendMail").prop("checked", false); } + $("input[name=autoValidation]").click( function(e) { + console.log("chang") + + if( $("input[name=autoValidation]").is(":checked") ){ + $("#AutoSendMail").prop("disabled", false); + $("#AutoSendMail").prop("checked", true); + } else { + $("#AutoSendMail").prop("disabled", true); + $("#AutoSendMail").prop("checked", false); + } + }); + + + $("input.button-save").click("submit", function(e) { console.log("Call valider()"); if (document.demandeCP.date_debut_.value != "") @@ -588,7 +605,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { print ''; //auto validation ON CREATE - print ''.$langs->trans("AutoApprovalOnCreate").''; + print ''.$langs->trans("AutoValidationOnCreate").''; print ''; print ''."\n"; @@ -658,10 +675,10 @@ function sendMail($id, $cancreate, $now, $autoValidation) if ($result) { // If draft and owner of leave - if ($object->statut == Holiday::STATUS_DRAFT && $cancreate) { + if ($object->statut == Holiday::STATUS_VALIDATED && $cancreate) { $object->oldcopy = dol_clone($object); - if ($autoValidation) $object->statut = Holiday::STATUS_VALIDATED; + //if ($autoValidation) $object->statut = Holiday::STATUS_VALIDATED; $verif = $object->validate($user);