9,6 → 9,8 |
|
require_once GTT_CHEMIN_METIER.'Projet.class.php'; |
require_once GTT_CHEMIN_METIER.'TravailProjet.class.php'; |
require_once GTT_CHEMIN_METIER.'Absence.class.php'; |
require_once GTT_CHEMIN_METIER.'AbsenceMotif.class.php'; |
require_once GTT_CHEMIN_METIER.'ProjetCategorie.class.php'; |
require_once GTT_CHEMIN_METIER.'Utilisateur.class.php'; |
require_once GTT_CHEMIN_METIER.'UtilisateurAProjet.class.php'; |
164,6 → 166,7 |
} |
|
// Récupération des infos sur les projets de l'utilisateur |
$aso_gestion['totaux'] = $aso_tps_w_vide; |
$Projet = new Projet(); |
$tab_p = $Projet->consulter(Projet::GP_ID_LIST, array(implode(',', $tab_projet_id))); |
foreach ($tab_p as $Projet) { |
176,10 → 179,16 |
|
// Nous vérifions le temps de travail pour ce projet pour la semaine courrante |
$aso_tps_w = $aso_tps_w_vide; |
if (!isset($aso_gestion['categorie_totaux'][$Categorie->getLibelle()])) { |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()] = $aso_tps_w_vide; |
} |
if ($tab_tp) { |
foreach ($tab_tp as $TP) { |
if ($TP->getIdProjet() == $Projet->getIdProjet()) { |
$aso_tps_w[$aso_jours[$TP->getIdDateTravail()]] = $TP->getDuree(); |
$num = $aso_jours[$TP->getIdDateTravail()]; |
$aso_tps_w[$num] = $TP->getDuree(); |
$aso_gestion['categorie_totaux'][$Categorie->getLibelle()][$num] += $TP->getDuree(); |
$aso_gestion['totaux'][$num] += $TP->getDuree(); |
} |
} |
} |
191,7 → 200,35 |
'nom' => $Projet->getNomProjet(), |
'date' => $aso_tps_w); |
|
|
} |
//+-------------------------------------------------------------------------------------------------+ |
// GESTION DES ABSENCES |
//+-------------------------------------------------------------------------------------------------+ |
// 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_gestion['sj_1']['mysql'], $aso_gestion['sj_7']['mysql']); |
$tab_a = $Absence->consulter($cmd, $param); |
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; |
} |
} |
} |
|
// 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; |
|
199,10 → 236,64 |
$this->getRegistre()->ajouterDonnee('gestion', $aso_gestion); |
} |
|
public function verifierValider() |
{ |
|
} |
|
public function executerValider() |
{ |
//echo '<pre>'.print_r($_POST, true).'</pre>'; |
|
// Récupération des info sur la semaine courrante |
$Week = new Calendar_Week($_GET['annee'], $_GET['mois'], $_GET['jour']); |
$Week->build(); |
$aso_jours = array(); |
$aso_semaine = array(); |
foreach($Week->fetchAll() as $num => $j) { |
$aso_semaine[$num]['mysql'] = $j->thisYear().'-'.sprintf("%02s", $j->thisMonth()).'-'.$j->thisDay(); |
$aso_jours[$aso_semaine[$num]['mysql']] = $num; |
} |
|
// Récupération du temps de travail pour un utilisateur à une date donnée |
$TravailProjet = new TravailProjet(); |
$cmd = TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN; |
$param = array($GLOBALS['_GTT_']['Utilisateur']->getIdUtilisateur(), $aso_semaine[1]['mysql'], $aso_semaine[7]['mysql']); |
$tab_tp = $TravailProjet->consulter($cmd, $param); |
if ($tab_tp && count($tab_tp) == 1) { |
$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(); |
} |
} |
} |
} |
} |
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(); |
} |
} |
} |
|
// Action suivante |
$this->setSuivant('__defaut__'); |
} |