FIX It was not possible to define if leave type need to be followed by a
counter or not. Added also a message to ask user to finish setup if no leave with counter was setup.
This commit is contained in:
parent
e79750dc89
commit
0d8788e552
@ -41,6 +41,7 @@ $langs->load("errors");
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("resource");
|
$langs->load("resource");
|
||||||
|
$langs->load("holiday");
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$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[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[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[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";
|
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
@ -232,7 +233,7 @@ $tabfield[24]= "code,label";
|
|||||||
$tabfield[25]= "label,type_template,position,topic,content";
|
$tabfield[25]= "label,type_template,position,topic,content";
|
||||||
$tabfield[26]= "code,label,short_label";
|
$tabfield[26]= "code,label,short_label";
|
||||||
$tabfield[27]= "code,libelle";
|
$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";
|
$tabfield[29]= "code,label,percent,position";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// 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[25]= "label,type_template,position,topic,content";
|
||||||
$tabfieldvalue[26]= "code,label,short_label";
|
$tabfieldvalue[26]= "code,label,short_label";
|
||||||
$tabfieldvalue[27]= "code,libelle";
|
$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";
|
$tabfieldvalue[29]= "code,label,percent,position";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// 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[25]= "label,type_template,position,topic,content";
|
||||||
$tabfieldinsert[26]= "code,label,short_label";
|
$tabfieldinsert[26]= "code,label,short_label";
|
||||||
$tabfieldinsert[27]= "code,libelle";
|
$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";
|
$tabfieldinsert[29]= "code,label,percent,position";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// 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[25] = array('type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[27] = 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"));
|
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
|
|||||||
@ -763,7 +763,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
|||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
$typeleaves=$cp->getTypes(1,-1);
|
$typeleaves=$cp->getTypes(1,1);
|
||||||
foreach($typeleaves as $key => $val)
|
foreach($typeleaves as $key => $val)
|
||||||
{
|
{
|
||||||
$nb_type = $cp->getCPforUser($user->id, $val['rowid']);
|
$nb_type = $cp->getCPforUser($user->id, $val['rowid']);
|
||||||
|
|||||||
@ -1804,8 +1804,8 @@ class Holiday extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return array with list of types
|
* Return array with list of types
|
||||||
*
|
*
|
||||||
* @param int $active Status of type
|
* @param int $active Status of type. -1 = Both
|
||||||
* @param int $affect Filter on affect (a request will change sold or not)
|
* @param int $affect Filter on affect (a request will change sold or not). -1 = Both
|
||||||
* @return array Return array with list of types
|
* @return array Return array with list of types
|
||||||
*/
|
*/
|
||||||
function getTypes($active=-1, $affect=-1)
|
function getTypes($active=-1, $affect=-1)
|
||||||
|
|||||||
@ -132,7 +132,8 @@ elseif($action == 'add_event')
|
|||||||
$new_holiday = $nb_holiday + $add_holiday;
|
$new_holiday = $nb_holiday + $add_holiday;
|
||||||
|
|
||||||
// add event to existing types of vacation
|
// add event to existing types of vacation
|
||||||
foreach ($typeleaves as $key => $leave) {
|
foreach ($typeleaves as $key => $leave)
|
||||||
|
{
|
||||||
$vacationTypeID = $leave['rowid'];
|
$vacationTypeID = $leave['rowid'];
|
||||||
|
|
||||||
// On ajoute la modification dans le LOG
|
// On ajoute la modification dans le LOG
|
||||||
@ -193,52 +194,77 @@ if ($cp_events == 1)
|
|||||||
|
|
||||||
$typeleaves=$holiday->getTypes(1,1);
|
$typeleaves=$holiday->getTypes(1,1);
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
if (count($typeleaves) == 0)
|
||||||
print '<input type="hidden" name="action" value="update" />';
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%;">';
|
|
||||||
print "<tr class=\"liste_titre\">";
|
|
||||||
print '<td width="55%">'.$langs->trans('Employee').'</td>';
|
|
||||||
foreach($typeleaves as $key => $val)
|
|
||||||
{
|
{
|
||||||
print '<td width="20%" style="text-align:center">'.$val['label'].'</td>';
|
//print '<div class="info">';
|
||||||
|
print $langs->trans("NoLeaveWithCounterDefined")."<br>\n";
|
||||||
|
print $langs->trans("GoIntoDictionaryHolidayTypes");
|
||||||
|
//print '</div>';
|
||||||
}
|
}
|
||||||
print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>';
|
else
|
||||||
print '<td></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
foreach($listUsers as $users)
|
|
||||||
{
|
{
|
||||||
$var=!$var;
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="update" />';
|
||||||
print '<tr '.$bc[$var].' style="height: 20px;">';
|
|
||||||
print '<td>';
|
print '<table class="noborder" width="100%;">';
|
||||||
$userstatic->id=$users['rowid'];
|
print "<tr class=\"liste_titre\">";
|
||||||
$userstatic->lastname=$users['name'];
|
print '<td width="55%">'.$langs->trans('Employee').'</td>';
|
||||||
$userstatic->firstname=$users['firstname'];
|
if (count($typeleaves))
|
||||||
print $userstatic->getNomUrl(1);
|
{
|
||||||
print '</td>';
|
foreach($typeleaves as $key => $val)
|
||||||
foreach($typeleaves as $key => $val)
|
{
|
||||||
{
|
print '<td width="20%" style="text-align:center">'.$val['label'].'</td>';
|
||||||
$nbtoshow='';
|
}
|
||||||
if ($holiday->getCPforUser($users['rowid'], $val['rowid']) != '') $nbtoshow=price2num($holiday->getCPforUser($users['rowid'], $val['rowid']), 5);
|
}
|
||||||
print '<td style="text-align:center">';
|
else
|
||||||
print '<input type="text" value="'.$nbtoshow.'" name="nb_holiday_'.$val['rowid'].'['.$users['rowid'].']" size="5" style="text-align: center;"/>';
|
{
|
||||||
//print ' '.$langs->trans('days');
|
print '<td>'.$langs->trans("NoLeaveWithCounterDefined").'</td>';
|
||||||
print '</td>'."\n";
|
}
|
||||||
}
|
print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>';
|
||||||
print '<td style="text-align:center"><input type="text" value="" name="note_holiday['.$users['rowid'].']" size="30"/></td>';
|
print '<td></td>';
|
||||||
print '<td><input type="submit" name="update_cp['.$users['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'" class="button"/></td>'."\n";
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$i++;
|
|
||||||
|
foreach($listUsers as $users)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].' style="height: 20px;">';
|
||||||
|
print '<td>';
|
||||||
|
$userstatic->id=$users['rowid'];
|
||||||
|
$userstatic->lastname=$users['name'];
|
||||||
|
$userstatic->firstname=$users['firstname'];
|
||||||
|
print $userstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
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 '<td style="text-align:center">';
|
||||||
|
print '<input type="text" value="'.$nbtoshow.'" name="nb_holiday_'.$val['rowid'].'['.$users['rowid'].']" size="5" style="text-align: center;"/>';
|
||||||
|
//print ' '.$langs->trans('days');
|
||||||
|
print '</td>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td></td>';
|
||||||
|
}
|
||||||
|
print '<td style="text-align:center"><input type="text" value="" name="note_holiday['.$users['rowid'].']" size="30"/></td>';
|
||||||
|
print '<td><input type="submit" name="update_cp['.$users['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'" class="button"/></td>'."\n";
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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 '<tr>';
|
print '<tr>';
|
||||||
print '<td colspan="7" class="pair" style="text-align: center; padding: 5px;">'.$langs->trans('NoResults').'</td>';
|
print '<td colspan="8" '.$bc[false].'>'.$langs->trans('None').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -140,4 +140,7 @@ HolidaysRefusedBody=Your leave request for %s to %s has been denied for the foll
|
|||||||
HolidaysCanceled=Canceled leaved request
|
HolidaysCanceled=Canceled leaved request
|
||||||
HolidaysCanceledBody=Your leave request for %s to %s has been canceled.
|
HolidaysCanceledBody=Your leave request for %s to %s has been canceled.
|
||||||
NewByMonth=Added per month
|
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.<br>0: Not followed by a counter.
|
||||||
|
NoLeaveWithCounterDefined=There is no leave types defined that need to be followed by a counter
|
||||||
GoIntoDictionaryHolidayTypes=Go into <strong>Home - Setup - Dictionaries - Type of leaves</strong> to setup the different types of leaves.
|
GoIntoDictionaryHolidayTypes=Go into <strong>Home - Setup - Dictionaries - Type of leaves</strong> to setup the different types of leaves.
|
||||||
Loading…
Reference in New Issue
Block a user