Merge pull request #928 from marcosgdf/holidays-improvements
Holidays module improvements
This commit is contained in:
commit
ee0e9f62b5
@ -913,7 +913,7 @@ class Holiday extends CommonObject
|
|||||||
$new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth');
|
$new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth');
|
||||||
|
|
||||||
// On ajoute la modification dans le LOG
|
// On ajoute la modification dans le LOG
|
||||||
$this->addLogCP($user->id,$users[$i]['rowid'], $langs->trans('Event').': '.$langs->trans('HolidaysMonthlyUpdate'),$new_solde);
|
$this->addLogCP($user->id,$users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'),$new_solde);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1660,43 +1660,43 @@ class Holiday extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
// Si pas d'erreur SQL
|
// Si pas d'erreur SQL
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$tab_result = $this->logs;
|
$tab_result = $this->logs;
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
// Si pas d'enregistrement
|
// Si pas d'enregistrement
|
||||||
if(!$num) {
|
if(!$num) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On liste les résultats et on les ajoutent dans le tableau
|
// On liste les résultats et on les ajoutent dans le tableau
|
||||||
while($i < $num) {
|
while($i < $num) {
|
||||||
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$tab_result[$i]['rowid'] = $obj->rowid;
|
$tab_result[$i]['rowid'] = $obj->rowid;
|
||||||
$tab_result[$i]['date_action'] = $obj->date_action;
|
$tab_result[$i]['date_action'] = $obj->date_action;
|
||||||
$tab_result[$i]['fk_user_action'] = $obj->fk_user_action;
|
$tab_result[$i]['fk_user_action'] = $obj->fk_user_action;
|
||||||
$tab_result[$i]['fk_user_update'] = $obj->fk_user_update;
|
$tab_result[$i]['fk_user_update'] = $obj->fk_user_update;
|
||||||
$tab_result[$i]['type_action'] = $obj->type_action;
|
$tab_result[$i]['type_action'] = $obj->type_action;
|
||||||
$tab_result[$i]['prev_solde'] = $obj->prev_solde;
|
$tab_result[$i]['prev_solde'] = $obj->prev_solde;
|
||||||
$tab_result[$i]['new_solde'] = $obj->new_solde;
|
$tab_result[$i]['new_solde'] = $obj->new_solde;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
// Retourne 1 et ajoute le tableau à la variable
|
// Retourne 1 et ajoute le tableau à la variable
|
||||||
$this->logs = $tab_result;
|
$this->logs = $tab_result;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Erreur SQL
|
// Erreur SQL
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::fetchLog ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::fetchLog ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -71,7 +71,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
|
|||||||
$comment = (isset($_POST['note_holiday'][$userID]) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
|
$comment = (isset($_POST['note_holiday'][$userID]) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
|
||||||
|
|
||||||
// We add the modification to the log
|
// We add the modification to the log
|
||||||
$holiday->addLogCP($user->id,$userID, $langs->trans('Event').': '.$langs->trans('ManualUpdate').$comment,$userValue);
|
$holiday->addLogCP($user->id,$userID, $langs->trans('ManualUpdate').$comment,$userValue);
|
||||||
|
|
||||||
// Update of the days of the employee
|
// Update of the days of the employee
|
||||||
$holiday->updateSoldeCP($userID,$userValue);
|
$holiday->updateSoldeCP($userID,$userValue);
|
||||||
@ -111,7 +111,7 @@ elseif($action == 'add_event')
|
|||||||
$new_holiday = $nb_holiday + $add_holiday;
|
$new_holiday = $nb_holiday + $add_holiday;
|
||||||
|
|
||||||
// On ajoute la modification dans le LOG
|
// On ajoute la modification dans le LOG
|
||||||
$holiday->addLogCP($user->id,$userCP, $langs->trans('Event').': '.$holiday->getNameEventCp($event),$new_holiday);
|
$holiday->addLogCP($user->id,$userCP, $holiday->getNameEventCp($event),$new_holiday);
|
||||||
|
|
||||||
$holiday->updateSoldeCP($userCP,$new_holiday);
|
$holiday->updateSoldeCP($userCP,$new_holiday);
|
||||||
|
|
||||||
|
|||||||
@ -380,7 +380,7 @@ if($action == 'confirm_valid')
|
|||||||
$newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
|
$newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
|
||||||
|
|
||||||
// On ajoute la modification dans le LOG
|
// On ajoute la modification dans le LOG
|
||||||
$cp->addLogCP($user->id,$cp->fk_user, $langs->trans('Event').': '.$langs->transnoentitiesnoconv("Holidays"),$newSolde);
|
$cp->addLogCP($user->id,$cp->fk_user, $langs->transnoentitiesnoconv("Holidays"),$newSolde);
|
||||||
|
|
||||||
// Mise à jour du solde
|
// Mise à jour du solde
|
||||||
$cp->updateSoldeCP($cp->fk_user,$newSolde);
|
$cp->updateSoldeCP($cp->fk_user,$newSolde);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $month = GETPOST('month_start');
|
|||||||
$year = GETPOST('year_start');
|
$year = GETPOST('year_start');
|
||||||
|
|
||||||
if(empty($month)) {
|
if(empty($month)) {
|
||||||
$month = date('m');
|
$month = date('n');
|
||||||
}
|
}
|
||||||
if(empty($year)) {
|
if(empty($year)) {
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
@ -65,7 +65,7 @@ $sql.= " FROM llx_holiday cp";
|
|||||||
$sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
|
$sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
|
||||||
$sql.= " WHERE cp.statut = 3"; // Approved
|
$sql.= " WHERE cp.statut = 3"; // Approved
|
||||||
// TODO Use BETWEEN instead of date_format
|
// TODO Use BETWEEN instead of date_format
|
||||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '$year-$month' OR date_format(cp.date_fin, '%Y-%m') = '$year-$month')";
|
$sql.= " AND (date_format(cp.date_debut, '%Y-%c') = '$year-$month' OR date_format(cp.date_fin, '%Y-%c') = '$year-$month')";
|
||||||
$sql.= " ORDER BY u.lastname,cp.date_debut";
|
$sql.= " ORDER BY u.lastname,cp.date_debut";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
@ -77,8 +77,9 @@ print '<div class="tabBar">';
|
|||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
|
||||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month_start" value="'.$month.'"> ';
|
print $langs->trans('Month').': ';
|
||||||
$htmlother->select_year($year,'year_start',1,10,3);
|
print $htmlother->select_month($month, 'month_start').' ';
|
||||||
|
print $htmlother->select_year($year,'year_start',1,10,3);
|
||||||
|
|
||||||
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
print '<input type="submit" value="'.$langs->trans("Refresh").'" class="button" />';
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ if($num == '0') {
|
|||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
|
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
|
||||||
print '<td>'.$user->lastname.' '.$user->firstname.'</td>';
|
print '<td>'.$user->getNomUrl(1).'</td>';
|
||||||
print '<td>'.dol_print_date($start_date,'day');
|
print '<td>'.dol_print_date($start_date,'day');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.dol_print_date($end_date,'day');
|
print '<td>'.dol_print_date($end_date,'day');
|
||||||
|
|||||||
@ -43,7 +43,8 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
|
|||||||
|
|
||||||
|
|
||||||
$cp = new Holiday($db);
|
$cp = new Holiday($db);
|
||||||
$log_holiday = $cp->fetchLog('','');
|
//Recent changes are more important than old changes
|
||||||
|
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC','');
|
||||||
|
|
||||||
print_fiche_titre($langs->trans('LogCP'));
|
print_fiche_titre($langs->trans('LogCP'));
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ print '<td class="liste_titre">'.$langs->trans('ID').'</td>';
|
|||||||
print '<td class="liste_titre" align="center">'.$langs->trans('Date').'</td>';
|
print '<td class="liste_titre" align="center">'.$langs->trans('Date').'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('ActionByCP').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('ActionByCP').'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('UserUpdateCP').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('UserUpdateCP').'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('ActionTypeCP').'</td>';
|
print '<td class="liste_titre">'.$langs->trans('Description').'</td>';
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans('PrevSoldeCP').'</td>';
|
print '<td class="liste_titre" align="right">'.$langs->trans('PrevSoldeCP').'</td>';
|
||||||
print '<td class="liste_titre" align="right">'.$langs->trans('NewSoldeCP').'</td>';
|
print '<td class="liste_titre" align="right">'.$langs->trans('NewSoldeCP').'</td>';
|
||||||
|
|
||||||
@ -75,8 +76,8 @@ foreach($cp->logs as $logs_CP)
|
|||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$logs_CP['rowid'].'</td>';
|
print '<td>'.$logs_CP['rowid'].'</td>';
|
||||||
print '<td style="text-align: center;">'.$logs_CP['date_action'].'</td>';
|
print '<td style="text-align: center;">'.$logs_CP['date_action'].'</td>';
|
||||||
print '<td>'.$user_action->getFullName($langs).'</td>';
|
print '<td>'.$user_action->getNomUrl(1).'</td>';
|
||||||
print '<td>'.$user_update->getFullName($langs).'</td>';
|
print '<td>'.$user_update->getNomUrl(1).'</td>';
|
||||||
print '<td>'.$logs_CP['type_action'].'</td>';
|
print '<td>'.$logs_CP['type_action'].'</td>';
|
||||||
print '<td style="text-align: right;">'.$logs_CP['prev_solde'].' '.$langs->trans('days').'</td>';
|
print '<td style="text-align: right;">'.$logs_CP['prev_solde'].' '.$langs->trans('days').'</td>';
|
||||||
print '<td style="text-align: right;">'.$logs_CP['new_solde'].' '.$langs->trans('days').'</td>';
|
print '<td style="text-align: right;">'.$logs_CP['new_solde'].' '.$langs->trans('days').'</td>';
|
||||||
|
|||||||
@ -85,7 +85,6 @@ MenuLogCP=Преглед на извършените административ
|
|||||||
LogCP=Вход на актуализации на празниците
|
LogCP=Вход на актуализации на празниците
|
||||||
ActionByCP=В изпълнение на
|
ActionByCP=В изпълнение на
|
||||||
UserUpdateCP=За потребителя
|
UserUpdateCP=За потребителя
|
||||||
ActionTypeCP=Тип
|
|
||||||
PrevSoldeCP=Предишна баланс
|
PrevSoldeCP=Предишна баланс
|
||||||
NewSoldeCP=New Balance
|
NewSoldeCP=New Balance
|
||||||
alreadyCPexist=Искането за почивка вече е направено на този период.
|
alreadyCPexist=Искането за почивка вече е направено на този период.
|
||||||
|
|||||||
@ -80,7 +80,6 @@ MenuLogCP=Veure els logs de vacances
|
|||||||
LogCP=Logs d'actualitzacions de vacances
|
LogCP=Logs d'actualitzacions de vacances
|
||||||
ActionByCP=Realitzat per
|
ActionByCP=Realitzat per
|
||||||
UserUpdateCP=Per a l'usuari
|
UserUpdateCP=Per a l'usuari
|
||||||
ActionTypeCP=Tipus
|
|
||||||
PrevSoldeCP=Saldo anterior
|
PrevSoldeCP=Saldo anterior
|
||||||
NewSoldeCP=Nou saldo
|
NewSoldeCP=Nou saldo
|
||||||
alreadyCPexist=Ja s'ha efectuat una petició de vacances per a aquest període.
|
alreadyCPexist=Ja s'ha efectuat una petició de vacances per a aquest període.
|
||||||
|
|||||||
@ -80,7 +80,6 @@ MenuLogCP=View logs of holidays
|
|||||||
LogCP=Log of updates of holidays
|
LogCP=Log of updates of holidays
|
||||||
ActionByCP=Performed by
|
ActionByCP=Performed by
|
||||||
UserUpdateCP=For the user
|
UserUpdateCP=For the user
|
||||||
ActionTypeCP=Type
|
|
||||||
PrevSoldeCP=Previous Balance
|
PrevSoldeCP=Previous Balance
|
||||||
NewSoldeCP=New Balance
|
NewSoldeCP=New Balance
|
||||||
alreadyCPexist=A request for holidays has already been done on this period.
|
alreadyCPexist=A request for holidays has already been done on this period.
|
||||||
|
|||||||
@ -80,7 +80,6 @@ MenuLogCP=Ver los logs de vacaciones
|
|||||||
LogCP=Logs de actualizaciones de vacaciones
|
LogCP=Logs de actualizaciones de vacaciones
|
||||||
ActionByCP=Realizado por
|
ActionByCP=Realizado por
|
||||||
UserUpdateCP=Para el usuario
|
UserUpdateCP=Para el usuario
|
||||||
ActionTypeCP=Tipo
|
|
||||||
PrevSoldeCP=Saldo anterior
|
PrevSoldeCP=Saldo anterior
|
||||||
NewSoldeCP=Nuevo saldo
|
NewSoldeCP=Nuevo saldo
|
||||||
alreadyCPexist=Ya se ha efectuado una petición de vacaciones para este periodo.
|
alreadyCPexist=Ya se ha efectuado una petición de vacaciones para este periodo.
|
||||||
|
|||||||
@ -80,7 +80,6 @@ MenuLogCP=Voir les logs des congés
|
|||||||
LogCP=Logs des mises à jours des congés
|
LogCP=Logs des mises à jours des congés
|
||||||
ActionByCP=Réalisée par
|
ActionByCP=Réalisée par
|
||||||
UserUpdateCP=Pour l'utilisateur
|
UserUpdateCP=Pour l'utilisateur
|
||||||
ActionTypeCP=Type
|
|
||||||
PrevSoldeCP=Précédent Solde
|
PrevSoldeCP=Précédent Solde
|
||||||
NewSoldeCP=Nouveau Solde
|
NewSoldeCP=Nouveau Solde
|
||||||
alreadyCPexist=Une demande de congés à déjà été effectuée sur cette période.
|
alreadyCPexist=Une demande de congés à déjà été effectuée sur cette période.
|
||||||
|
|||||||
@ -78,7 +78,6 @@ MenuLogCP=Tatil kayıtlarını gör
|
|||||||
LogCP=Tatil güncellemeleri kayıtı
|
LogCP=Tatil güncellemeleri kayıtı
|
||||||
ActionByCP=Uygulayan
|
ActionByCP=Uygulayan
|
||||||
UserUpdateCP=Bu kullanıcı için
|
UserUpdateCP=Bu kullanıcı için
|
||||||
ActionTypeCP=Türü
|
|
||||||
PrevSoldeCP=Önceki Bakiye
|
PrevSoldeCP=Önceki Bakiye
|
||||||
NewSoldeCP=Yeni Bakiye
|
NewSoldeCP=Yeni Bakiye
|
||||||
alreadyCPexist=Bu dönem için bir tatil isteği zaten yapılmış.
|
alreadyCPexist=Bu dönem için bir tatil isteği zaten yapılmış.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user