diff --git a/html/class/agent.php b/html/class/agent.php index 5d03d46..e36da87 100644 --- a/html/class/agent.php +++ b/html/class/agent.php @@ -859,6 +859,23 @@ function estadministrateur() $complement->load($this->agentid, "ESTADMIN"); return (strcasecmp($complement->valeur(), "O") == 0); } + + function estconsultant() + { + $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); + // echo "sql = " . $sql . "
"; + $erreur = mysqli_error($this->dbconnect); + if ($erreur != "") { + $errlog = "Agent->estconsultant (AGENT) : " . $erreur; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + return FALSE; + } + return (mysqli_num_rows($query) != 0); + } + /** * @@ -1206,7 +1223,18 @@ function sendmail($destinataire = null, $objet = null, $message = null, $piecejo // => Pas de référence à l'application if (is_object($destinataire)) { - $msg .= "Cliquez sur le lien fonctions->get_g2t_url()) . "'>G2T

Cordialement

" . ucwords(mb_strtolower($this->prenom . " " . $this->nom),'UTF-8') . "\r\n"; + $msg .= "Cliquez sur le lien fonctions->get_g2t_url()) . "'>G2T

Cordialement

"; + // 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'); + } + else + { + $msg .= "
"; + } + $msg .= "\r\n"; } // $msg .= htmlentities("$message",ENT_IGNORE,"ISO8859-15") ."

Cordialement

" . ucwords(strtolower("$PRENOM $NOM")) ."\r\n"; @@ -1502,6 +1530,32 @@ function structgestliste() return $structliste; } + function agentconsultantliste() :array + { + $agentliste = array(); + if ($this->estconsultant()) { + // echo "Je suis consultant...
"; + $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); + // echo "sql = " . $sql . "
"; + $erreur = mysqli_error($this->dbconnect); + if ($erreur != "") { + $errlog = "Agent->agentconsultantliste (AGENT) : " . $erreur; + echo $errlog . "
"; + error_log(basename(__FILE__) . " " . $this->fonctions->stripAccents($errlog)); + } + while ($result = mysqli_fetch_row($query)) { + // echo "Je charge la structure " . $result[0] . "
"; + $agent = new agent($this->dbconnect); + $agent->load("$result[0]"); + $agentliste[$agent->agentid()] = $agent; + unset($agent); + } + } + return $agentliste; + } + /** * * @param @@ -2766,7 +2820,7 @@ function demandeslistehtmlpourgestion($debut_interval, $fin_interval, $agentid = * optional deprecated parameter => not used in code * @return string the html text of the array */ - function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agentid = null, $structureid = null, $cleelement = null) + function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agentid = null, $mode = 'resp') { $longueurmaxmotif = $this->fonctions->logueurmaxcolonne('DEMANDE','MOTIFREFUS'); @@ -2870,6 +2924,15 @@ function demandeslistehtmlpourvalidation($debut_interval, $fin_interval, $agenti } $htmltext = $htmltext . " " . $demande->nbrejrsdemande() . $datatitleindicator . ""; $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 + // En théorie déjà fait dans la page 'valider_demande.php' mais par sécurité on le remet ici + if (isset($statutliste[$demande->id()]) and $statutliste[$demande->id()] == demande::DEMANDE_AVIS) + { + $statutliste[$demande->id()] = demande::DEMANDE_ATTENTE; + } + $htmltext = $htmltext . " Masquer le télétravail"; - $htmltext = $htmltext . "

"; - } - $htmltext = $htmltext . ""; - $htmltext = $htmltext . ""; - $htmltext = $htmltext . ""; - if ($noiretblanc) - $htmltext = $htmltext . ""; - else - $htmltext = $htmltext . ""; - $htmltext = $htmltext . ""; - if ($includeteletravail) - $htmltext = $htmltext . ""; - else - $htmltext = $htmltext . ""; - - $htmltext = $htmltext . "Planning en PDF"; - $htmltext = $htmltext . ""; - + $htmltext = $htmltext . "
"; + if ($includeteletravail and !$noiretblanc) + { + $htmltext = $htmltext . "Masquer le télétravail"; + $htmltext = $htmltext . "

"; + } + $htmltext = $htmltext . ""; + $htmltext = $htmltext . ""; + $htmltext = $htmltext . ""; + if ($noiretblanc) + $htmltext = $htmltext . ""; + else + $htmltext = $htmltext . ""; + $htmltext = $htmltext . ""; + if ($includeteletravail) + $htmltext = $htmltext . ""; + else + $htmltext = $htmltext . ""; + + $htmltext = $htmltext . "Planning en PDF"; + $htmltext = $htmltext . "
"; + } // $htmltext = $htmltext . "
"; // $htmltext = $htmltext . ""; // $htmltext = $htmltext . ""; @@ -1382,10 +1406,19 @@ function dossierhtml($pourmodif = FALSE, $responsableid = NULL) // echo "strucutre->dossierhtml : Non refaite !!!!!
"; // return null; + $WSGROUPURL = $this->fonctions->liredbconstante("WSGROUPURL"); + $htmltext = "
"; $htmltext = ""; - $htmltext = $htmltext . ""; - $htmltext = $htmltext . ""; + $nbcolonne = 5; + $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 @@ -1514,7 +1547,60 @@ function dossierhtml($pourmodif = FALSE, $responsableid = NULL) $htmltext = $htmltext . $teletravailstring; } $htmltext = $htmltext . ""; + + // Ajout des conventions "télétravail" + $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; + } } } diff --git a/html/etablir_demande.php b/html/etablir_demande.php index 5d41dd5..d509335 100644 --- a/html/etablir_demande.php +++ b/html/etablir_demande.php @@ -694,13 +694,32 @@ function planning_rclick(date,moment) } else { - // On met la tentative dans l'agenda de l'agent $demandeid = $demande->id(); unset($demande); $demande = new demande($dbcon); $demande->load($demandeid); $agent = $demande->agent(); + + // On envoie un mail au consultant s'il est défini + $complement = new complement($dbcon); + $complement->load($agent->agentid(),complement::AVIS_CONGES_LABEL); + if ($complement->agentid()==$agent->agentid() and $complement->valeur()!="") + { + $consultant = new agent($dbcon); + if ($consultant->load($complement->valeur())) + { + $cronuser = new agent($dbcon); + $cronuser->load(SPECIAL_USER_IDCRONUSER); + $corpmail = $fonctions->mailbody_avis($demande); + if ($corpmail!='') + { + $cronuser->sendmail($consultant, "Demande d'avis sur une demande de congés ou d'absence" , $corpmail); + } + } + } + + // On met la tentative dans l'agenda de l'agent $ics = $demande->ics($agent->mail()); //echo "ics = " . $ics . "

"; $errormsg = $agent->updatecalendar($ics); diff --git a/html/gestion_dossier.php b/html/gestion_dossier.php index 7bfcf27..9ad81f5 100644 --- a/html/gestion_dossier.php +++ b/html/gestion_dossier.php @@ -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'])) @@ -340,6 +340,82 @@ } } } + + $arrayinputavisuser = null; + if (isset($_POST["inputavisuser"])) + { + $arrayinputavisuser = $_POST["inputavisuser"]; + } + $arrayavisuser = null; + if (isset($_POST["avisuser"])) + { + $arrayavisuser = $_POST["avisuser"]; + } + if (is_array($arrayavisuser)) + { + foreach ($arrayavisuser as $membreid => $valeur) + { + // Si on n'a pas de nom dans la zone de saisie du consultant => On doit effacer le consultant + if (trim($arrayinputavisuser[$membreid] . "") == "") { + $complement = new complement($dbcon); + $complement->delete($membreid, complement::AVIS_CONGES_LABEL); + } + else + { + //var_dump("\$valeur est soit un uid soit un numéro agent : $valeur"); + if (! is_numeric($valeur)) + { + $agentavis = $fonctions->createldapagentfromuid($valeur); + if ($agentavis===false) + { + $agentavisid = null; + } + else + { + $agentavisid = $agentavis->agentid(); + } + } + else + { + //$agentid = $valeur; + $agentavis = $fonctions->createldapagentfromagentid($valeur); + if ($agentavis===false) + { + $agentavisid = null; + } + else + { + $agentavisid = $agentavis->agentid(); + } + } + // Si le $agentavisid n'est pas vide ou null + if ($agentavisid != '' and (! is_null($agentavisid))) + { + $membre = new agent($dbcon); + $membre->load($membreid); + if ($agentavisid == $membreid) + { + if (strlen(trim($msgerreur))>0) { $msgerreur = $msgerreur . "
"; } + $msgerreur = $msgerreur . $membre->identitecomplete() . " : Vous ne pouvez pas demander la consultation de l'agent lui-même."; + } + elseif ($agentavisid == $userid) + { + if (strlen(trim($msgerreur))>0) { $msgerreur = $msgerreur . "
"; } + $msgerreur = $msgerreur . $membre->identitecomplete() . " : Etant le responsable de cette personne, vous ne pouvez pas demander votre propre avis."; + } + else + { + $complement = new complement($dbcon); + $complement->agentid($membreid); + $complement->complementid(complement::AVIS_CONGES_LABEL); + $complement->valeur($agentavisid); + $complement->store(); + } + } + } + } + } + // /////////////////////////////////////////////////// // ---- PARTIE GESTION DE LA DELEGATION -------- // @@ -1006,7 +1082,7 @@ function resp_mode_change_id(); ?>() wsParams: { filter_eduPersonAffiliation: "employee|researcher" } }); "; + echo ""; // si la structure est dans la liste des structures ou l'agent est responsable (au sens strict) if (isset($structrespliste[$structure->id()])) { diff --git a/html/includes/menu.php b/html/includes/menu.php index 5e709a4..c6c2a42 100644 --- a/html/includes/menu.php +++ b/html/includes/menu.php @@ -764,7 +764,7 @@ function affichestructureliste($structure, $niveau = 0)
Gestion des dossiers pour la structure " . $this->nomlong() . " (" . $this->nomcourt() . ")
AgentReport des congésNbre jours 'Garde d'enfant'Convention de télétravail
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
"; + $aviscomplement = new complement($this->dbconnect); + $aviscomplement->load($membre->agentid(),complement::AVIS_CONGES_LABEL); + + $htmltext = $htmltext . "agentid()==$membre->agentid() and $aviscomplement->valeur()!='') + { + $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 . ""; + + $htmltext = $htmltext . "