From 55cb103ab02807a53024b5b1084146901399419c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2015 13:01:44 +0200 Subject: [PATCH] Maxi debug of new module leave requests --- htdocs/core/menus/standard/eldy.lib.php | 9 +- htdocs/holiday/admin/holiday.php | 340 ------------------ htdocs/holiday/card.php | 14 +- htdocs/holiday/class/holiday.class.php | 178 ++++----- htdocs/holiday/define_holiday.php | 2 +- htdocs/holiday/{index.php => list.php} | 0 .../install/mysql/data/llx_c_holiday_type.sql | 13 +- .../install/mysql/data/llx_holiday_config.sql | 7 - 8 files changed, 88 insertions(+), 475 deletions(-) rename htdocs/holiday/{index.php => list.php} (100%) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a8d9a901b9b..b2e1992f0f9 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1222,15 +1222,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("holiday"); - $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); - $newmenu->add("/holiday/card.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); - $newmenu->add("/holiday/index.php?&leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read); + $newmenu->add("/holiday/list.php?&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm'); + $newmenu->add("/holiday/card.php?&action=request", $langs->trans("New"), 1,$user->rights->holiday->write); + $newmenu->add("/holiday/list.php?&leftmenu=hrm", $langs->trans("List"), 1,$user->rights->holiday->read); + $newmenu->add("/holiday/list.php?select_statut=2&leftmenu=hrm", $langs->trans("ListToApprove"), 2, $user->rights->holiday->read); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->define_holiday); } - // Trips and expenses + // Trips and expenses (old module) if (! empty($conf->deplacement->enabled)) { $langs->load("trips"); diff --git a/htdocs/holiday/admin/holiday.php b/htdocs/holiday/admin/holiday.php index 274a4ba27dd..c1222213b5c 100644 --- a/htdocs/holiday/admin/holiday.php +++ b/htdocs/holiday/admin/holiday.php @@ -56,267 +56,6 @@ print_fiche_titre($langs->trans('ConfCP'), $linkback, 'title_hrm.png'); $cp = new Holiday($db); -// Contrôle du formulaire -if ($action == "add") -{ - $error = 0; - - // Option du groupe de validation - /*if (!$cp->updateConfCP('userGroup',$_POST['userGroup'])) - { - $error++; - }*/ - - // Option du délai pour faire une demande de congés payés - if (!$cp->updateConfCP('delayForRequest',$_POST['delayForRequest'])) - { - $error++; - } - - // Option du nombre de jours à ajouter chaque mois - $nbHolidayEveryMonth = price2num($_POST['nbHolidayEveryMonth'],5); - - if(!$cp->updateConfCP('nbHolidayEveryMonth',$nbHolidayEveryMonth)) - { - $error++; - } - - // Option du nombre de jours pour un mariage - $OptMariageCP = price2num($_POST['OptMariage'],5); - - if(!$cp->updateConfCP('OptMariage',$OptMariageCP)) { - $error++; - } - - // Option du nombre de jours pour un décés d'un proche - $OptDecesProcheCP = price2num($_POST['OptDecesProche'],5); - - if(!$cp->updateConfCP('OptDecesProche',$OptDecesProcheCP)) { - $error++; - } - - // Option du nombre de jours pour un mariage d'un enfant - $OptMariageProcheCP = price2num($_POST['OptMariageProche'],5); - - if(!$cp->updateConfCP('OptMariageProche',$OptMariageProcheCP)) { - $error++; - } - - // Option du nombre de jours pour un décés d'un parent - $OptDecesParentsCP = price2num($_POST['OptDecesParents'],5); - - if(!$cp->updateConfCP('OptDecesParents',$OptDecesParentsCP)) { - $error++; - } - - // Option pour avertir le valideur si délai de demande incorrect - if(isset($_POST['AlertValidatorDelay'])) { - if(!$cp->updateConfCP('AlertValidatorDelay','1')) { - $error++; - } - } else { - if(!$cp->updateConfCP('AlertValidatorDelay','0')) { - $error++; - } - } - - // Option pour avertir le valideur si solde des congés de l'utilisateur inccorect - if(isset($_POST['AlertValidatorSolde'])) { - if(!$cp->updateConfCP('AlertValidatorSolde','1')) { - $error++; - } - } else { - if(!$cp->updateConfCP('AlertValidatorSolde','0')) { - $error++; - } - } - - // Option du nombre de jours à déduire pour 1 jour de congés - $nbHolidayDeducted = price2num($_POST['nbHolidayDeducted'],5); - - if(!$cp->updateConfCP('nbHolidayDeducted',$nbHolidayDeducted)) - { - $error++; - } - - if ($error) - { - setEventMessage($langs->trans('ErrorUpdateConfCP'), 'errors'); - } else { - setEventMessage($langs->trans('UpdateConfCPOK')); - } - - // Si première mise à jour, prévenir l'utilisateur de mettre à jour le solde des congés payés - $sql = "SELECT *"; - $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users"; - - $result = $db->query($sql); - $num = $db->num_rows($sql); - if($num < 1) - { - $cp->createCPusers(); - setEventMessage($langs->trans('AddCPforUsers'), 'warnings'); - } - - // Si il s'agit de créer un event -} -elseif ($action == 'create_event') -{ - $error = 0; - - $optName = trim($optName); - $optValue = price2num($optValue,5); - - if (! $optName) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")), 'errors'); - $error++; - } - if (! $optValue > 0) - { - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")), 'errors'); - $error++; - } - - $cp->optName = $optName; - $cp->optValue = $optValue; - - if (! $error) - { - $result = $cp->createEventCP($user); - if($result > 0) - { - setEventMessage('OkCreateEventCP'); - $optName=''; - $optValue=''; - } - else - { - setEventMessage($cp->error, 'errors'); - } - } -} -elseif($action == 'event' && isset($_POST['update_event'])) -{ - $error = 0; - - $eventId = array_keys($_POST['update_event']); - $eventId = $eventId[0]; - - $eventName = $optName; - $eventName = $eventName[$eventId]; - - $eventValue = $optValue; - $eventValue = $eventValue[$eventId]; - - if (!empty($eventName)) - { - $eventName = trim($eventName); - } else { - $error++; - } - - if (!empty($eventValue)) - { - $eventValue = price2num($eventValue,5); - } else { - $error++; - } - - if (!$error) - { - // Mise à jour des congés de l'utilisateur - $update = $cp->updateEventCP($eventId,$eventName,$eventValue); - if(!$update) { - setEventMessage('ErrorUpdateEventCP', 'errors'); - } else { - setEventMessage('UpdateEventOkCP'); - } - } else { - setEventMessage('ErrorUpdateEventCP', 'errors'); - } -} -elseif($action && isset($_POST['delete_event'])) -{ - $eventId = array_keys($_POST['delete_event']); - $eventId = $eventId[0]; - - $result = $cp->deleteEventCP($eventId); - - if($result) { - print '
'; - print $langs->trans('DeleteEventOkCP'); - print '
'; - } else { - print '
'; - print $langs->trans('ErrorDeleteEventCP'); - print '
'; - } -} - -/*print '
'; - -print_fiche_titre($langs->trans('TitleOptionMainCP'),'',''); - - -dol_fiche_head(array(),'',''); - -print '
'."\n"; -print ''."\n"; - -print ''; -print ''; -print ''; -print ''; - -$var=true; - -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -print ''."\n"; -print '
'.$langs->trans('DescOptionCP').''; -print ''.$langs->trans('ValueOptionCP').''; -print '
'.$langs->trans('DelayForSubmitCP').' '.$langs->trans('DurationDays').'
'.$langs->trans('AlertValidatorDelayCP').'getCheckOption('AlertValidatorDelay').'/>
'.$langs->trans('AlertValidorSoldeCP').'getCheckOption('AlertValidatorSolde').'/>
'.$langs->trans('nbHolidayEveryMonthCP').' '.$langs->trans('DurationDays').'
'.$langs->trans('nbHolidayDeductedCP').' '.$langs->trans('DurationDays').'
'."\n"; - -print '
'."\n"; -print '
'."\n\n"; - -dol_fiche_end(); -*/ - -/*$var=!$var; -print $langs->trans('nbUserCP').': '."\n"; -print $cp->getConfCP('nbUser')."
\n"; -*/ - print '
'.$langs->trans("GoIntoDictionaryHolidayTypes").'

'; $var=!$var; @@ -325,85 +64,6 @@ if ($cp->getConfCP('lastUpdate')) print ''.dol_print_date($db->jdate($cp else print $langs->trans('None'); print "
\n"; -/* -print '
'; - -print_fiche_titre($langs->trans('TitleOptionEventCP'),'',''); - -dol_fiche_head(array(),'',''); - - -$cp_events = $cp->fetchEventsCP(); - -if($cp_events == 1) { - - $var = false; - $i = 0; - - print '
'."\n"; - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - print ''."\n"; - - foreach($cp->events as $infos_event) - { - $var=!$var; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - - $i++; - } - - print ''."\n"; - print '
'.$langs->trans('NameEventCP').''.$langs->trans('ValueOptionCP').'  
'.$langs->trans('DurationDays').'
'."\n"; - print '
'."\n"; - print '
'."\n\n"; - -} - -print '
'."\n"; -print ''."\n"; - -print $langs->trans('TitleCreateEventCP'); - -print ''; -print ''; - -print ''; - -print ''; -print ''; -print ''; - -print ''; - -print ''; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; - -print ''; -print '
'.$langs->trans('NameEventCP').''.$langs->trans('ValueOptionCP').' 
'.$langs->trans('DurationDays').'
'; - -print '
'; - -dol_fiche_end(); -*/ // Fin de page llxFooter(); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index befdc7ae094..23c78641462 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -277,7 +277,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights- if (! $error) { $db->commit(); - header('Location: index.php'); + header('Location: list.php'); exit; } else @@ -839,7 +839,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create // Approved by print ''; print ''.$langs->trans("ReviewedByCP").''; - // Liste des utiliseurs du groupe choisi dans la config $validator = new UserGroup($db); $excludefilter=$user->admin?'':'u.rowid <> '.$user->id; $valideurobjects = $validator->listUsersForGroup($excludefilter); @@ -1119,14 +1118,15 @@ else } else { print ''; print ''.$langs->trans('ReviewedByCP').''; - // Liste des utiliseurs du groupes choisi dans la config - $idGroupValid = $cp->getConfCP('userGroup'); - $validator = new UserGroup($db); - $valideur = $validator->listUsersForGroup('',1); + $validator = new UserGroup($db); + $excludefilter=$user->admin?'':'u.rowid <> '.$user->id; + $valideurobjects = $validator->listUsersForGroup($excludefilter); + $valideurarray = array(); + foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id; print ''; - $form->select_users($cp->fk_validator,"valideur",1,"",0,$valideur,''); + print $form->select_dolusers($user->fk_user, "valideur", 1, "", 0, $valideurarray); // By default, hierarchical parent print ''; print ''; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index a98b50bf48b..3e68bb6bce5 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -96,8 +96,8 @@ class Holiday extends CommonObject // Update sold of vocations $result = $this->updateSoldeCP(); - // Vérifie le nombre d'utilisateur et mets à jour si besoin - if ($result > 0) $result = $this->verifNbUsers($this->countActiveUsersWithoutCP(), $this->getConfCP('nbUser')); + // Check nb of users into table llx_holiday_users and update with empty lines + //if ($result > 0) $result = $this->verifNbUsers($this->countActiveUsersWithoutCP(), $this->getConfCP('nbUser')); if ($result >= 0) { @@ -785,61 +785,6 @@ class Holiday extends CommonObject } - /** - * Retourne un select HTML des groupes d'utilisateurs - * - * @param string $prefix nom du champ dans le formulaire - * @return string retourne le select des groupes - */ - function selectUserGroup($prefix) - { - // On récupère le groupe déjà configuré - $group.= "SELECT value"; - $group.= " FROM ".MAIN_DB_PREFIX."holiday_config"; - $group.= " WHERE name = 'userGroup'"; - - $resultat = $this->db->query($group); - $objet = $this->db->fetch_object($resultat); - $groupe = $objet->value; - - // On liste les groupes de Dolibarr - $sql = "SELECT u.rowid, u.nom as name"; - $sql.= " FROM ".MAIN_DB_PREFIX."usergroup as u"; - $sql.= " ORDER BY u.rowid"; - - dol_syslog(get_class($this)."::selectUserGroup", LOG_DEBUG); - $result = $this->db->query($sql); - - // Si pas d'erreur SQL - if ($result) - { - // On créer le select HTML - $selectGroup = ''."\n"; - $this->db->free($result); - } - else - { - // Erreur SQL - $this->error=$this->db->lasterror(); - return -1; - } - - // Retourne le select HTML - return $selectGroup; - } - /** * Met à jour une option du module Holiday Payés * @@ -925,41 +870,52 @@ class Holiday extends CommonObject { $this->db->begin(); + $users = $this->fetchUsers(false,false); + $nbUser = count($users); + $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'"; $sql.= " WHERE name = 'lastUpdate'"; $result = $this->db->query($sql); - $typeleaves=$cp->getTypes(1,1); + $typeleaves=$this->getTypes(1,1); foreach($typeleaves as $key => $val) { // On ajoute x jours à chaque utilisateurs $nb_holiday = $val['newByMonth']; if (empty($nb_holiday)) $nb_holiday=0; - $users = $this->fetchUsers(false,false); - $nbUser = count($users); + if ($nb_holiday > 0) + { + dol_syslog("We update leavefor everybody for type ".$key, LOG_DEBUG); - $i = 0; - while ($i < $nbUser) - { - $now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']); - $new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); + $i = 0; + while ($i < $nbUser) + { + $now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']); + $new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); - // On ajoute la modification dans le LOG - $this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']); + // We add a log for each user + $this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']); - $i++; - } + $i++; + } - $sql2 = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; - $sql2.= " nb_holiday = nb_holiday + ".$nb_holiday; - $sql2.= " WHERE fk_type = ".$val['rowid']; + // Now we update counter for all users at once + $sql2 = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; + $sql2.= " nb_holiday = nb_holiday + ".$nb_holiday; + $sql2.= " WHERE fk_type = ".$val['rowid']; - $result= $this->db->query($sql2); + $result= $this->db->query($sql2); - if (! $result) break; + if (! $result) + { + dol_print_error($this->db); + break; + } + } + else dol_syslog("No change for leave of type ".$key, LOG_DEBUG); } if ($result) @@ -1142,14 +1098,14 @@ class Holiday extends CommonObject /** * Get list of Users or list of vacation balance. * - * @param boolean $liste If true return a string list. If false, return an array - * @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list. - * @return array|string Return an array + * @param boolean $stringlist If true return a string list of id. If false, return an array + * @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list. + * @return array|string|int Return an array */ - function fetchUsers($liste=true,$type=true) + function fetchUsers($stringlist=true,$type=true) { // Si vrai donc pour user Dolibarr - if ($liste) + if ($stringlist) { if($type) { @@ -1167,23 +1123,23 @@ class Holiday extends CommonObject $i = 0; $num = $this->db->num_rows($resql); - $liste = ''; + $stringlist = ''; // Boucles du listage des utilisateurs - while($i < $num) { - + while($i < $num) + { $obj = $this->db->fetch_object($resql); if($i == 0) { - $liste.= $obj->rowid; + $stringlist.= $obj->rowid; } else { - $liste.= ', '.$obj->rowid; + $stringlist.= ', '.$obj->rowid; } $i++; } // Retoune le tableau des utilisateurs - return $liste; + return $stringlist; } else { @@ -1195,8 +1151,8 @@ class Holiday extends CommonObject } else { - // Si utilisateur du module Congés Payés - $sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holidays, u.lastname, u.firstname"; + // We want only list of user id + $sql = "SELECT DISTINCT cpu.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu"; dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG); @@ -1207,26 +1163,26 @@ class Holiday extends CommonObject $i = 0; $num = $this->db->num_rows($resql); - $liste = ''; + $stringlist = ''; // Boucles du listage des utilisateurs - while($i < $num) { - + while($i < $num) + { $obj = $this->db->fetch_object($resql); if($i == 0) { - $liste.= $obj->fk_user; + $stringlist.= $obj->fk_user; } else { - $liste.= ', '.$obj->fk_user; + $stringlist.= ', '.$obj->fk_user; } $i++; } // Retoune le tableau des utilisateurs - return $liste; + return $stringlist; } else - { + { // Erreur SQL $this->error="Error ".$this->db->lasterror(); return -1; @@ -1248,8 +1204,8 @@ class Holiday extends CommonObject $resql=$this->db->query($sql); // Si pas d'erreur SQL - if ($resql) { - + if ($resql) + { $i = 0; $tab_result = $this->holiday; $num = $this->db->num_rows($resql); @@ -1264,7 +1220,7 @@ class Holiday extends CommonObject $tab_result[$i]['lastname'] = $obj->lastname; $tab_result[$i]['firstname'] = $obj->firstname; $tab_result[$i]['type'] = $obj->type; - $tab_result[$i]['nb_holidays'] = $obj->nb_holidays; + $tab_result[$i]['nb_holiday'] = $obj->nb_holiday; $i++; } @@ -1272,7 +1228,7 @@ class Holiday extends CommonObject return $tab_result; } else - { + { // Erreur SQL $this->error="Error ".$this->db->lasterror(); return -1; @@ -1281,7 +1237,7 @@ class Holiday extends CommonObject else { // List of vacation balance users - $sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holidays, u.lastname, u.firstname"; + $sql = "SELECT cpu.fk_user, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu,"; $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE cpu.fk_user = u.rowid"; @@ -1290,8 +1246,8 @@ class Holiday extends CommonObject $resql=$this->db->query($sql); // Si pas d'erreur SQL - if ($resql) { - + if ($resql) + { $i = 0; $tab_result = $this->holiday; $num = $this->db->num_rows($resql); @@ -1306,7 +1262,7 @@ class Holiday extends CommonObject $tab_result[$i]['lastname'] = $obj->lastname; $tab_result[$i]['firstname'] = $obj->firstname; $tab_result[$i]['type'] = $obj->type; - $tab_result[$i]['nb_holidays'] = $obj->nb_holidays; + $tab_result[$i]['nb_holiday'] = $obj->nb_holiday; $i++; } @@ -1314,7 +1270,7 @@ class Holiday extends CommonObject return $tab_result; } else - { + { // Erreur SQL $this->error="Error ".$this->db->lasterror(); return -1; @@ -1328,16 +1284,16 @@ class Holiday extends CommonObject * * @return int retourne le nombre d'utilisateur */ - function countActiveUsers() { - + function countActiveUsers() + { $sql = "SELECT count(u.rowid) as compteur"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.statut > 0"; $result = $this->db->query($sql); $objet = $this->db->fetch_object($result); - return $objet->compteur; + return $objet->compteur; } /** * Compte le nombre d'utilisateur actifs dans Dolibarr sans CP @@ -1348,12 +1304,12 @@ class Holiday extends CommonObject $sql = "SELECT count(u.rowid) as compteur"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u LEFT OUTER JOIN ".MAIN_DB_PREFIX."holiday_users hu ON (hu.fk_user=u.rowid)"; - $sql.= " WHERE u.statut > 0 AND hu.fk_user IS NULL "; + $sql.= " WHERE u.statut > 0 AND hu.fk_user IS NULL"; $result = $this->db->query($sql); $objet = $this->db->fetch_object($result); - return $objet->compteur; + return $objet->compteur; } /** @@ -1367,13 +1323,13 @@ class Holiday extends CommonObject { if (empty($userCP)) $userCP=0; dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarrWithoutCP.' userCP='.$userCP); - +/* // On vérifie les users Dolibarr sans CP if ($userDolibarrWithoutCP > 0) { $this->db->begin(); - $this->updateConfCP('nbUser',$userDolibarrWithoutCP); + //$this->updateConfCP('nbUser',$userDolibarrWithoutCP); $listUsersCP = $this->fetchUsers(true,false); @@ -1453,7 +1409,7 @@ class Holiday extends CommonObject return -1; } } - +*/ return 1; } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index d2cde8de5a0..c0179c55bd0 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -152,7 +152,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu')); print_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png'); print '
'.$langs->trans('LastUpdateCP').': '."\n"; -if ($cp->getConfCP('lastUpdate')) print ''.dol_print_date($db->jdate($cp->getConfCP('lastUpdate')),'dayhour','tzuser').''; +if ($holiday->getConfCP('lastUpdate')) print ''.dol_print_date($db->jdate($holiday->getConfCP('lastUpdate')),'dayhour','tzuser').''; else print $langs->trans('None'); print "

\n"; diff --git a/htdocs/holiday/index.php b/htdocs/holiday/list.php similarity index 100% rename from htdocs/holiday/index.php rename to htdocs/holiday/list.php diff --git a/htdocs/install/mysql/data/llx_c_holiday_type.sql b/htdocs/install/mysql/data/llx_c_holiday_type.sql index a0ee0b065b7..87eb67be131 100644 --- a/htdocs/install/mysql/data/llx_c_holiday_type.sql +++ b/htdocs/install/mysql/data/llx_c_holiday_type.sql @@ -24,10 +24,13 @@ -- de l'install et tous les sigles '--' sont supprimés. -- -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country) values ('LEAVE_PAID', 'Paid vacation', 1, 7, 0, NULL); -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country) values ('LEAVE_SICK', 'Sick leave', 0, 0, 0, NULL); -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country) values ('LEAVE_OTHER','Other leave', 0, 0, 0, NULL); +-- Generic to all countries +insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_SICK', 'Sick leave', 0, 0, 0, NULL, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_OTHER', 'Other leave', 0, 0, 0, NULL, 1); + +-- Not enabled by default, we prefer to have an entrey dedicated to country +insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_PAID', 'Paid vacation', 1, 7, 0, NULL, 0); -- Leaves specific to France -insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country) values ('LEAVE_RTT', 'RTT' , 1, 7, 0.83, 1); - +insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_RTT_FR', 'RTT' , 1, 7, 0.83, 1, 1); +insert into llx_c_holiday_types(code, label, affect, delay, newByMonth, fk_country, active) values ('LEAVE_PAID_FR', 'Paid vacation', 1, 30, 2.08334, 1, 1); diff --git a/htdocs/install/mysql/data/llx_holiday_config.sql b/htdocs/install/mysql/data/llx_holiday_config.sql index 7dd964a7ace..a55842e76c7 100644 --- a/htdocs/install/mysql/data/llx_holiday_config.sql +++ b/htdocs/install/mysql/data/llx_holiday_config.sql @@ -1,8 +1 @@ -INSERT INTO llx_holiday_config (name ,value) VALUES ('userGroup', NULL); INSERT INTO llx_holiday_config (name ,value) VALUES ('lastUpdate', NULL); -INSERT INTO llx_holiday_config (name ,value) VALUES ('nbUser', NULL); -INSERT INTO llx_holiday_config (name ,value) VALUES ('delayForRequest', '31'); -INSERT INTO llx_holiday_config (name ,value) VALUES ('AlertValidatorDelay', '0'); -INSERT INTO llx_holiday_config (name ,value) VALUES ('AlertValidatorSolde', '0'); -INSERT INTO llx_holiday_config (name ,value) VALUES ('nbHolidayDeducted', '1'); -INSERT INTO llx_holiday_config (name ,value) VALUES ('nbHolidayEveryMonth', '2.08334');