diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 899aba82057..911372733f1 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -41,6 +41,7 @@ $langs->load("errors"); $langs->load("admin"); $langs->load("companies"); $langs->load("resource"); +$langs->load("holiday"); $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); @@ -168,7 +169,7 @@ $tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX $tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content, active FROM ".MAIN_DB_PREFIX."c_email_templates"; $tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm"; -$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; +$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; // Criteria to sort dictionaries @@ -232,7 +233,7 @@ $tabfield[24]= "code,label"; $tabfield[25]= "label,type_template,position,topic,content"; $tabfield[26]= "code,label,short_label"; $tabfield[27]= "code,libelle"; -$tabfield[28]= "code,label,delay,newByMonth,country_id,country"; +$tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country"; $tabfield[29]= "code,label,percent,position"; // Nom des champs d'edition pour modification d'un enregistrement @@ -264,7 +265,7 @@ $tabfieldvalue[24]= "code,label"; $tabfieldvalue[25]= "label,type_template,position,topic,content"; $tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[27]= "code,libelle"; -$tabfieldvalue[28]= "code,label,delay,newByMonth,country"; +$tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country"; $tabfieldvalue[29]= "code,label,percent,position"; // Nom des champs dans la table pour insertion d'un enregistrement @@ -296,7 +297,7 @@ $tabfieldinsert[24]= "code,label"; $tabfieldinsert[25]= "label,type_template,position,topic,content"; $tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27]= "code,libelle"; -$tabfieldinsert[28]= "code,label,delay,newByMonth,fk_country"; +$tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country"; $tabfieldinsert[29]= "code,label,percent,position"; // Nom du rowid si le champ n'est pas de type autoincrement @@ -394,7 +395,7 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[25] = array('type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList")); $tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode")); -$tabhelp[28] = array('delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically")); +$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically")); $tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList")); // List of check for fields (NOT USED YET) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 5cf2cf3617f..bd9fd680087 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -763,7 +763,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create dol_fiche_head(); $out=''; - $typeleaves=$cp->getTypes(1,-1); + $typeleaves=$cp->getTypes(1,1); foreach($typeleaves as $key => $val) { $nb_type = $cp->getCPforUser($user->id, $val['rowid']); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 21c36574ea9..f9156ba284c 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1804,8 +1804,8 @@ class Holiday extends CommonObject /** * Return array with list of types * - * @param int $active Status of type - * @param int $affect Filter on affect (a request will change sold or not) + * @param int $active Status of type. -1 = Both + * @param int $affect Filter on affect (a request will change sold or not). -1 = Both * @return array Return array with list of types */ function getTypes($active=-1, $affect=-1) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index e78d185661f..caea927c202 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -132,7 +132,8 @@ elseif($action == 'add_event') $new_holiday = $nb_holiday + $add_holiday; // add event to existing types of vacation - foreach ($typeleaves as $key => $leave) { + foreach ($typeleaves as $key => $leave) + { $vacationTypeID = $leave['rowid']; // On ajoute la modification dans le LOG @@ -193,52 +194,77 @@ if ($cp_events == 1) $typeleaves=$holiday->getTypes(1,1); -print '
'."\n"; -print ''; - -print ''; -print ""; -print ''; -foreach($typeleaves as $key => $val) +if (count($typeleaves) == 0) { - print ''; + //print '
'; + print $langs->trans("NoLeaveWithCounterDefined")."
\n"; + print $langs->trans("GoIntoDictionaryHolidayTypes"); + //print '
'; } -print ''; -print ''; -print ''; - - -foreach($listUsers as $users) +else { - $var=!$var; - - print ''; - print ''; - foreach($typeleaves as $key => $val) - { - $nbtoshow=''; - if ($holiday->getCPforUser($users['rowid'], $val['rowid']) != '') $nbtoshow=price2num($holiday->getCPforUser($users['rowid'], $val['rowid']), 5); - print ''."\n"; - } - print ''; - print ''."\n"; + print ''."\n"; + print ''; + + print '
'.$langs->trans('Employee').''.$val['label'].''.$langs->trans('Note').'
'; - $userstatic->id=$users['rowid']; - $userstatic->lastname=$users['name']; - $userstatic->firstname=$users['firstname']; - print $userstatic->getNomUrl(1); - print ''; - print ''; - //print ' '.$langs->trans('days'); - print '
'; + print ""; + print ''; + if (count($typeleaves)) + { + foreach($typeleaves as $key => $val) + { + print ''; + } + } + else + { + print ''; + } + print ''; + print ''; print ''; - - $i++; + + + foreach($listUsers as $users) + { + $var=!$var; + + print ''; + print ''; + + if (count($typeleaves)) + { + foreach($typeleaves as $key => $val) + { + $nbtoshow=''; + if ($holiday->getCPforUser($users['rowid'], $val['rowid']) != '') $nbtoshow=price2num($holiday->getCPforUser($users['rowid'], $val['rowid']), 5); + print ''."\n"; + } + } + else + { + print ''; + } + print ''; + print ''."\n"; + print ''; + + $i++; + } + + print '
'.$langs->trans('Employee').''.$val['label'].''.$langs->trans("NoLeaveWithCounterDefined").''.$langs->trans('Note').'
'; + $userstatic->id=$users['rowid']; + $userstatic->lastname=$users['name']; + $userstatic->firstname=$users['firstname']; + print $userstatic->getNomUrl(1); + print ''; + print ''; + //print ' '.$langs->trans('days'); + print '
'; + + print '
'; } -print ''; - -print ''; - llxFooter(); $db->close(); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 766478ed9de..cf1bdcb8748 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2011 Dimitri Mouillard * * This program is free software; you can redistribute it and/or modify @@ -101,10 +101,10 @@ foreach($cp->logs as $logs_CP) } -if($log_holiday == '2') +if ($log_holiday == '2') { print ''; - print ''.$langs->trans('NoResults').''; + print ''.$langs->trans('None').''; print ''; } diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 0b471cc8c51..680b802869f 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -140,4 +140,7 @@ 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 +Affect=Followed by a counter +FollowedByACounter=1: This type of leave need to be followed by a counter. Counter is incremented manually or automatically and when a leave request is validated, counter is decremented.
0: Not followed by a counter. +NoLeaveWithCounterDefined=There is no leave types defined that need to be followed by a counter GoIntoDictionaryHolidayTypes=Go into Home - Setup - Dictionaries - Type of leaves to setup the different types of leaves. \ No newline at end of file