From b2aa1f211501f86045dcfdba23c974645a387c26 Mon Sep 17 00:00:00 2001 From: TBAI Date: Thu, 7 Jan 2016 19:32:25 +0100 Subject: [PATCH 1/3] Debug of module leave requests Cancel leave isn't possible if it has been validated --- htdocs/holiday/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 608c2af1b24..d3e047e7706 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -356,7 +356,7 @@ if ($action == 'confirm_send') if ($cp->getConfCP('AlertValidatorSolde')) { $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday); - if ($nbopenedday > $cp->getCPforUser($cp->fk_user)) + if ($nbopenedday > $cp->getCPforUser($cp->fk_user, $cp->fk_type)) { $message.= "\n"; $message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; @@ -413,14 +413,14 @@ if ($action == 'confirm_valid') // Calculcate number of days consummed $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday); - $soldeActuel = $cp->getCpforUser($cp->fk_user); + $soldeActuel = $cp->getCpforUser($cp->fk_user, $cp->fk_type); $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG - $cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde); + $cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $cp->fk_type); // Mise à jour du solde - $cp->updateSoldeCP($cp->fk_user, $newSolde); + $cp->updateSoldeCP($cp->fk_user, $newSolde, $cp->fk_type); // To $destinataire = new User($db); @@ -578,14 +578,14 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') // Calculcate number of days consummed $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday); - $soldeActuel = $cp->getCpforUser($cp->fk_user); + $soldeActuel = $cp->getCpforUser($cp->fk_user, $cp->fk_type); $newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG - $result1=$cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde); + $result1=$cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("HolidaysCancelation"), $newSolde, $cp->fk_type); // Mise à jour du solde - $result2=$cp->updateSoldeCP($cp->fk_user, $newSolde); + $result2=$cp->updateSoldeCP($cp->fk_user, $newSolde, $cp->fk_type); if ($result1 < 0 || $result2 < 0) { @@ -618,7 +618,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') // From $expediteur = new User($db); - $expediteur->fetch($cp->fk_validator); + $expediteur->fetch($cp->fk_user_cancel); $emailFrom = $expediteur->email; // Subject From f28ebefe9356a3a65b464f41d5c8c1d0f3466dff Mon Sep 17 00:00:00 2001 From: TBAI Date: Thu, 7 Jan 2016 19:53:59 +0100 Subject: [PATCH 2/3] Debug of module leave requests Cancel leave isn't possible if it has been validated --- htdocs/holiday/class/holiday.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 21c36574ea9..1432e38e35f 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -819,12 +819,11 @@ class Holiday extends CommonObject * @param int $fk_type Filter on type * @return string retourne la valeur du paramètre */ - function getConfCP($name, $fk_type=0) + function getConfCP($name) { $sql = "SELECT value"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; $sql.= " WHERE name = '".$name."'"; - if ($fk_type > 0) $sql.=" AND fk_type = ".$fk_type; dol_syslog(get_class($this).'::getConfCP name='.$name.'', LOG_DEBUG); $result = $this->db->query($sql); From 8c48785de75ac88cf6008d45141e2f3135037920 Mon Sep 17 00:00:00 2001 From: TBAI Date: Thu, 7 Jan 2016 20:10:22 +0100 Subject: [PATCH 3/3] Debug of module leave requests Add text in holiday module --- htdocs/langs/en_US/holiday.lang | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 0b471cc8c51..7690180dde1 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -26,6 +26,7 @@ MenuConfCP=Edit balance of leaves UpdateAllCP=Update the leaves SoldeCPUser=Leaves balance is %s days. ErrorEndDateCP=You must select an end date greater than the start date. +ErrorFieldRequired=This field is required : ErrorSQLCreateCP=An SQL error occurred during the creation: ErrorIDFicheCP=An error has occurred, the leave request does not exist. ReturnCP=Return to previous page @@ -40,6 +41,7 @@ DeleteCP=Delete ActionValidCP=Validate ActionRefuseCP=Refuse ActionCancelCP=Cancel +UpdateButtonCP=Update StatutCP=Status SendToValidationCP=Send to validation TitleDeleteCP=Delete the leave request @@ -80,11 +82,10 @@ alreadyCPexist=A leave request has already been done on this period. UserName=Name FirstDayOfHoliday=First day of vacation LastDayOfHoliday=Last day of vacation -BoxTitleLastLeaveRequests=Last %s modified leave requests +BoxTitleLastLeaveRequests=Last %s modified leave requests HolidaysMonthlyUpdate=Monthly update ManualUpdate=Manual update HolidaysCancelation=Leave request cancelation - ## Configuration du Module ## ConfCP=Configuration of leave request module DescOptionCP=Description of the option @@ -140,4 +141,4 @@ HolidaysRefusedBody=Your leave request for %s to %s has been denied for the foll HolidaysCanceled=Canceled leaved request HolidaysCanceledBody=Your leave request for %s to %s has been canceled. NewByMonth=Added per month -GoIntoDictionaryHolidayTypes=Go into Home - Setup - Dictionaries - Type of leaves to setup the different types of leaves. \ No newline at end of file +GoIntoDictionaryHolidayTypes=Go into Home - Setup - Dictionaries - Type of leaves to setup the different types of leaves.