Better fix for #4354
This commit is contained in:
parent
36df5a7325
commit
844e8bff83
@ -356,7 +356,7 @@ if ($action == 'confirm_send')
|
|||||||
if ($cp->getConfCP('AlertValidatorSolde'))
|
if ($cp->getConfCP('AlertValidatorSolde'))
|
||||||
{
|
{
|
||||||
$nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
|
$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.= "\n";
|
||||||
$message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
|
$message.= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
|
||||||
@ -413,14 +413,14 @@ if ($action == 'confirm_valid')
|
|||||||
// Calculcate number of days consummed
|
// Calculcate number of days consummed
|
||||||
$nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
|
$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'));
|
$newSolde = $soldeActuel - ($nbopenedday * $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->transnoentitiesnoconv("Holidays"), $newSolde);
|
$cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $cp->fk_type);
|
||||||
|
|
||||||
// Mise à jour du solde
|
// Mise à jour du solde
|
||||||
$cp->updateSoldeCP($cp->fk_user, $newSolde);
|
$cp->updateSoldeCP($cp->fk_user, $newSolde, $cp->fk_type);
|
||||||
|
|
||||||
// To
|
// To
|
||||||
$destinataire = new User($db);
|
$destinataire = new User($db);
|
||||||
@ -578,14 +578,14 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
|||||||
// Calculcate number of days consummed
|
// Calculcate number of days consummed
|
||||||
$nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
|
$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'));
|
$newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted'));
|
||||||
|
|
||||||
// On ajoute la modification dans le LOG
|
// 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
|
// 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)
|
if ($result1 < 0 || $result2 < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user