205,6 → 205,14 |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES ABSENCES |
//+-------------------------------------------------------------------------------------------------+ |
// Récupération des motifs d'absence |
$AbsenceMotif = new AbsenceMotif(); |
$cmd = AbsenceMotif::GAM_TOUS; |
$tab_am = $AbsenceMotif->consulter($cmd); |
if ($tab_am && count($tab_am) == 1) { |
$tab_am = array($tab_am); |
} |
|
// Récupération des absences pour un utilisateur à une date donnée |
$Absence = new Absence(); |
$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN; |
213,18 → 221,21 |
if ($tab_a && count($tab_a) == 1) { |
$tab_a = array($tab_a); |
} |
$aso_gestion['cp'] = $aso_tps_w_vide; |
$aso_gestion['rtt'] = $aso_tps_w_vide; |
if ($tab_a) { |
foreach ($tab_a as $A) { |
$num = $aso_jours[$A->getIdDateAbsence()]; |
switch ($A->getIdAbsenceMotif()) { |
case GTT_ABSCENCE_ID_CP : |
$aso_gestion['cp'][$num] = $A->getDuree(); |
break; |
case GTT_ABSCENCE_ID_RTT : |
$aso_gestion['rtt'][$num] = $A->getDuree(); |
break; |
|
$aso_gestion['ab_total'] = $aso_tps_w_vide; |
if ($tab_am) { |
foreach ($tab_am as $AM) { |
$aso_gestion['ab_libelle'][$AM->getIdAbsenceMotif()] = $AM->getLibelle(); |
$aso_gestion['ab'][$AM->getIdAbsenceMotif()] = $aso_tps_w_vide; |
if ($tab_a) { |
foreach ($tab_a as $A) { |
if ($A->getIdAbsenceMotif() == $AM->getIdAbsenceMotif()) { |
$num = $aso_jours[$A->getIdDateAbsence()]; |
$aso_gestion['ab'][$AM->getIdAbsenceMotif()][$num] = $A->getDuree(); |
$aso_gestion['ab_total'][$num] += $A->getDuree(); |
$aso_gestion['totaux'][$num] += $A->getDuree(); |
} |
} |
} |
} |
} |
232,7 → 243,7 |
// Création de l'url de réponse du formulaire |
$aso_gestion['url_gestion_valider'] = 'index.php?action='.GTT_ACTION_GESTION_VALIDER.$url_sc_param_date; |
|
//echo '<pre>'.print_r($aso_gestion, true).'</pre>'; |
//echo '<pre>ici '.print_r($aso_gestion['ab'], true).'la</pre>'; |
$this->getRegistre()->ajouterDonnee('gestion', $aso_gestion); |
} |
|
264,32 → 275,84 |
$tab_tp = array($tab_tp); |
} |
|
foreach($_POST['pr'] as $projet_id => $jours) { |
//echo '<pre>'.print_r($jours, true).'</pre>'; |
foreach($jours as $jour_num => $nbr_heure) { |
$bool_ajouter = true; |
foreach ($tab_tp as $TP) { |
if ($TP->getIdDateTravail() == $aso_semaine[$jour_num]['mysql']) { |
if ($TP->getIdProjet() == $projet_id) { |
$bool_ajouter = false; |
if ($TP->getDuree() != $nbr_heure && $TP->getIdProjet() == $projet_id) { |
if (empty($nbr_heure)) { |
$TP->supprimer(); |
} else { |
$TP->setDuree($nbr_heure); |
$TP->modifier(); |
// Ajout ou Mise à jour des durées de travail |
if (isset($_POST['pr'])) { |
foreach($_POST['pr'] as $projet_id => $jours) { |
//echo '<pre>'.print_r($jours, true).'</pre>'; |
foreach($jours as $jour_num => $nbr_heure) { |
$bool_ajouter = true; |
if (!empty($tab_tp)) { |
foreach ($tab_tp as $TP) { |
if ($TP->getIdDateTravail() == $aso_semaine[$jour_num]['mysql']) { |
if ($TP->getIdProjet() == $projet_id) { |
$bool_ajouter = false; |
if ($TP->getDuree() != $nbr_heure) { |
if (empty($nbr_heure)) { |
$TP->supprimer(); |
} else { |
$TP->setDuree($nbr_heure); |
$TP->modifier(); |
} |
} |
} |
} |
} |
} |
if ($bool_ajouter && !empty($nbr_heure)) { |
$TP = new TravailProjet(); |
$TP->setDuree((float)$nbr_heure); |
$TP->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur()); |
$TP->setIdProjet($projet_id); |
$TP->setIdDateTravail((string)$aso_semaine[$jour_num]['mysql']); |
$TP->ajouter(); |
} |
} |
if ($bool_ajouter && !empty($nbr_heure)) { |
$TP = new TravailProjet(); |
$TP->setDuree((float)$nbr_heure); |
$TP->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur()); |
$TP->setIdProjet($projet_id); |
$TP->setIdDateTravail((string)$aso_semaine[$jour_num]['mysql']); |
$TP->ajouter(); |
} |
} |
|
// Récupération des absences pour un utilisateur à une date donnée |
$Absence = new Absence(); |
$cmd = Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN; |
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_semaine[1]['mysql'], $aso_semaine[7]['mysql']); |
$tab_a = $Absence->consulter($cmd, $param); |
if ($tab_a && count($tab_a) == 1) { |
$tab_a = array($tab_a); |
} |
|
// Ajout ou Mise à jour des durées d'absences pour congés payés |
if (isset($_POST['ab'])) { |
//echo '<pre>'.print_r($_POST['ab'], true).'</pre>'; |
foreach($_POST['ab'] as $ab_id => $tab_num_j) { |
foreach($tab_num_j as $num_j => $ab_duree) { |
$bool_ajouter = true; |
if (!empty($tab_a)) { |
foreach ($tab_a as $A) { |
if ($A->getIdDateAbsence() == $aso_semaine[$num_j]['mysql']) { |
|
if ($A->getIdAbsenceMotif() == $ab_id) { |
$bool_ajouter = false; |
|
if ($A->getDuree() != $ab_duree) { |
echo 'ici'.$ab_duree; |
if (empty($ab_duree)) { |
$A->supprimer(); |
} else { |
$A->setDuree($ab_duree); |
$A->modifier(); |
} |
} |
} |
} |
} |
} |
if ($bool_ajouter && !empty($ab_duree)) { |
$A = new Absence(); |
$A->setDuree((float)$ab_duree); |
$A->setIdUtilisateur($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur()); |
$A->setIdAbsenceMotif($ab_id); |
$A->setIdDateAbsence((string)$aso_semaine[$num_j]['mysql']); |
$A->ajouter(); |
} |
} |
} |
} |