diff --git a/html/affiche_solde.php b/html/affiche_solde.php index 2491ccf..f6d321e 100644 --- a/html/affiche_solde.php +++ b/html/affiche_solde.php @@ -60,7 +60,7 @@ $mode = $_POST["mode"]; if ($mode == "") { - $mode = "resp"; + $mode = MODE_RESPONSABLE; } $structureid = null; @@ -89,7 +89,7 @@ $agentselect = $_POST["agentselect"]; } - if ($mode == 'rh') + if ($mode == MODE_RH) { $sql = "SELECT STRUCTUREID FROM STRUCTURE WHERE STRUCTUREIDPARENT = '' OR STRUCTUREIDPARENT NOT IN (SELECT DISTINCT STRUCTUREID FROM STRUCTURE) ORDER BY STRUCTUREIDPARENT"; // NOMLONG $query = mysqli_query($dbcon, $sql); @@ -143,7 +143,7 @@ echo "
"; } - elseif (strcasecmp($mode, "resp") == 0) + elseif (strcasecmp($mode, MODE_RESPONSABLE) == 0) { $structureliste = $user->structrespliste(); //var_dump("Avant appel enleverstructuresinclues_soldes"); diff --git a/html/ajouter_conges.php b/html/ajouter_conges.php index 8899f12..a1d4db0 100644 --- a/html/ajouter_conges.php +++ b/html/ajouter_conges.php @@ -73,7 +73,7 @@ $commentaire_supp = null; $ancienacquis_supp = null; $remove_array = null; - $mode = 'resp'; + $mode = MODE_RESPONSABLE; if (isset($_POST["nbr_jours_conges"])) { $nbr_jours_conges = $_POST["nbr_jours_conges"]; @@ -169,7 +169,7 @@ //echo "Ce n'est pas un tableau
"; } - if ($agentid == "" and strcasecmp($mode, "gestrh") == 0) // Si on est en mode gestrh et qu'aucun agent n'est selectionné + if ($agentid == "" and strcasecmp($mode, MODE_RH) == 0) // Si on est en mode gestrh et qu'aucun agent n'est selectionné { echo "
"; @@ -187,7 +187,7 @@ echo ""; echo "
"; } - elseif ($agentid == "") // On est pas en mode rh ==> Donc on est en mode "resp" + elseif ($agentid == "") // On est pas en mode rh ==> Donc on est en mode MODE_RESPONSABLE { echo "
"; diff --git a/html/class/affectation.php b/html/class/affectation.php index 1f857ef..f0d402d 100644 --- a/html/class/affectation.php +++ b/html/class/affectation.php @@ -416,10 +416,10 @@ function declarationTPliste($datedebut, $datefin) * @param boolean $pour_modif * optional if true and $affiche_declaTP=true, display the part time declaration in edit mode * @param boolean $mode - * optional if set to "resp" and $affiche_declaTP=true, display all part time declaration. if set to "agent" and $affiche_declaTP=true, display only part time declaration that are in current period + * optional if set to MODE_RESPONSABLE and $affiche_declaTP=true, display all part time declaration. if set to MODE_AGENT and $affiche_declaTP=true, display only part time declaration that are in current period * @return string HTML text of nomination */ - function html($affiche_declaTP = false, $pour_modif = false, $mode = "agent") + function html($affiche_declaTP = false, $pour_modif = false, $mode = MODE_AGENT) { $agent = new agent($this->dbconnect); $agent->load($this->agentid()); @@ -441,9 +441,9 @@ function html($affiche_declaTP = false, $pour_modif = false, $mode = "agent") if (! is_null($declarationliste)) { foreach ($declarationliste as $key => $declaration) { - // Si on est en mode "resp" (responsable de service) on affiche toutes les déclarations de TP + // Si on est en mode MODE_RESPONSABLE (responsable de service) on affiche toutes les déclarations de TP // qui sont liés à cette affectation - if (($this->fonctions->formatdatedb($declaration->datefin()) >= ($this->fonctions->anneeref() . $this->fonctions->debutperiode())) or strcasecmp((string)$mode, "resp") == 0) { + if (($this->fonctions->formatdatedb($declaration->datefin()) >= ($this->fonctions->anneeref() . $this->fonctions->debutperiode())) or strcasecmp((string)$mode, MODE_RESPONSABLE) == 0) { if (strcasecmp((string)$declaration->statut(), declarationTP::DECLARATIONTP_REFUSE) != 0) { if ($premiereligne) { $htmltext = $htmltext . "Tableau des temps partiels déclarés dans G2T pour " . $agent->identitecomplete() . "
"; @@ -467,7 +467,7 @@ function html($affiche_declaTP = false, $pour_modif = false, $mode = "agent") } if ($premiereligne) // Si on a affiché aucune ligne de déclaration de TP { - if (strcasecmp((string)$mode, "resp") == 0) // Si on est en mode responsable + if (strcasecmp((string)$mode, MODE_RESPONSABLE) == 0) // Si on est en mode responsable $htmltext = $htmltext . "" . $agent->identitecomplete() . " n'a aucune déclaration de temps partiel saisie dans G2T.
"; else $htmltext = $htmltext . "" . $agent->identitecomplete() . " n'a aucune déclaration de temps partiel active dans G2T.
"; diff --git a/html/class/agent.php b/html/class/agent.php index e36da87..b80f859 100644 --- a/html/class/agent.php +++ b/html/class/agent.php @@ -862,6 +862,16 @@ function estadministrateur() function estconsultant() { + $dbconstante = 'FONCTIONAVIS'; + $avisfonction = 'n'; + if ($this->fonctions->testexistdbconstante($dbconstante)) { $avisfonction = $this->fonctions->liredbconstante($dbconstante); } + if (!$this->fonctions->convertvaluetobool($avisfonction)) + { + // la fonction est désactivée => On retourne systématiquement false + return false; + } + + $sql = "SELECT AGENTID FROM COMPLEMENT WHERE COMPLEMENTID = ? AND VALEUR = ?"; $params = array($this->fonctions->my_real_escape_utf8(complement::AVIS_CONGES_LABEL), $this->fonctions->my_real_escape_utf8($this->agentid)); $query = $this->fonctions->prepared_select($sql, $params); @@ -1209,7 +1219,7 @@ function sendmail($destinataire = null, $objet = null, $message = null, $piecejo $msg .= "\r\n"; if (is_object($destinataire)) { - $msg .= "Bonjour " . $this->fonctions->utf8_encode(ucwords(mb_strtolower($destinataire->identitecomplete(),'UTF-8'))) . ",

"; + $msg .= "Bonjour " . mb_convert_case($destinataire->identitecomplete(), MB_CASE_TITLE) . ",

"; // $this->fonctions->utf8_encode(ucwords(mb_strtolower($destinataire->identitecomplete(),'UTF-8'))) . ",

"; } else { @@ -1227,12 +1237,12 @@ function sendmail($destinataire = null, $objet = null, $message = null, $piecejo // Si l'expéditeur n'est pas le CRON de G2T if (strcasecmp($this->agentid(), SPECIAL_USER_IDCRONUSER)!=0) { - $msg .= ucwords(mb_strtolower($this->prenom . " " . $this->nom),'UTF-8'); + $msg .= mb_convert_case($this->prenom . " " . $this->nom, MB_CASE_TITLE); // ucwords(mb_strtolower($this->prenom . " " . $this->nom),'UTF-8'); } else { - $msg .= "
"; + $msg .= "

Ce message est envoyé automatiquement par l'application G2T.
"; + $msg .= "Merci de ne pas répondre à cet e-mail.
La boîte aux lettres qui a généré cet e-mail ne traite pas les réponses.


"; } $msg .= "\r\n"; } @@ -1248,7 +1258,7 @@ function sendmail($destinataire = null, $objet = null, $message = null, $piecejo // if ($errormsg <> "") // { - $msg .= "

La pièce jointe est un fichier iCalendar contenant plus d'informations concernant l'événement.
Si votre client de courrier supporte les requêtes iTip vous pouvez utiliser ce fichier pour mettre à jour votre copie locale de l'événement.

"; + $msg .= "

La pièce jointe est un fichier iCalendar contenant plus d'informations concernant l'événement.
Si votre client de courrier supporte les requêtes iTip vous pouvez utiliser ce fichier pour mettre à jour votre copie locale de l'événement.

"; $msg .= "\r\n"; $msg .= "--$boundary\r\n"; $msg .= "Content-Type: text/calendar;name=\"conge.ics\";method=REQUEST;charset=\"utf-8\"\n"; @@ -2517,7 +2527,7 @@ function demandeslistepdf($datedebut, $datefin, $pdf = NULL, $header = TRUE) * optional type de demande à gérer (cet, ann20, ....) * @return string the html text of the array */ - function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = null, $mode = "agent", $cleelement = null) + function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = null, $mode = MODE_AGENT, $cleelement = null) { $longueurmaxmotif = $this->fonctions->logueurmaxcolonne('DEMANDE','MOTIFREFUS'); @@ -2571,14 +2581,14 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = foreach ($liste as $key => $demande) { // echo "demandeslistehtmlpourgestion => debut du for " . $demande->id() . "
"; - // if (($demande->statut() == "a" and $mode == "agent") or ($demande->statut() == "v" and $mode == "resp")) - if (((strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 or strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0) and strcasecmp($mode, "agent") == 0) - or (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, "resp") == 0)) + // if (($demande->statut() == "a" and $mode == MODE_AGENT) or ($demande->statut() == "v" and $mode == MODE_RESPONSABLE)) + if (((strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 or strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0) and strcasecmp($mode, MODE_AGENT) == 0) + or (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, MODE_RESPONSABLE) == 0)) { if ($premieredemande) { $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; - if ($mode=='agent') + if ($mode==MODE_AGENT) { $nbcolonne = 8; } @@ -2589,10 +2599,10 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = $htmltext = $htmltext . " "; /* $htmltext = $htmltext . " "; - if (strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 and strcasecmp($mode, "agent") == 0) + if (strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 and strcasecmp($mode, MODE_AGENT) == 0) $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; - if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, "resp") == 0) + if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, MODE_RESPONSABLE) == 0) $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; */ @@ -2602,13 +2612,13 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = "; - if (strcasecmp($mode, "agent") == 0) + if (strcasecmp($mode, MODE_AGENT) == 0) { $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; } $htmltext = $htmltext . ""; - if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, "resp") == 0) + if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, MODE_RESPONSABLE) == 0) { $htmltext = $htmltext . ""; } @@ -2627,7 +2637,7 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = $htmltext = $htmltext . " "; $htmltext = $htmltext . " "; $htmltext = $htmltext . " "; - if (strcasecmp($mode, "agent") == 0) + if (strcasecmp($mode, MODE_AGENT) == 0) { $htmltext = $htmltext . " "; @@ -2644,7 +2654,7 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = */ } $spanend = ''; - if ((strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, "agent") == 0)) + if ((strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, MODE_AGENT) == 0)) { $disable = ""; $datetorepostmail = date('Y-m-d', strtotime($this->fonctions->formatdatedb($demande->datemailannulation()). ' + 7 days')); @@ -2669,7 +2679,7 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = . "id() . "] id=cancelbutton[" . $demande->id() . "] class='cancelbutton g2tbouton g2tenvoibouton' value='Envoyer' onclick='if (this.tagname!=\"OK\") {click_element(\"cancelbutton[" . $demande->id() . "]\"); return false; }'"; //$spanend = ""; } - elseif ((strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 and strcasecmp($mode, "agent") == 0)) + elseif ((strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0 and strcasecmp($mode, MODE_AGENT) == 0)) { $htmltext = $htmltext . ""; - if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, "resp") == 0) + if (strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0 and strcasecmp($mode, MODE_RESPONSABLE) == 0) { $textareastyle = " class='commenttextarea"; $disabletext = " disabled "; @@ -2814,91 +2824,116 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = * date of the ending of the interval * @param string $agentid * optional the structure's responsable identifier - * @param string $structureid - * optional deprecated parameter => not used in code - * @param string $cleelement + * @param string $mode * optional deprecated parameter => not used in code * @return string the html text of the array */ - function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agentid = null, $mode = 'resp') + function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agentid = null, $mode = MODE_RESPONSABLE) { - $longueurmaxmotif = $this->fonctions->logueurmaxcolonne('DEMANDE','MOTIFREFUS'); - $liste = null; - $liste = $this->demandesliste($debut_interval, $fin_interval); - $debut_interval = $this->fonctions->formatdatedb($debut_interval); - $fin_interval = $this->fonctions->formatdatedb($fin_interval); - - // $liste=$this->demandesliste($debut_interval,$fin_interval); - // foreach ($this->structure()->structurefille() as $key => $value) - // { - // echo "Structure fille = " . $value->nomlong() . "
"; - // $listerespsousstruct = $value->responsable()->demandesliste($debut_interval,$fin_interval); - // $liste = array_merge($liste,$listerespsousstruct); - // } - - // echo "#######liste (Count=" . count($liste) .") = "; print_r($liste); echo "
"; - $statutliste = array(); if (isset($_POST["statut"])) { $statutliste = $_POST['statut']; } + if (isset($_POST["mode"])) + { + $mode = $_POST['mode']; + } + + $dbconstante = 'FONCTIONAVIS'; + $avisfonction = 'n'; + if ($this->fonctions->testexistdbconstante($dbconstante)) { $avisfonction = $this->fonctions->liredbconstante($dbconstante); } + + + // Si on est en mode MODE_CONSULTANT => Le motif est enregistré dans la colonne VALEUR de la table COMPLEMENTDEMANDE + if (strcasecmp($mode,MODE_CONSULTANT)==0) + { + $longueurmaxmotif = $this->fonctions->logueurmaxcolonne('DEMANDECOMPLEMENT','VALEUR'); + } + // SInon on demande la taille de la colonne MOTIFREFUS de la table DEMANDE + else + { + $longueurmaxmotif = $this->fonctions->logueurmaxcolonne('DEMANDE','MOTIFREFUS'); + } + + $liste = null; + $liste = $this->demandesliste($debut_interval, $fin_interval); + $debut_interval = $this->fonctions->formatdatedb($debut_interval); + $fin_interval = $this->fonctions->formatdatedb($fin_interval); + // echo "#######liste (Count=" . count($liste) .") = "; print_r($liste); echo "
"; + $htmltext = ""; // $htmltext = "
"; if (count($liste) == 0) { // $htmltext = $htmltext . " "; - } else { + } + else + { $premieredemande = TRUE; foreach ($liste as $key => $demande) { if (strcasecmp($demande->statut(), demande::DEMANDE_ATTENTE) == 0) { $todisplay = true; + // Si on est en mode MODE_CONSULTANT + if (strcasecmp($mode,MODE_CONSULTANT)==0) + { + $demandecomplement = new demandecomplement($this->dbconnect); + $demandecomplement->load($demande->id(),demandecomplement::DEMANDE_AVIS_STATUT_LABEL); + // Si on a déjà un avis du consultant => On n'affiche pas la demande + if ($demandecomplement->demandeid()==$demande->id()) + { + $todisplay = false; + } + } // On n'affiche pas les demandes du responsable !!!! - if ($agentid == $this->agentid) { + elseif ($agentid == $this->agentid) { $todisplay = false; } // echo "todisplay = $todisplay
"; if ($todisplay) { if ($premieredemande) { $htmltext = $htmltext . "
Gestion des demandes pour " . $this->civilite() . " " . $this->nom() . " " . $this->prenom() . "
Date de demandeDate de débutDate de finType de demandeNbre joursCommentaireAnnulerMotif (obligatoire si le congé est annulé)
Date de fin Type de demande Nbre jours Statut CommentaireAnnulerMotif (obligatoire si le congé est annulé) - maximum $longueurmaxmotif caractères" . $demande->typelibelle() . "" . $demande->nbrejrsdemande() . "" . $this->fonctions->demandestatutlibelle($demande->statut()) . "" @@ -2689,7 +2699,7 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = } } $htmltext = $htmltext . " onclick='backcolormotif(this," . $demande->id() . ");' > $spanend
L'agent n'a aucun congé posé pour la période de référence en cours.
"; - $htmltext = $htmltext . " "; + // Si on est en mode MODE_CONSULTANT + if (strcasecmp($mode,MODE_CONSULTANT)==0) + { + $htmltext = $htmltext . " "; + } + else + { + $htmltext = $htmltext . " "; + } $htmltext = $htmltext . " - - - "; + "; + // Si on est en mode MODE_CONSULTANT + if (strcasecmp($mode,MODE_CONSULTANT)==0) + { + $htmltext = $htmltext . " "; + } + else + { + $htmltext = $htmltext . " "; + } + $htmltext = $htmltext . " "; $premieredemande = FALSE; } $htmltext = $htmltext . ""; // $htmltext = $htmltext . " "; - + $htmltext = $htmltext . " "; $htmltext = $htmltext . " "; $htmltext = $htmltext . " "; if ($demande->type() == 'enmal') { $htmltext = $htmltext . " "; } -/* -* elseif ($this->fonctions->absencecommentaireoblig($demande->type())) -* { -* $datatitle = ''; -* if (strlen($demande->commentaire()) != 0) -* { -* $datatitle = " data-title=" . chr(34) . htmlentities($this->fonctions->ajoute_crlf($demande->commentaire(),60)) . chr(34); -* } -* $htmltext = $htmltext . " "; -* } -*/ else { $libelledemande = $this->fonctions->tronque_chaine($demande->typelibelle(),40, true); @@ -2923,7 +2958,38 @@ function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agenti $datatitleindicator = " 📃"; } $htmltext = $htmltext . " "; - $htmltext = $htmltext . " "; @@ -2997,8 +3106,10 @@ function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agenti // $htmltext = $htmltext . " "; $htmltext = $htmltext . " "; + . " ") + . " "; $htmltext = $htmltext . ""; } } diff --git a/html/class/demandecomplement.php b/html/class/demandecomplement.php new file mode 100644 index 0000000..b5764f4 --- /dev/null +++ b/html/class/demandecomplement.php @@ -0,0 +1,202 @@ +dbconnect = $db; + if (is_null($this->dbconnect)) { + $errlog = "DemandeComplement->construct : La connexion à la base de donnée est NULL !!!"; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $fonctions->stripAccents($errlog)); + } + $this->fonctions = new fonctions($db); + } + + /** + * + * @param string $demandeid + * identifier of the demande + * @param string $complementid + * identifier of the complement + * @return + */ + function load($demandeid, $complementid) + { + $sql = "SELECT DEMANDEID,COMPLEMENTID,VALEUR FROM DEMANDECOMPLEMENT WHERE DEMANDEID=? AND COMPLEMENTID=?"; + $params = array($demandeid,$complementid); + $query = $this->fonctions->prepared_select($sql, $params); + $erreur = mysqli_error($this->dbconnect); + if ($erreur != "") { + $errlog = "DemandeComplement->Load : " . $erreur; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + if (mysqli_num_rows($query) != 0) { + $result = mysqli_fetch_row($query); + $this->demandeid = "$result[0]"; + $this->complementid = "$result[1]"; + $this->valeur = "$result[2]"; + } else { + $this->demandeid = ""; + $this->complementid = ""; + $this->valeur = ""; + } + } + + /** + * + * @param + * @return + */ + function store() + { + if (strlen($this->demandeid) == 0 or strlen($this->complementid) == 0) { + $errlog = "DemandeComplement->Store : Le numéro DEMANDEID (" . $this->demandeid . ") ou le code du complément (" . $this->complementid . ") n'est pas initialisé"; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + return $errlog; + } + $this->delete($this->demandeid,$this->complementid); + + $sql = "INSERT INTO DEMANDECOMPLEMENT(DEMANDEID,COMPLEMENTID,VALEUR) VALUES(?,?,?)"; + $params = array($this->demandeid,$this->complementid,$this->valeur); + $query = $this->fonctions->prepared_query($sql, $params); + + $erreur = mysqli_error($this->dbconnect); + if ($erreur != "") { + $errlog = "DemandeComplement->Store (INSERT) : " . $erreur; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + return $erreur; + } + + /** + * + * @param + * @return + */ + function delete($demandeid, $complementid) + { + $sql = "DELETE FROM DEMANDECOMPLEMENT WHERE DEMANDEID=? AND COMPLEMENTID=?"; + $params = array($demandeid,$complementid); + $query = $this->fonctions->prepared_query($sql, $params); + + $erreur = mysqli_error($this->dbconnect); + if ($erreur != "") { + $errlog = "DemandeComplement->delete : " . $erreur; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + return $erreur; + } + + + /** + * + * @param string $demandeid + * identifier of the demande + * @return string the identifier of the demande if $demandeid is not set + */ + function demandeid($demandeid = null) + { + if (is_null($demandeid)) { + if (is_null($this->demandeid)) { + $errlog = "DemandeComplement->demandeid : L'Id de la demande n'est pas défini !!!"; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + else + { + return $this->demandeid; + } + } + else + { + $this->demandeid = $demandeid; + } + } + + /** + * + * @param string $complementid + * identifier of the complement + * @return string the identifier of the complement if $complementid is not set + */ + function complementid($complementid = null) + { + if (is_null($complementid)) { + if (is_null($this->complementid)) { + $errlog = "DemandeComplement->complementid : L'Id du complément n'est pas défini !!!"; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + else + { + return $this->complementid; + } + } + else + { + $this->complementid = $complementid; + } + } + + /** + * + * @param string $valeur + * value of the complement + * @return string the value of the complement if $valeur is not set + */ + function valeur($valeur = null) + { + if (is_null($valeur)) { + if (is_null($this->valeur)) { + $errlog = "DemandeComplement->valeur : La valeur du complément n'est pas définie !!!"; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + else + { + return $this->valeur; + } + } + else + { + $this->valeur = $valeur; + } + } +} + +?> \ No newline at end of file diff --git a/html/class/fonctions.php b/html/class/fonctions.php index 515cfb9..5226ebe 100644 --- a/html/class/fonctions.php +++ b/html/class/fonctions.php @@ -1103,6 +1103,31 @@ public function demandestatutlibelle($statut = null) } } + public function demandeavislibelle($statut = null) + { + if (strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) + { + return "Favorable"; + } + elseif (strcmp($statut, demande::DEMANDE_REFUSE) == 0) + { + return "Défavorable"; + } + elseif (strcasecmp($statut, demande::DEMANDE_ATTENTE) == 0) + { + return "En attente"; + } + elseif (strcasecmp($statut, demande::DEMANDE_AVIS) == 0) + { + return "Demande d'avis"; + } + else + { + echo "Demandeavislibelle : le statut n'est pas connu [statut = $statut] !!!
"; + } + } + + public function teletravailstatutlibelle($statut = null) { if (strcasecmp($statut, teletravail::TELETRAVAIL_VALIDE) == 0) @@ -5303,7 +5328,7 @@ function mailbody_avis(demande $demande) : string { $corpmail = $corpmail . " d'absence "; } - $corpmail = $corpmail . "(" . $demande->typelibelle() . ") de " . $agent->identitecomplete() . " du " . $demande->datedebut() . " au " . $demande->datefin() . " (" . $demande->nbrejrsdemande(); + $corpmail = $corpmail . "(" . $demande->typelibelle() . ") de " . mb_convert_case($agent->identitecomplete(), MB_CASE_TITLE) . " du " . $demande->datedebut() . " au " . $demande->datefin() . " (" . $demande->nbrejrsdemande(); if ($demande->nbrejrsdemande()>1) { $corpmail = $corpmail . " jours"; @@ -5313,7 +5338,7 @@ function mailbody_avis(demande $demande) : string $corpmail = $corpmail . " jour"; } $corpmail = $corpmail . ") nécessite votre attention."; - $corpmail = $corpmail . "\n\nMerci d'indiquer à " . $resp->identitecomplete() . " votre avis.\n"; + $corpmail = $corpmail . "\n\nMerci d'indiquer à " . mb_convert_case($resp->identitecomplete(), MB_CASE_TITLE) . " votre avis.\n"; } return $corpmail; } diff --git a/html/class/structure.php b/html/class/structure.php index 56db0a8..e7bbc27 100644 --- a/html/class/structure.php +++ b/html/class/structure.php @@ -1407,18 +1407,29 @@ function dossierhtml($pourmodif = FALSE, $responsableid = NULL) // echo "strucutre->dossierhtml : Non refaite !!!!!
"; // return null; $WSGROUPURL = $this->fonctions->liredbconstante("WSGROUPURL"); - + + $nbcolonne = 5; + $dbconstante = 'FONCTIONAVIS'; + $avisfonction = 'n'; + if ($this->fonctions->testexistdbconstante($dbconstante)) { $avisfonction = $this->fonctions->liredbconstante($dbconstante); } + if (!$this->fonctions->convertvaluetobool($avisfonction)) + { + // la fonction est désactivée + $nbcolonne--; + } $htmltext = "
"; $htmltext = "
Demandes à valider pour " . $this->civilite() . " " . $this->nom() . " " . $this->prenom() . "
Avis à donner pour " . $this->civilite() . " " . $this->nom() . " " . $this->prenom() . "
Demandes à valider pour " . $this->civilite() . " " . $this->nom() . " " . $this->prenom() . "
Date de demande Date de début Date de fin Type de demande Nbre joursEtat de la demandeMotif (obligatoire si le congé est refusé) - maximum $longueurmaxmotif caractères
Etat de la demandeMotif (obligatoire si l'avis est défavorable) - maximum $longueurmaxmotif caractèresMotif (obligatoire si la demande est refusée) - maximum $longueurmaxmotif caractères
" . $this->nom() . " " . $this->prenom() . "" . $demande->date_demande() . " " . $demande->heure_demande() . "" . $this->fonctions->nomjour($demande->datedebut()) . " " . $demande->datedebut() . " " . $this->fonctions->nommoment($demande->moment_debut()) . "" . $this->fonctions->nomjour($demande->datefin()) . " " . $demande->datefin() . " " . $this->fonctions->nommoment($demande->moment_fin()) . "" . $demande->typelibelle() . " (" . $this->nbjrsenfantmaladeutilise($debut_interval, $fin_interval) . "/" . $this->nbjrsenfantmalade() . ")"; -* $htmltext = $htmltext . $demande->typelibelle(); -* $htmltext = $htmltext . "" . $demande->nbrejrsdemande() . $datatitleindicator . ""; + + $datatitle = ''; + if (strcasecmp($mode,MODE_CONSULTANT)!=0 and $this->fonctions->convertvaluetobool($avisfonction)) + { + $texteavis = ''; + // On cherche le statut de l'avis + $demandecomplement = new demandecomplement($this->dbconnect); + $demandecomplement->load($demande->id(),demandecomplement::DEMANDE_AVIS_STATUT_LABEL); + if ($demandecomplement->demandeid()==$demande->id()) + { + if (strcasecmp($demandecomplement->valeur(),demande::DEMANDE_REFUSE)==0) + { + $texteavis = $texteavis . "Avis défavorable : "; + $demandecomplement = new demandecomplement($this->dbconnect); + $demandecomplement->load($demande->id(),demandecomplement::DEMANDE_AVIS_MOTIF_LABEL); + if ($demandecomplement->demandeid()==$demande->id()) + { + $texteavis = $texteavis . $demandecomplement->valeur(); + } + } + else + { + $texteavis = $texteavis . "Avis favorable"; + } + } + if (trim($texteavis) != '') + { + $datatitle = " data-title=" . chr(34) . htmlentities($texteavis) . chr(34); + } + } + + $htmltext = $htmltext . " "; // Si on a demandé l'avis => On force le statut à "En attente" pour éviter de reposter la demande d'avis // en cas d'enregistrement d'une modification sur une autre demande @@ -2935,6 +3001,7 @@ function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agenti $htmltext = $htmltext . " "; $htmltext = $htmltext . "" - . "" - . "
"; - $nbcolonne = 5; $htmltext = $htmltext . ""; $htmltext = $htmltext . "" . "" . "" . "" - . "" - . "" - . ""; + . ""; + if ($this->fonctions->convertvaluetobool($avisfonction)) + { + $htmltext = $htmltext . ""; + } + $htmltext = $htmltext . ""; $agentliste = $this->agentlist(date('d/m/Y'), date('d/m/Y'), 'n'); // Si on est en mode 'responsable' <=> le code du responsable de la structure est passé en paramètre @@ -1548,57 +1559,45 @@ function dossierhtml($pourmodif = FALSE, $responsableid = NULL) } $htmltext = $htmltext . ""; - // Ajout des conventions "télétravail" - $htmltext = $htmltext . ""; } - $htmltext = $htmltext . "' size=40 $style/>$extrainfo"; - // - $htmltext = $htmltext . " "; - $htmltext = $htmltext . " - - "; - - -// $htmltext = $htmltext . ""; - - $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; } diff --git a/html/creer_cet.php b/html/creer_cet.php index 9ffd06b..5281576 100644 --- a/html/creer_cet.php +++ b/html/creer_cet.php @@ -130,7 +130,7 @@ echo "Si vous souhaitez transférer des reliquats de congés, vous devez utiliser la fonction 'Alimentation / Indemnisation des CET'.
"; echo "
"; - if (strcasecmp($mode, "gestrh") == 0) { + if (strcasecmp($mode, MODE_RH) == 0) { echo "Personne à rechercher :
"; echo ""; diff --git a/html/etablir_demande.php b/html/etablir_demande.php index d509335..f15fc33 100644 --- a/html/etablir_demande.php +++ b/html/etablir_demande.php @@ -523,8 +523,8 @@ function planning_rclick(date,moment) if (strcasecmp($rh_mode, "yes") == 0) { - // On est en mode "RH" donc on ignore la présence/absence de l'agent - //echo 'On est en mode "RH" donc on ignore la présence/absence de l agent
'; + // On est en mode MODE_RH donc on ignore la présence/absence de l'agent + //echo 'On est en mode MODE_RH donc on ignore la présence/absence de l agent
'; $ignoreabsenceautodecla = TRUE; } diff --git a/html/g2t_param.php b/html/g2t_param.php index 23657c1..4cfc17b 100644 --- a/html/g2t_param.php +++ b/html/g2t_param.php @@ -228,6 +228,15 @@ } } + ///////////////////////////////////////////// + // Mise à jour de la fonction de demande d'avis sur congés et absence + if (isset($_POST['valid_avisfonction'])) + { + $avisfonction = $_POST['avisfonction']; + $constantename = "FONCTIONAVIS"; + $msg_erreur = $fonctions->enregistredbconstante($constantename, $avisfonction); + } + ///////////////////////////////////////////// // Mise à jour de la date des reports de congés if (isset($_POST['valid_report'])) @@ -1532,6 +1541,42 @@ echo ""; echo ""; + ///////////////////////////////////////////////////////// + // Activation/Désactivation fonctions demande d'avis pour une demande + echo "
"; + echo ""; + $dbconstante = 'FONCTIONAVIS'; + $avisfonction = 'n'; + echo "Activer la fonction de demande d'avis pour les congés et les absences : "; + if ($fonctions->testexistdbconstante($dbconstante)) { $avisfonction = $fonctions->liredbconstante($dbconstante); } + echo ""; + + echo "
"; + + echo ""; + echo ""; + echo "
"; + echo ""; + echo ""; + + ///////////////////////////////////////////////////////// // Affichage de la date de fin de report des congés echo "
"; diff --git a/html/gerer_alimentationCET.php b/html/gerer_alimentationCET.php index a4f2e38..7580be6 100644 --- a/html/gerer_alimentationCET.php +++ b/html/gerer_alimentationCET.php @@ -133,7 +133,7 @@ if (isset($_POST["responsable"])) $responsable = $_POST["responsable"]; - $mode = "agent"; + $mode = MODE_AGENT; if (isset($_POST["mode"])) $mode = $_POST["mode"]; @@ -173,8 +173,8 @@ // echo "


"; - // Si on est en mode 'rh' et qu'on n'a pas encore choisi l'agent, on affiche la zone de sélection. - if (is_null($agentid) and $mode == 'rh') + // Si on est en mode MODE_RH et qu'on n'a pas encore choisi l'agent, on affiche la zone de sélection. + if (is_null($agentid) and $mode == MODE_RH) { echo ""; echo "Personne à rechercher :
"; @@ -782,7 +782,7 @@ function update_case(elem) //} */ echo "

"; - if ($mode == 'rh') + if ($mode == MODE_RH) { echo "

Ne pas contrôler le plafond d'alimentation CET.



"; ?> diff --git a/html/gerer_cet.php b/html/gerer_cet.php index 7e564ad..e4284aa 100644 --- a/html/gerer_cet.php +++ b/html/gerer_cet.php @@ -117,7 +117,7 @@ // Fin du forçage de l'affichage de l'image d'attente - if (strcasecmp($mode, "gestrh") == 0) { + if (strcasecmp($mode, MODE_RH) == 0) { echo "Personne à rechercher :
"; echo ""; diff --git a/html/gerer_cet_hors_esignature.php b/html/gerer_cet_hors_esignature.php index 5157855..3707d4b 100644 --- a/html/gerer_cet_hors_esignature.php +++ b/html/gerer_cet_hors_esignature.php @@ -96,7 +96,7 @@ //print_r($_POST); echo "

"; - if (strcasecmp($mode, "gestrh") == 0) { + if (strcasecmp($mode, MODE_RH) == 0) { echo "Personne à rechercher :
"; echo ""; diff --git a/html/gerer_optionCET.php b/html/gerer_optionCET.php index 7f78add..4b9aa27 100644 --- a/html/gerer_optionCET.php +++ b/html/gerer_optionCET.php @@ -138,7 +138,7 @@ $esignatureid_delete = $_POST["esignatureid_delete"]; } - $mode = "agent"; + $mode = MODE_AGENT; if (isset($_POST["mode"])) { $mode = $_POST["mode"]; @@ -161,8 +161,8 @@ $anneeref = $fonctions->anneeref(); - // Si on est en mode 'rh' et qu'on n'a pas encore choisi l'agent, on affiche la zone de sélection. - if (is_null($agentid) and $mode == 'rh') + // Si on est en mode MODE_RH et qu'on n'a pas encore choisi l'agent, on affiche la zone de sélection. + if (is_null($agentid) and $mode == MODE_RH) { echo ""; echo "Personne à rechercher :
"; @@ -852,7 +852,7 @@ function update_case() echo ""; echo ""; - if ($mode == 'rh') + if ($mode == MODE_RH) { echo "L'agent " . $agent->identitecomplete() . " a $valeur_h jour(s) à répartir."; } diff --git a/html/gestion_demande.php b/html/gestion_demande.php index 19455b0..11f9471 100644 --- a/html/gestion_demande.php +++ b/html/gestion_demande.php @@ -83,7 +83,7 @@ $responsable = new agent($dbcon); $responsable->load($responsableid); $noresponsableset = FALSE; - $mode='resp'; + $mode = MODE_RESPONSABLE; } } if (isset($_POST["gestionnaireid"])) { @@ -260,7 +260,7 @@ if ($noresponsableset and (is_null($mode) or $mode == '')) { // => C'est un agent qui veut gérer ses demandes //echo "Pas de responsable.... C'est un agent qui veut gérer ses demandes
"; - $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), "agent", null); + $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), MODE_AGENT, null); if ($htmltext != "") { echo $htmltext; @@ -276,11 +276,11 @@ } elseif ($noagentset) { - if ($mode == 'resp' or $mode == 'gest') + if ($mode == MODE_RESPONSABLE or $mode == 'gest') { // => On est en mode "responsable" mais aucun agent n'est sélectionné // echo "Avant le chargement structure responsable
"; - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { $agentlistefull = $responsable->listeagentenresponsabilite(date("d/m/Y"), date("d/m/Y")); } @@ -351,7 +351,7 @@ } echo "
"; } - else // $mode = 'rh' + else // $mode = MODE_RH { echo "Personne à rechercher :
"; echo ""; @@ -368,10 +368,10 @@ echo ""; echo "
"; } - } elseif ($mode == 'resp' or $mode == 'gest') { + } elseif ($mode == MODE_RESPONSABLE or $mode == 'gest') { // => On est en mode "reponsable" et un agent est sélectionné //echo "Avant le mode responsable
"; - $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), "resp", null); + $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), MODE_RESPONSABLE, null); if ($htmltext != "") { echo $htmltext; @@ -389,7 +389,7 @@ // On élargie de période de début de recherche des demades de CET pour l'agent à -2 ans. //echo "Mode RH
"; $debut = $fonctions->formatdate(($fonctions->anneeref() - 2) . $fonctions->debutperiode()); - $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), "resp", 'cet'); + $htmltext = $agent->demandeslistehtmlpourgestion($debut, $fin, $user->agentid(), MODE_RESPONSABLE, 'cet'); if ($htmltext != "") { echo $htmltext; @@ -405,7 +405,7 @@ if ($responsableid != "") { - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { echo ""; } diff --git a/html/gestion_dossier.php b/html/gestion_dossier.php index 9ad81f5..9a2c260 100644 --- a/html/gestion_dossier.php +++ b/html/gestion_dossier.php @@ -43,7 +43,7 @@ $mode = $_POST["mode"]; // Action = gestion ou resp if (is_null($action) or $action == "") { - $action = 'resp'; + $action = MODE_RESPONSABLE; } // echo "Apres le chargement du user !!!
"; @@ -52,7 +52,7 @@ // echo ''; echo "
"; - print_r ( $_POST); echo "
"; echo "action = $action
"; + //print_r ( $_POST); echo "
"; echo "action = $action
"; $reportlist = null; if (isset($_POST['report'])) @@ -612,11 +612,11 @@ echo $fonctions->showmessage(fonctions::MSGERROR, "$msgerreur"); } echo ""; - if ($mode == 'resp') { + if ($mode == MODE_RESPONSABLE) { $structliste = $user->structrespliste(); $structrespliste = $user->structrespliste(false); } - if ($mode == 'gestion') { + if ($mode == MODE_GESTION) { $structliste = $user->structgestliste(); $structrespliste = array(); } @@ -628,7 +628,7 @@ foreach ($structliste as $key => $structure) { $responsableliste = array(); // On ajoute les responsables de structures filles - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { $structurefilleliste = $structure->structurefille(); if (is_array($structurefilleliste)) @@ -651,7 +651,7 @@ if (is_array($structure->agentlist(date('d/m/Y'), date('d/m/Y'), 'n')) or count($responsableliste)>0) { - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { echo $structure->dossierhtml(($action == 'modif'), $userid); } @@ -689,7 +689,7 @@ echo ""; echo ""; - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { // La possibilité de gérer tous les agents des structures inclues n'est offerte que si on est dans la strcuture "racine" (<=> non inclue) if (!$structure->isincluded()) @@ -853,7 +853,7 @@ // echo $fonctions->ouinonlibelle($structure->respvalidsousstruct()); // } - if ($mode == 'resp') + if ($mode == MODE_RESPONSABLE) { // echo "
"; echo ""; @@ -920,7 +920,7 @@ echo "
"; - if ($mode == 'resp') { + if ($mode == MODE_RESPONSABLE) { $structure->agent_envoyer_a($codeinterne); echo "
Gestion des dossiers pour la structure " . $this->nomlong() . " (" . $this->nomcourt() . ")
AgentReport des congésNbre jours 'Garde d'enfant'Convention de télétravailSoliciter un avis pour les demandes de congés/d'absence
Convention de télétravailSolliciter un avis pour les demandes de congés/d'absences
"; - $aviscomplement = new complement($this->dbconnect); - $aviscomplement->load($membre->agentid(),complement::AVIS_CONGES_LABEL); - - $htmltext = $htmltext . "agentid()==$membre->agentid() and $aviscomplement->valeur()!='') + // Ajout de la fonction de demande d'avis + if ($this->fonctions->convertvaluetobool($avisfonction)) { - $useravis = new agent($this->dbconnect); - $useravis->load($aviscomplement->valeur()); - $htmltext = $htmltext . $useravis->identitecomplete(); - if (!$useravis->isG2tUser()) + $htmltext = $htmltext . ""; + $aviscomplement = new complement($this->dbconnect); + $aviscomplement->load($membre->agentid(),complement::AVIS_CONGES_LABEL); + + $htmltext = $htmltext . "agentid()==$membre->agentid() and $aviscomplement->valeur()!='') { - $style = " class='kobackgroundtext' "; - $extrainfo = " 🠨 L'utilisateur défini n'a pas accès à l'application G2T. Veuillez le modifier."; + $useravis = new agent($this->dbconnect); + $useravis->load($aviscomplement->valeur()); + $htmltext = $htmltext . $useravis->identitecomplete(); + if (!$useravis->isG2tUser()) + { + $style = " class='kobackgroundtext' "; + $extrainfo = " 🠨 L'utilisateur défini n'a pas accès à l'application G2T. Veuillez le modifier."; + } } + $htmltext = $htmltext . "' size=40 $style/>$extrainfo"; + // + $htmltext = $htmltext . " "; + $htmltext = $htmltext . " + + "; + $htmltext = $htmltext . "
"; echo ""; diff --git a/html/gestion_structure.php b/html/gestion_structure.php index d6e2d97..7f74bfc 100644 --- a/html/gestion_structure.php +++ b/html/gestion_structure.php @@ -395,7 +395,7 @@ // echo "Avant l'affichage du nom...
"; echo ""; echo " "; echo ""; } - if ($mode=='gestrh' or $esignatureactive) + if ($mode==MODE_RH or $esignatureactive) { // echo "
" . $struct->nomcourt() . " (" . $struct->id() . ") - " . $struct->nomlong() . " - Responsable G2T : " . $struct->responsablesiham()->identitecomplete() . " "; echo "id(); ?>() echo "
"; } - if ($mode == 'gestrh') + if ($mode == MODE_RH) { ?>
"; - if ($teletravail->statut() == teletravail::TELETRAVAIL_VALIDE and $mode=='gestrh') + if ($teletravail->statut() == teletravail::TELETRAVAIL_VALIDE and $mode==MODE_RH) { // On peut modifier la date de début de la convention dans une période de 6 mois avant la date saisie $datedebutminconv_tab = date("d/m/Y", strtotime("-" . $nbmonthsprevious . " month", strtotime($fonctions->formatdatedb($datedebutteletravail)))); @@ -1300,7 +1300,7 @@ } echo "
"; - if ($teletravail->statut() == teletravail::TELETRAVAIL_VALIDE and $mode=='gestrh') + if ($teletravail->statut() == teletravail::TELETRAVAIL_VALIDE and $mode==MODE_RH) { // $datefinminconv_tab = date("d/m/Y", strtotime("-6 month", strtotime($fonctions->formatdatedb($datefinteletravail)))); $datefinminconv_tab = $datedebutminconv_tab; @@ -1360,15 +1360,15 @@ echo "
" . $teletravail->esignatureid() . "".(($teletravail->statut() == teletravail::TELETRAVAIL_ANNULE) ? '':$teletravail->esignatureurl())."
"; echo ""; - if (strcasecmp($mode, "resp") == 0) + if (strcasecmp($mode, MODE_RESPONSABLE) == 0) { $structureliste = $user->structrespliste(); $structureliste = $fonctions->enleverstructuresinclues_planning($structureliste); @@ -730,16 +732,7 @@ } } } - - - -/* - $structincluelist = $fonctions->listestructurenoninclue(); - echo "Liste des id de structures non inclue :" ; - var_dump($structincluelist); - echo "
"; -*/ - } elseif (strcasecmp($mode, "gestion") == 0) { + } elseif (strcasecmp($mode, MODE_GESTION) == 0) { $structureliste = $user->structgestliste(); $structureliste = $fonctions->enleverstructuresinclues_planning($structureliste); if (is_array($structureliste)) @@ -787,7 +780,7 @@ } } } - elseif (strcasecmp($mode, "consult") == 0) + elseif (strcasecmp($mode, MODE_CONSULTANT) == 0) { //var_dump("Je suis en mode consultant"); $structure = new structure($dbcon); diff --git a/html/utilisation_cet.php b/html/utilisation_cet.php index b50fb9a..c2fe441 100644 --- a/html/utilisation_cet.php +++ b/html/utilisation_cet.php @@ -133,7 +133,7 @@ } } - if (strcasecmp($mode, "gestrh") == 0) { + if (strcasecmp($mode, MODE_RH) == 0) { echo "Personne à rechercher :
"; echo "
"; diff --git a/html/valider_demande.php b/html/valider_demande.php index e4e70ae..b8f7a7f 100644 --- a/html/valider_demande.php +++ b/html/valider_demande.php @@ -53,7 +53,7 @@ // Récupération du mode => resp ou gestion $mode = $_POST["mode"]; if (is_null($mode) or $mode == "") { - $mode = "resp"; + $mode = MODE_RESPONSABLE; echo "Le mode n'est pas précisé ==> on met le mode responsable
"; } @@ -74,138 +74,208 @@ if (is_array($statutliste)) { - $cronuser = new agent($dbcon); - $cronuser->load(SPECIAL_USER_IDCRONUSER); - foreach ($statutliste as $demandeid => $statut) + if (strcasecmp($mode,MODE_CONSULTANT)==0) { - //echo "Le statut est $statut
"; - if (strcasecmp($statut, demande::DEMANDE_AVIS) == 0 ) + $cron = new agent($dbcon); + $cron->load(SPECIAL_USER_IDCRONUSER); + foreach ($statutliste as $demandeid => $statut) { - $demande = new demande($dbcon); - $demande->load($demandeid); - $complement = new complement($dbcon); - $complement->load($demande->agent()->agentid(),complement::AVIS_CONGES_LABEL); - if ($complement->agentid()==$demande->agent()->agentid() and $complement->valeur()!="") + $demandemodifiee = false; + if (strcasecmp($statut, demande::DEMANDE_VALIDE) == 0 ) { - $consultant = new agent($dbcon); - if ($consultant->load($complement->valeur())) - { - $corpmail = $fonctions->mailbody_avis($demande); - if ($corpmail!='') - { - $cronuser->sendmail($consultant, "Demande d'avis sur une demande de congés ou d'absence" , $corpmail); - } - } + //var_dump("La demande $demandeid est validée => On va l'enregistrer"); + $demandecomplement = new demandecomplement($dbcon); + $demandecomplement->demandeid($demandeid); + $demandecomplement->complementid(demandecomplement::DEMANDE_AVIS_STATUT_LABEL); + $demandecomplement->valeur($statut); + $demandecomplement->store(); + $demandemodifiee = true; } - // On repasse le statut de la demande à "EN ATTENTE" pour éviter que l'on reposte une demande d'avis - $_POST['statut'][$demandeid] = demande::DEMANDE_ATTENTE; - $statutliste[$demandeid] = demande::DEMANDE_ATTENTE; - } - elseif (strcasecmp($statut, demande::DEMANDE_ATTENTE) != 0 ) - { - var_dump("On est après le test statut"); - $motif = ''; - if (isset($motifliste["$demandeid"])) + elseif (strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 ) { - $motif = $motifliste["$demandeid"]; + $motif = ''; + if (isset($motifliste["$demandeid"])) + { + $motif = $motifliste["$demandeid"]; + } + if ((strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 or strcasecmp($statut, demande::DEMANDE_ANNULE) == 0) and $motif == "") + { + $errlog = "Le motif du refus est obligatoire."; + echo $fonctions->showmessage(fonctions::MSGERROR, $errlog); + error_log(basename(__FILE__) . " " . $fonctions->stripAccents($errlog)); + } + else + { + //var_dump("La demande $demandeid est refusée => On va l'enregistrer"); + $demandecomplement = new demandecomplement($dbcon); + $demandecomplement->demandeid($demandeid); + $demandecomplement->complementid(demandecomplement::DEMANDE_AVIS_STATUT_LABEL); + $demandecomplement->valeur($statut); + $demandecomplement->store(); + $demandecomplement = new demandecomplement($dbcon); + $demandecomplement->demandeid($demandeid); + $demandecomplement->complementid(demandecomplement::DEMANDE_AVIS_MOTIF_LABEL); + $demandecomplement->valeur($motif); + $demandecomplement->store(); + $demandemodifiee = true; + } } - $demande = new demande($dbcon); - // echo "cleelement = $cleelement demandeid = $demandeid
"; - $demande->load($demandeid); - if ($statut == demande::DEMANDE_REFUSE) + if ($demandemodifiee) { - $demande->motifrefus($motif); + // On envoie un mail au signataire des demanes de l'agent + $demande = new demande($dbcon); + $demande->load($demandeid); + $agent = new agent($dbcon); + $agent->load($demande->agentid()); + $signataire = $agent->getsignataire(); + + $corpmail = "Un avis a été déposé par " . $user->identitecomplete() . " sur la demande suivante :\n"; + $corpmail = $corpmail . "\n"; + $corpmail = $corpmail . "Demandeur : " . $agent->identitecomplete() . "\n"; + $corpmail = $corpmail . "Type de demande : " . $demande->typelibelle() . "\n"; + $corpmail = $corpmail . "Début : " . $fonctions->formatdate($demande->datedebut()) . " " . $fonctions->nommoment($demande->moment_debut()) . "\n"; + $corpmail = $corpmail . "Fin : " . $fonctions->formatdate($demande->datefin()) . " " . $fonctions->nommoment($demande->moment_fin()) . "\n"; + $corpmail = $corpmail . "\n"; + + $cron->sendmail($signataire, "Un avis a été déposé sur une demande de congés ou d'absence", $corpmail); } - if ($demande->statut() == $statut) + } + } + else + { + $cronuser = new agent($dbcon); + $cronuser->load(SPECIAL_USER_IDCRONUSER); + foreach ($statutliste as $demandeid => $statut) + { + //echo "Le statut est $statut
"; + if (strcasecmp($statut, demande::DEMANDE_AVIS) == 0 ) { - // Pas de changement de statut de la demande => On ne sauvegarde rien !!! - $errlog = "Le statut de la demande est inchangé, donc pas de sauvegarde."; - echo $fonctions->showmessage(fonctions::MSGERROR, $errlog); - error_log(basename(__FILE__) . " " . $fonctions->stripAccents($errlog)); + $demande = new demande($dbcon); + $demande->load($demandeid); + $complement = new complement($dbcon); + $complement->load($demande->agent()->agentid(),complement::AVIS_CONGES_LABEL); + if ($complement->agentid()==$demande->agent()->agentid() and $complement->valeur()!="") + { + $consultant = new agent($dbcon); + if ($consultant->load($complement->valeur())) + { + $corpmail = $fonctions->mailbody_avis($demande); + if ($corpmail!='') + { + $cronuser->sendmail($consultant, "Demande d'avis sur une demande de congés ou d'absence" , $corpmail); + } + } + } + // On repasse le statut de la demande à "EN ATTENTE" pour éviter que l'on reposte une demande d'avis + $_POST['statut'][$demandeid] = demande::DEMANDE_ATTENTE; + $statutliste[$demandeid] = demande::DEMANDE_ATTENTE; } - else + elseif (strcasecmp($statut, demande::DEMANDE_ATTENTE) != 0 ) { - $demande->statut($statut); - // if (strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 and $motif == "") { - if ((strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 or strcasecmp($statut, demande::DEMANDE_ANNULE) == 0) and $motif == "") + //var_dump("On est après le test statut"); + $motif = ''; + if (isset($motifliste["$demandeid"])) { - $errlog = "Le motif du refus est obligatoire."; + $motif = $motifliste["$demandeid"]; + } + $demande = new demande($dbcon); + // echo "cleelement = $cleelement demandeid = $demandeid
"; + $demande->load($demandeid); + if ($statut == demande::DEMANDE_REFUSE) + { + $demande->motifrefus($motif); + } + if ($demande->statut() == $statut) + { + // Pas de changement de statut de la demande => On ne sauvegarde rien !!! + $errlog = "Le statut de la demande est inchangé, donc pas de sauvegarde."; echo $fonctions->showmessage(fonctions::MSGERROR, $errlog); error_log(basename(__FILE__) . " " . $fonctions->stripAccents($errlog)); - } else { - $msgerreur = ""; - $msgerreur = $demande->store(); - if ($msgerreur != "") + } + else + { + $demande->statut($statut); + // if (strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 and $motif == "") { + if ((strcasecmp($statut, demande::DEMANDE_REFUSE) == 0 or strcasecmp($statut, demande::DEMANDE_ANNULE) == 0) and $motif == "") { - echo $fonctions->showmessage(fonctions::MSGERROR, "Pas de sauvegarde car " . $msgerreur); - } - else { - $ics = null; - $pdffilename[0] = $demande->pdf($user->agentid()); - $agent = $demande->agent(); - //echo "
Le statut de la demande est : $statut

"; - if ((strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) or (strcmp($statut, demande::DEMANDE_ANNULE) == 0)) { - $ics = $demande->ics($agent->mail()); - } - elseif ((strcmp($statut, demande::DEMANDE_REFUSE) == 0)) { - // On refuse une demande => On doit mettre à jour l'agenda car la demande est en statut "TENTATIVE" - $ics = $demande->ics($agent->mail()); + $errlog = "Le motif du refus est obligatoire."; + echo $fonctions->showmessage(fonctions::MSGERROR, $errlog); + error_log(basename(__FILE__) . " " . $fonctions->stripAccents($errlog)); + } else { + $msgerreur = ""; + $msgerreur = $demande->store(); + if ($msgerreur != "") + { + echo $fonctions->showmessage(fonctions::MSGERROR, "Pas de sauvegarde car " . $msgerreur); } - $corpmail = "Votre demande du " . $demande->datedebut() . " au " . $demande->datefin() . " est " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . "."; + else { + $ics = null; + $pdffilename[0] = $demande->pdf($user->agentid()); + $agent = $demande->agent(); + //echo "
Le statut de la demande est : $statut

"; + if ((strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) or (strcmp($statut, demande::DEMANDE_ANNULE) == 0)) { + $ics = $demande->ics($agent->mail()); + } + elseif ((strcmp($statut, demande::DEMANDE_REFUSE) == 0)) { + // On refuse une demande => On doit mettre à jour l'agenda car la demande est en statut "TENTATIVE" + $ics = $demande->ics($agent->mail()); + } + $corpmail = "Votre demande du " . $demande->datedebut() . " au " . $demande->datefin() . " est " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . "."; - if (strcasecmp($demande->type(), "cet") == 0 and strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) // Si c'est une demande prise sur un CET et qu'elle est validée => On joint le PDF d'utilisation du CET en congés - { - /* - // On remplace les '\' par des '/' et on cherche la position du dernier '/' - $position = strrpos(str_replace('\\', '/', $pdffilename[0]), '/'); - // La base du chemin PDF est donc la sous-chaine du nom du fichier PDF de la demande !! - $basepdfpath = substr($pdffilename[0], 0, $position); - // On ajoute le fichier PDF d'utilisation du CET en congés - $pdffilename[1] = $basepdfpath . '/../../documents/Utilisation_CET_Conges.pdf'; - */ + if (strcasecmp($demande->type(), "cet") == 0 and strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) // Si c'est une demande prise sur un CET et qu'elle est validée => On joint le PDF d'utilisation du CET en congés + { + /* + // On remplace les '\' par des '/' et on cherche la position du dernier '/' + $position = strrpos(str_replace('\\', '/', $pdffilename[0]), '/'); + // La base du chemin PDF est donc la sous-chaine du nom du fichier PDF de la demande !! + $basepdfpath = substr($pdffilename[0], 0, $position); + // On ajoute le fichier PDF d'utilisation du CET en congés + $pdffilename[1] = $basepdfpath . '/../../documents/Utilisation_CET_Conges.pdf'; + */ - // On ajoute le fichier PDF d'utilisation du CET en congés - $pdffilename[1] = $fonctions->documentpath() . '/' . DOC_USAGE_CET; - $corpmail = $corpmail . "\n\nVous devez retourner par mail le document " . basename($pdffilename[1]) . " rempli et signé à :\n"; - $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCET); // Profil = 1 ==> GESTIONNAIRE RH DE CET - foreach ($arrayagentrh as $gestrh) { - $corpmail = $corpmail . $gestrh->identitecomplete() . " : " . $gestrh->mail() . "\n"; + // On ajoute le fichier PDF d'utilisation du CET en congés + $pdffilename[1] = $fonctions->documentpath() . '/' . DOC_USAGE_CET; + $corpmail = $corpmail . "\n\nVous devez retourner par mail le document " . basename($pdffilename[1]) . " rempli et signé à :\n"; + $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCET); // Profil = 1 ==> GESTIONNAIRE RH DE CET + foreach ($arrayagentrh as $gestrh) { + $corpmail = $corpmail . $gestrh->identitecomplete() . " : " . $gestrh->mail() . "\n"; + } } - } - $user->sendmail($agent, "Modification d'une demande de congés ou d'absence", $corpmail, $pdffilename, $ics); - // Si c'est une demande prise sur un CET et qu'elle est validée => On envoie un mail au gestionnaire RH de CET - if (strcasecmp($demande->type(), "cet") == 0 and strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) - { - $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCET); // Profil = 1 ==> GESTIONNAIRE RH DE CET - foreach ($arrayagentrh as $gestrh) { - $corpmail = "Une demande de congés a été " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . " sur le CET de " . $agent->identitecomplete() . ".\n"; - $corpmail = $corpmail . "\n"; - $corpmail = $corpmail . "Détail de la demande :\n"; - $corpmail = $corpmail . "- Date de début : " . $demande->datedebut() . " " . $fonctions->nommoment($demande->moment_debut()) . "\n"; - $corpmail = $corpmail . "- Date de fin : " . $demande->datefin() . " " . $fonctions->nommoment($demande->moment_fin()) . "\n"; - $corpmail = $corpmail . "Nombre de jours demandés : " . $demande->nbrejrsdemande() . "\n"; - // $corpmail = $corpmail . "La demande est actuellement en attente de validation.\n"; - $user->sendmail($gestrh, "Changement de statut d'une demande de congés sur CET", $corpmail); + $user->sendmail($agent, "Modification d'une demande de congés ou d'absence", $corpmail, $pdffilename, $ics); + // Si c'est une demande prise sur un CET et qu'elle est validée => On envoie un mail au gestionnaire RH de CET + if (strcasecmp($demande->type(), "cet") == 0 and strcasecmp($statut, demande::DEMANDE_VALIDE) == 0) + { + $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCET); // Profil = 1 ==> GESTIONNAIRE RH DE CET + foreach ($arrayagentrh as $gestrh) { + $corpmail = "Une demande de congés a été " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . " sur le CET de " . $agent->identitecomplete() . ".\n"; + $corpmail = $corpmail . "\n"; + $corpmail = $corpmail . "Détail de la demande :\n"; + $corpmail = $corpmail . "- Date de début : " . $demande->datedebut() . " " . $fonctions->nommoment($demande->moment_debut()) . "\n"; + $corpmail = $corpmail . "- Date de fin : " . $demande->datefin() . " " . $fonctions->nommoment($demande->moment_fin()) . "\n"; + $corpmail = $corpmail . "Nombre de jours demandés : " . $demande->nbrejrsdemande() . "\n"; + // $corpmail = $corpmail . "La demande est actuellement en attente de validation.\n"; + $user->sendmail($gestrh, "Changement de statut d'une demande de congés sur CET", $corpmail); + } } - } - // Si c'est une demande de type télétravail HC raison médical et qu'elle est validée => On envoie un mail au gestionnaire RH de CET - elseif (strcasecmp($demande->type(), "telesante") == 0 and strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0) - { - $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCONGE); // Profil = 2 ==> GESTIONNAIRE RH CONGE - foreach ($arrayagentrh as $gestrh) { - $corpmail = "Une demande d'absence de type 'Télétravail pour raison de santé' a été " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . " pour " . $agent->identitecomplete() . ".\n"; - $corpmail = $corpmail . "\n"; - $corpmail = $corpmail . "Détail de la demande :\n"; - $corpmail = $corpmail . "- Date de début : " . $demande->datedebut() . " " . $fonctions->nommoment($demande->moment_debut()) . "\n"; - $corpmail = $corpmail . "- Date de fin : " . $demande->datefin() . " " . $fonctions->nommoment($demande->moment_fin()) . "\n"; - $corpmail = $corpmail . "Nombre de jours demandés : " . $demande->nbrejrsdemande() . "\n"; - // $corpmail = $corpmail . "La demande est actuellement en attente de validation.\n"; - $user->sendmail($gestrh, "Changement de statut d'une demande de 'Télétravail pour raison de santé'", $corpmail); + // Si c'est une demande de type télétravail HC raison médical et qu'elle est validée => On envoie un mail au gestionnaire RH de CET + elseif (strcasecmp($demande->type(), "telesante") == 0 and strcasecmp($demande->statut(), demande::DEMANDE_VALIDE) == 0) + { + $arrayagentrh = $fonctions->listeprofilrh(agent::PROFIL_RHCONGE); // Profil = 2 ==> GESTIONNAIRE RH CONGE + foreach ($arrayagentrh as $gestrh) { + $corpmail = "Une demande d'absence de type 'Télétravail pour raison de santé' a été " . mb_strtolower($fonctions->demandestatutlibelle($demande->statut()), 'UTF-8') . " pour " . $agent->identitecomplete() . ".\n"; + $corpmail = $corpmail . "\n"; + $corpmail = $corpmail . "Détail de la demande :\n"; + $corpmail = $corpmail . "- Date de début : " . $demande->datedebut() . " " . $fonctions->nommoment($demande->moment_debut()) . "\n"; + $corpmail = $corpmail . "- Date de fin : " . $demande->datefin() . " " . $fonctions->nommoment($demande->moment_fin()) . "\n"; + $corpmail = $corpmail . "Nombre de jours demandés : " . $demande->nbrejrsdemande() . "\n"; + // $corpmail = $corpmail . "La demande est actuellement en attente de validation.\n"; + $user->sendmail($gestrh, "Changement de statut d'une demande de 'Télétravail pour raison de santé'", $corpmail); + } } - } - error_log("Sauvegarde la demande " . $demande->id() . " avec le statut " . $fonctions->demandestatutlibelle($demande->statut())); + error_log("Sauvegarde la demande " . $demande->id() . " avec le statut " . $fonctions->demandestatutlibelle($demande->statut())); + } } } } @@ -215,7 +285,7 @@ echo "Changez l'état de chacune des demandes en \"Validée\" ou \"Refusée\", puis enregistrez les modifications en cliquant sur le bouton \"Enregistrer\"
Laissez l'état des demandes à \"En attente\" si vous ne souhaitez pas faire de modification.
Attention : La saisie du motif est obligatoire dans le cas d'un refus.

"; - if ($user->estresponsable() and (strcasecmp($mode, "resp") == 0)) { + if ($user->estresponsable() and (strcasecmp($mode, MODE_RESPONSABLE) == 0)) { $listestruct = $user->structrespliste(); $listestruct = $fonctions->enleverstructuresinclues_demandes($listestruct); if (is_array($listestruct)) @@ -275,48 +345,7 @@ $aumoinsunedemande = TRUE; } } - } - -////////////////////////////////////////////////////////// -// Ce code semble inutil car les responsables des sous structures sont déjà gérés dans la boucle précédente -// $sousstructureliste = $structure->structurefille(); -// // echo "On passe aux reponsables....
"; -// if (is_array($sousstructureliste)) -// { -// foreach ($sousstructureliste as $ssstructkey => $structfille) -// { -// if ($fonctions->formatdatedb($structfille->datecloture()) >= $fonctions->formatdatedb(date("Ymd"))) -// { -// $htmltodisplay = ""; -// $responsable = $structfille->responsable(); -// $debut = $fonctions->formatdate(($fonctions->anneeref() - $previous) . $fonctions->debutperiode()); -// $fin = $fonctions->formatdate(($fonctions->anneeref() + 1 - $previous) . $fonctions->finperiode()); -// // echo $responsable->demandeslistehtmlpourvalidation($debut , $fin, $user->id(),null, $cleelement); -// if (! is_null($responsable) and $responsable->structureid()==$structfille->id()) { -// $oktodisplay = true; -// if (is_array($agentliste)) { -// // On regarde si l'agent est déja affiché !!! Si il est dans la liste des agentliste alors on ne l'affiche pas -// if (array_key_exists($responsable->nom() . " " . $responsable->prenom() . " " . $responsable->agentid(), $agentliste)) -// { -// $oktodisplay = false; -// } -// } -// if ($oktodisplay) { -// $htmltodisplay = $responsable->demandeslistehtmlpourvalidation($debut, $fin, $user->agentid(), $structfille->id(), $cleelement); -// // On ajoute le responsable dans la liste des agents à afficher -// $agentliste[$responsable->nom() . " " . $responsable->prenom() . " " . $responsable->agentid()] = $responsable; -// } -// } -// if ($htmltodisplay != "") { -// echo $htmltodisplay; -// echo "
"; -// $aumoinsunedemande = TRUE; -// } -// } -// } -// } -///////////////////////////////////////////////////////////////// - + } if (! $aumoinsunedemande) { echo "Aucune demande en attente pour cette structure...
"; } @@ -327,11 +356,11 @@ echo "
"; echo ""; echo "
"; - } elseif (! $user->estresponsable() and (strcasecmp($mode, "resp") == 0)) { + } elseif (! $user->estresponsable() and (strcasecmp($mode, MODE_RESPONSABLE) == 0)) { echo "Vous n'êtes pas responsable, vous ne pouvez pas valider les demandes de congés/d'absence
"; } - if ($user->estgestionnaire() and (strcasecmp($mode, "gestion") == 0)) { + if ($user->estgestionnaire() and (strcasecmp($mode, MODE_GESTION) == 0)) { echo "
"; echo ""; $listestruct = $user->structgestliste(); @@ -366,65 +395,7 @@ } $agentliste = $gestionnaire->listeagentengestion(date("d/m/Y"), date("d/m/Y"), $structure); - -// $agentliste = array(); -// // Soit le gestionnaire peut afficher les agents de la structure, -// // Soit il gère un circuit de validation des demandes de congés -// $codeinterne = null; -// $destinataire = $structure->agent_envoyer_a($codeinterne); -// if (is_null($destinataire)) -// { -// // Si on n'a pas de destinataire => On charge l'utilisateur CRON comme destinataire -// $destinataire = new agent($dbcon); -// $destinataire->load(SPECIAL_USER_IDCRONUSER); -// } -// -// // Si le gestionnaire courant gère les agents de la structure (gestvalidagent=O) => On charge tous les agents de la structure et on enlève les responsables (SIHAM + responsable) -// // En effet, un gestionnaire ne peut pas valider les demandes de son responsable - Ticket GLPI 147328 et 166498 (sauf s'il est dans le circuit => voir test suivant) -// // Il peut aussi gérer le circuit des agents de la structure courante => C'est la même façon d'alimenter les agents -// if ((strcasecmp($structure->gestvalidagent(),'o')==0 and $gestionnaire->agentid()==$user->agentid()) or -// (array_key_exists($structure->id(),(array)$listegeststruct)===true -// and $codeinterne==structure::MAIL_AGENT_ENVOI_GEST_COURANT) -// and $destinataire->agentid()==$user->agentid()) -// { -// $agentliste = $structure->agentlist(date("d/m/Y"), date("d/m/Y"), 'n'); -// $resp = $structure->responsable(); -// unset($agentliste[$resp->nom() . " " . $resp->prenom() . " " . $resp->agentid()]); -// $resp = $structure->responsablesiham(); -// unset($agentliste[$resp->nom() . " " . $resp->prenom() . " " . $resp->agentid()]); -// } -// $codeinterne = null; -// $destinataire = $structure->resp_envoyer_a($codeinterne); -// if (is_null($destinataire)) -// { -// // Si on n'a pas de destinataire => On charge l'utilisateur CRON comme destinataire -// $destinataire = new agent($dbcon); -// $destinataire->load(SPECIAL_USER_IDCRONUSER); -// } -// // Si la structure est dans le tableau des structures gérées par le gestionnaire et qu'il doit gérer le responsable de la structure courante -// if (array_key_exists($structure->id(),(array)$listegeststruct)===true -// and $destinataire->agentid()==$user->agentid() -// and ($codeinterne==structure::MAIL_RESP_ENVOI_GEST_COURANT or $codeinterne==structure::MAIL_RESP_ENVOI_GEST_PARENT)) -// { -// // On récupère les responsables de la structure (titulaire + délégué) si le gestionnaire doit gérer ce circuit -// $resp = $structure->responsable(); -// // ATTENTION : Le gestionnaire ne gère le responsable que s'il est affecté à la structure courante => Sinon ce n'est pas lui qui valide les congés -// if ($resp->structureid()==$structure->id()) -// { -// $agentliste[$resp->nom() . " " . $resp->prenom() . " " . $resp->agentid()] = $resp; -// } -// $resp = $structure->responsablesiham(); -// // ATTENTION : Le gestionnaire ne gère le responsable que s'il est affecté à la structure courante => Sinon ce n'est pas lui qui valide les congés -// if ($resp->structureid()==$structure->id()) -// { -// $agentliste[$resp->nom() . " " . $resp->prenom() . " " . $resp->agentid()] = $resp; -// } -// } -// // On supprime l'utilisateur du tableau au cas où il est présent car il ne peut en aucun cas s'auto-valider ses demandes -// unset($agentliste[$user->nom() . " " . $user->prenom() . " " . $user->agentid()]); - - - + foreach ((array)$agentliste as $membrekey => $membre) { // echo "boucle => " .$membre->nom() . "
"; @@ -474,9 +445,49 @@ echo "
"; echo ""; echo "
"; - } elseif (! $user->estgestionnaire() and (strcasecmp($mode, "gestion") == 0)) { + } elseif (! $user->estgestionnaire() and (strcasecmp($mode, MODE_GESTION) == 0)) { echo "Vous n'êtes pas gestionnaire, vous ne pouvez pas valdier les demandes de congés/d'absence
"; } + + //var_dump ("mode = $mode"); + if (strcasecmp($mode, MODE_CONSULTANT) == 0) { + echo "
"; + echo ""; + echo "

Liste des agents avec une demande d'avis en attente

"; + + // On récupère la liste des agents ou l'utilisateur est consultant + $agentconsultliste = $user->agentconsultantliste(); + + $debut = $fonctions->formatdate(($fonctions->anneeref() - $previous) . $fonctions->debutperiode()); + $fin = $fonctions->formatdate(($fonctions->anneeref() + 1 - $previous) . $fonctions->finperiode()); + + // Si on est dans l'année courante et si on ne limite pas les conges a la periode => + // On doit afficher les congés qui sont dans la période suivante + if ((strcasecmp($fonctions->liredbconstante("LIMITE_CONGE_PERIODE"), "n") == 0) and ($previous == 0)) + { + $fin = $fonctions->formatdate(($fonctions->anneeref() + 2) . $fonctions->finperiode()); + } + + foreach ($agentconsultliste as $membre) + { + //var_dump("Membre = " . $membre->identitecomplete()); + $htmltodisplay = $membre->demandeslistehtmlpourvalidation($debut, $fin, null,$mode); + if ($htmltodisplay . "" != "") + { + echo "$htmltodisplay"; + echo "
"; + } + } + + echo ""; + echo ""; + echo ""; + echo "
"; + echo ""; + echo "
"; + + + } ?>
diff --git a/html/valider_tpspartiel.php b/html/valider_tpspartiel.php index 722c962..bebdab5 100644 --- a/html/valider_tpspartiel.php +++ b/html/valider_tpspartiel.php @@ -84,12 +84,12 @@ } $structlist = null; - if (strcasecmp($mode, "resp") == 0) { + if (strcasecmp($mode, MODE_RESPONSABLE) == 0) { $structlist = $user->structrespliste(); $structlist = $fonctions->enleverstructuresinclues_demandes($structlist); } - if (strcasecmp($mode, "gestion") == 0) { + if (strcasecmp($mode, MODE_GESTION) == 0) { $structlist = $user->structgestliste(); // On récupère la liste des structures où l'agent (donc le gestionnaire) gère les congés (des agents et/ou du responsable) $listegeststruct = $user->structgestcongeliste(); @@ -106,7 +106,7 @@ echo "Remarque : Les personnes affectées à temps plein ne sont pas affichées dans cet écran.

"; foreach ($structlist as $keystruct => $structure) { - if (strcasecmp($mode, "resp") == 0) // Si on est en mode responsable, on charge les agents en responsabilité + if (strcasecmp($mode, MODE_RESPONSABLE) == 0) // Si on est en mode responsable, on charge les agents en responsabilité { if (strcasecmp($structure->respaffdemandesousstruct(),'o')==0) // Si on doit gérer les demandes de congés/afficher le solde des agents des structures inclues { @@ -123,7 +123,7 @@ $agentlist = $user->listeagentenresponsabilite(date("d/m/Y"), date("d/m/Y"),$structure); } } - elseif (strcasecmp($mode, "gestion") == 0) + elseif (strcasecmp($mode, MODE_GESTION) == 0) { // Si le gestionnaire ne doit pas gérer les agents et qu'il n'est pas destinataire des notifications des demandes de congés if (strcasecmp($structure->gestvalidagent(),'n')==0