From 825ab278ebaa8613ce743f09cb77b95552ad0745 Mon Sep 17 00:00:00 2001 From: Pascal Comte Date: Wed, 4 Sep 2024 15:52:42 +0200 Subject: [PATCH] =?UTF-8?q?Corrections=20et=20=C3=A9volutions=20multiples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ajout de l'affichage du PDF des la validation des demandes d'absence et de congés dans le récapitulatif des demandes - Activation de la récupération des congés sur arrêt de maladie (à partir de 01/09/2024) - Activation des nouvelles règles de calcul du solde des congés (à partir du 01/09/2024) - Corrections mineures/fiabilisation --- CRON/cron-xml.sh | 4 +- CRON/php/import_absence_xml.php | 3 +- CRON/php/import_structure_xml.php | 26 ++++++-- CRON/php/mail_alerte_teletravail.php | 25 +++++--- CRON/php/synchro_conventions_teletravail.php | 27 ++++++--- html/affiche_jourscomplementaires.php | 9 +-- html/affiche_pdf.php | 17 ++++++ html/ajouter_conges.php | 10 +-- html/class/agent.php | 40 ++++++++++-- html/class/demande.php | 14 +++-- html/class/fonctions.php | 64 +++++++++++--------- html/class/planning.php | 5 +- html/class/recuperation.php | 26 ++++++-- html/class/structure.php | 3 +- html/etablir_demande.php | 11 ++-- html/gestion_dossier.php | 3 +- html/includes/menu.php | 2 +- html/index.php | 30 --------- html/structure_planning.php | 3 +- html/valider_jourscomplementaires.php | 9 +-- 20 files changed, 210 insertions(+), 121 deletions(-) diff --git a/CRON/cron-xml.sh b/CRON/cron-xml.sh index b55c8e8..313c333 100644 --- a/CRON/cron-xml.sh +++ b/CRON/cron-xml.sh @@ -73,8 +73,8 @@ then echo "Avant generation de l'historique des CET" >>$logfile php php/demande_cet.php >>$logfile 2>>$logfile fi -php php/mail_alerte_reliquats.php >>$logfile -php php/mail_alerte_teletravail.php >>$logfile +php php/mail_alerte_reliquats.php >>$logfile 2>>$logfile +php php/mail_alerte_teletravail.php >>$logfile 2>>$logfile php php/switch_synchronisation.php inactif >>$logfile diff --git a/CRON/php/import_absence_xml.php b/CRON/php/import_absence_xml.php index c84b7e4..665871b 100644 --- a/CRON/php/import_absence_xml.php +++ b/CRON/php/import_absence_xml.php @@ -78,7 +78,8 @@ //echo "datefinformate = $datefinformate Date J - 2 ans = " . (date('Y')-2) . date("md") . " typeabsence = $typeabsence \n"; // Si l'arret s'est terminé il y a moins de 2 ans et que c'est un type d'absence M (<=> maladie) - if ($datefinformate > (date('Y')-2) . date("md") and strcasecmp($typeabsence,'M')==0 and false) + //if ($datefinformate > (date('Y')-2) . date("md") and strcasecmp($typeabsence,'M')==0 and false) + if ($datefinformate > (date('Y')-2) . date("md") and strcasecmp($typeabsence,'M')==0 and date('Ymd') >= '20240901') { echo "L'arret date de moins de 2 ans et c'est une maladie (typeabsence = $typeabsence) \n"; $agent = new agent($dbcon); diff --git a/CRON/php/import_structure_xml.php b/CRON/php/import_structure_xml.php index b787b51..4d09ed3 100644 --- a/CRON/php/import_structure_xml.php +++ b/CRON/php/import_structure_xml.php @@ -166,10 +166,10 @@ class XMLstructure $listestructcrees = array(); - $xml = simplexml_load_file("$filename"); - $agentnode = $xml->xpath('STRUCTURE'); - foreach ($agentnode as $node) - { + $xml = simplexml_load_file("$filename"); + $agentnode = $xml->xpath('STRUCTURE'); + foreach ($agentnode as $node) + { echo "---------------------------------------------------\n"; $XMLstructure = new XMLstructure(); $XMLstructure->code_struct = trim($node->xpath('STRUCTID')[0]); @@ -398,7 +398,7 @@ class XMLstructure $estinclue = 0; } - $sql = "SELECT * FROM STRUCTURE WHERE STRUCTUREID='" . $XMLstructure->code_struct . "'"; + $sql = "SELECT ISINCLUDED FROM STRUCTURE WHERE STRUCTUREID='" . $XMLstructure->code_struct . "'"; $query = mysqli_query($dbcon, $sql); $erreur_requete = mysqli_error($dbcon); if ($erreur_requete != "") @@ -434,6 +434,14 @@ class XMLstructure } else { + // On récupère la valeur de ISINCLUDED dans la base de données + $result = mysqli_fetch_row($query); + // Si l'inclusion de la structure dans la base de donnée est FALSE et que dans le fichier il est passé à TRUE + if ($fonctions->convertvaluetobool(trim($result[0]))==false and $fonctions->convertvaluetobool($estinclue)==true) + { + // On mémorise le changement de l'inclusion pour activer ou la structure (voir fin de la procédure) + $listestructcrees["$XMLstructure->code_struct"] = $XMLstructure->code_struct; + } echo "Mise a jour d'une structure : $XMLstructure->nom_long_struct (Id = $XMLstructure->code_struct) \n"; $sql = sprintf("UPDATE STRUCTURE SET NOMLONG='%s', NOMCOURT='%s', @@ -592,6 +600,9 @@ class XMLstructure } } + echo "------------------------------------------------------------ \n"; + echo "On parcourt toutes les structures que l'on vient de creer ou qui on une inclusion modifiee \n"; + // On parcourt toutes les structures que l'on vient de créer ou qui on une inclusion modifiée foreach ($listestructcrees as $structid) { $structure = new structure($dbcon); @@ -599,9 +610,14 @@ class XMLstructure $structureenglobante = $structure->structureenglobante(); if ($fonctions->convertvaluetobool($structureenglobante->isdeployed())) { + echo "La structure racine " . $structureenglobante->id() . " de $structid est déployée => On la déploie aussi. \n"; $structure->isdeployed($structureenglobante->isdeployed()); $structure->store(); } + else + { + echo "La structure racine " . $structureenglobante->id() . " de $structid n'est pas déployée => On ne la déploie pas. \n"; + } } diff --git a/CRON/php/mail_alerte_teletravail.php b/CRON/php/mail_alerte_teletravail.php index c696b84..349a0e6 100644 --- a/CRON/php/mail_alerte_teletravail.php +++ b/CRON/php/mail_alerte_teletravail.php @@ -9,10 +9,13 @@ echo "\nDébut de l'envoi des mail des alertes de fin de convention de télétravail " . date("d/m/Y H:i:s") . "\n"; echo "La date du jour est : $date \n"; - $datefinconvention = date("Y-m-d",strtotime($date."+ 1 months")); - echo "La date de fin des conventions à tester est $datefinconvention\n"; + $datefinconvention_1mois = date("Y-m-d",strtotime($date."+ 1 months")); + $datefinconvention_2mois = date("Y-m-d",strtotime($date."+ 2 months")); + echo "Les dates de fin des conventions à tester sont $datefinconvention_1mois et $datefinconvention_2mois \n"; - $listeagent = $fonctions->listeagentteletravail($datefinconvention,$datefinconvention,false); + $listeagent = $fonctions->listeagentteletravail($datefinconvention_1mois,$datefinconvention_1mois,false); + $listeagent = array_merge((array)$listeagent,(array)$fonctions->listeagentteletravail($datefinconvention_2mois,$datefinconvention_2mois,false)); + $listeagent = array_unique($listeagent); foreach ((array)$listeagent as $agentid) { @@ -24,7 +27,9 @@ $agent = new agent($dbcon); if ($agent->load($agentid)) // Si le chargement de l'agent est ok { - $teletravailliste = $agent->teletravailliste($datefinconvention,$datefinconvention); + $teletravailliste = $agent->teletravailliste($datefinconvention_1mois,$datefinconvention_1mois); + $teletravailliste = array_merge((array)$teletravailliste,(array)$agent->teletravailliste($datefinconvention_2mois,$datefinconvention_2mois)); + $teletravailliste = array_unique($teletravailliste); foreach ((array)$teletravailliste as $conventionid) { $convention = new teletravail($dbcon); @@ -36,17 +41,21 @@ // { // $force = true; // } - if (($convention->statut()==teletravail::TELETRAVAIL_VALIDE and $fonctions->formatdatedb($convention->datefin()) == $fonctions->formatdatedb($datefinconvention)) or $force) + if (($convention->statut()==teletravail::TELETRAVAIL_VALIDE + and ($fonctions->formatdatedb($convention->datefin()) == $fonctions->formatdatedb($datefinconvention_1mois) + or $fonctions->formatdatedb($convention->datefin()) == $fonctions->formatdatedb($datefinconvention_2mois))) + or $force) { // On doit envoyer un mail de rappel à l'agent ! - echo "Id de la convention teletravail = $conventionid Statut convention = " . $convention->statut() . " Id de l'agent = $agentid : "; + echo "Id de la convention teletravail = $conventionid Statut convention = " . $convention->statut() . " Id de l'agent = $agentid date fin = " . $convention->datefin() . " : "; echo "Tout est ok... On peut envoyer le mail \n"; $corpsdumail="Votre convention de télétravail arrive bientôt à son terme.\n"; $corpsdumail=$corpsdumail . "Si vous souhaitez renouveler votre convention de télétravail, veuillez prendre contact avec le service de la DRH afin de connaitre les modalités.\n"; $corpsdumail=$corpsdumail . "Dans le cas contraire, vous ne serez plus en télétravail après le " . $fonctions->formatdate($convention->datefin()) . ".\n"; $corpsdumail=$corpsdumail . "\n"; - - $agentcron->sendmail($agent, "Alerte : Fin de votre convention de télétravail", $corpsdumail, null, null, true); + //echo "Avant l'envoi \n"; + $agentcron->sendmail($agent, "Alerte : Fin de votre convention de télétravail", $corpsdumail, null, null, false); + //echo "Apres l'envoi \n"; } else { diff --git a/CRON/php/synchro_conventions_teletravail.php b/CRON/php/synchro_conventions_teletravail.php index 1e137a4..c38666b 100644 --- a/CRON/php/synchro_conventions_teletravail.php +++ b/CRON/php/synchro_conventions_teletravail.php @@ -161,20 +161,27 @@ //////////////////////////// // Dans le cas d'une délégation, le responsable peut quand même vouloir recevoir les demandes // On regarde donc s'il y a une délégation dans structure du responsable (obtenu avec agent::getsignataire) - $delegation = $structresp->getdelegation(true); - if ($fonctions->convertvaluetobool($delegation->continuesendtoresp)) + if (!is_null($structresp)) { - $responsable = $structresp->responsablesiham(); - if (is_null($responsable) or $responsable===false) + $delegation = $structresp->getdelegation(true); + if ($fonctions->convertvaluetobool($delegation->continuesendtoresp)) { - echo "On n'envoie pas de rappel au responsable SIHAM de la structure car il n'est pas défini \n"; - } - else - { - echo "On envoie un rappel au responsable SIHAM de la structure de l'agent => Responsable = " . $responsable->identitecomplete() . " \n"; - $tabdestinataireg2t[$responsable->agentid()] = $responsable; + $responsable = $structresp->responsablesiham(); + if (is_null($responsable) or $responsable===false) + { + echo "On n'envoie pas de rappel au responsable SIHAM de la structure car il n'est pas défini \n"; + } + else + { + echo "On envoie un rappel au responsable SIHAM de la structure de l'agent => Responsable = " . $responsable->identitecomplete() . " \n"; + $tabdestinataireg2t[$responsable->agentid()] = $responsable; + } } } + else + { + echo "La structure est inconnue => Pas de recherche de délégation \n"; + } } else { diff --git a/html/affiche_jourscomplementaires.php b/html/affiche_jourscomplementaires.php index 5648575..ad98afe 100644 --- a/html/affiche_jourscomplementaires.php +++ b/html/affiche_jourscomplementaires.php @@ -146,11 +146,12 @@ continue; } // On affiche les informations des récupérations qui sont valables durant la période 01/09/XXXX et 31/08/(XXXX+1) - $dbconstante = 'VALIDRECUP'; - $validrecup = '2'; - if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } + //$dbconstante = 'VALIDRECUP'; + //$validrecup = '2'; + //if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } + //$findatevalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); - $findatevalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); + $findatevalidite = $fonctions->finvaliditerecuperation($commentaireconge->dateajout); if (($findatevalidite < $datedebutanneeuniv) or ($fonctions->formatdatedb($commentaireconge->dateajout)>$datefinanneeuniv)) { // Cette récupération n'est pas dans la période universitaire => On ne l'affiche pas diff --git a/html/affiche_pdf.php b/html/affiche_pdf.php index a390528..678dc28 100644 --- a/html/affiche_pdf.php +++ b/html/affiche_pdf.php @@ -39,6 +39,7 @@ if (isset($_POST["typepdf"])) $typepdf = $_POST["typepdf"]; + if ($typepdf == 'listedemande') { //header('Content-Disposition: attachment; filename="liste_demandes.pdf"'); if ($listeagent != "") { @@ -81,6 +82,22 @@ } } + if (isset($_POST["nomdemandepdf"])) + { + $fullpdffilename = $_POST["nomdemandepdf"]; + // get size of the binary file + $filesize = filesize("$fullpdffilename"); + // open file for reading in binary mode + $fp = fopen("$fullpdffilename", 'rb'); + // read the entire file into a binary string + $binary = fread($fp, $filesize); + // finally close the file + fclose($fp); + header('Content-Disposition: attachment; filename="demande.pdf"'); + echo $binary; + } + + if (isset($_POST["userpdf"])) { //header('Content-Disposition: attachment; filename="planning_agent.pdf"'); if (strcasecmp($_POST["userpdf"], "yes") == 0) { diff --git a/html/ajouter_conges.php b/html/ajouter_conges.php index 09bd828..f3ef36b 100644 --- a/html/ajouter_conges.php +++ b/html/ajouter_conges.php @@ -342,10 +342,12 @@ //$corpmail = $corpmail . "Votre solde de jours complémentaires est maintenant de : " . ($solde->droitaquis() - $solde->droitpris()) . " jour(s).\n"; //$cronuser->sendmail($agent, "Ajout de jours complémentaires", $corpmail); $commentaireconge = $fonctions->lirecommentaire($commentaireid); - $dbconstante = 'VALIDRECUP'; - $validrecup = '2'; - if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } - $findatevalidite = date('d/m/Y',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); + //$dbconstante = 'VALIDRECUP'; + //$validrecup = '2'; + //if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } + //$findatevalidite = date('d/m/Y',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); + + $findatevalidite = $fonctions->finvaliditerecuperation($commentaireconge->dateajout); $corpmail = $user->identitecomplete() . " vient de vous ajouter $nbr_jours_conges jour(s) de récupération.\n"; $corpmail = $corpmail . "Le motif de cet ajout est : \n" . $commentaire_supp . ".\n\n"; diff --git a/html/class/agent.php b/html/class/agent.php index edcf15f..0120ad5 100644 --- a/html/class/agent.php +++ b/html/class/agent.php @@ -2177,7 +2177,35 @@ function demandeslistehtml($datedebut, $datefin, $structureid = null, $showlink $htmltext = $htmltext . $demande->nbrejrsdemande() . $datatitleindicator; $htmltext = $htmltext . ""; $htmltext = $htmltext . ""; - $htmltext = $htmltext . $this->fonctions->demandestatutlibelle($demande->statut()); + $fullpdffilename = ''; + if ($demande->statut()==demande::DEMANDE_VALIDE) + { + //var_dump($this->fonctions->formatdatedb($demande->datestatut())); + $pdfdossierdate = date('Y-m', strtotime($this->fonctions->formatdatedb($demande->datestatut()))); + $pdfpath = $this->fonctions->pdfpath() . '/' . $pdfdossierdate . '/'; + $filelist = array(); + //var_dump("$pdfpath"); + if (file_exists("$pdfpath")) + { + $filelist = scandir("$pdfpath"); + } + //var_dump($filelist); + $pdffilenamelist = preg_grep('/^demande_num' . $demande->id() . '_/i',$filelist); + if (count($pdffilenamelist)>0) + { + $fullpdffilename = $pdfpath . reset($pdffilenamelist); + $htmltext = $htmltext . "
"; + $htmltext = $htmltext . ""; // nom du PDF à afficher + $htmltext = $htmltext . "
"; + $htmltext = $htmltext . "" . $this->fonctions->demandestatutlibelle($demande->statut()) . ""; + + } + } + if ($fullpdffilename == '') + { + $htmltext = $htmltext . $this->fonctions->demandestatutlibelle($demande->statut()); + } + $htmltext = $htmltext . ""; $datatitle = ''; if (strlen($demande->motifrefus()) != 0) @@ -4369,7 +4397,11 @@ function synchroteletravail() function calculsoldeannuel($anneeref = null, $maj_solde = true, $loginfo = false, $displayinfo = false) { - + if (date('Ymd') >= '20240901') + { + return $this->newcalculsoldeannuel($anneeref,$maj_solde,$loginfo,$displayinfo); + } + if ($loginfo == true) { error_log(basename(__FILE__) . $this->fonctions->stripAccents(" ###############################################################")); error_log(basename(__FILE__) . $this->fonctions->stripAccents(" On est sur l'agent : " . $this->identitecomplete() . " (id = " . $this->agentid . ")")); @@ -4398,7 +4430,7 @@ function calculsoldeannuel($anneeref = null, $maj_solde = true, $loginfo = false $agentcomplement = new complement($this->dbconnect); $agentcomplement->load($this->agentid(),complement::FORCE_SOLDE_LABEL . $anneeref); - // Si le complément existe et qu'on a réussi à le chager + // Si le complément existe et qu'on a réussi à le charger if ($agentcomplement->agentid()==$this->agentid()) { if ($loginfo == true) @@ -5226,7 +5258,7 @@ function newcalculsoldeannuel($anneeref = null, $maj_solde = true, $loginfo = fa $agentcomplement = new complement($this->dbconnect); $agentcomplement->load($this->agentid(),complement::FORCE_SOLDE_LABEL . $anneeref); - // Si le complément existe et qu'on a réussi à le chager + // Si le complément existe et qu'on a réussi à le charger if ($agentcomplement->agentid()==$this->agentid()) { $this->fonctions->log_traces($loginfo,$displayinfo,"Le solde $anneeref de l'agent " . $this->identitecomplete() . " est forcé => On ne fait pas de calcul."); diff --git a/html/class/demande.php b/html/class/demande.php index db6396d..b0da898 100644 --- a/html/class/demande.php +++ b/html/class/demande.php @@ -576,11 +576,15 @@ function store($declarationTPListe = null, $ignoreabsenceautodecla = FALSE, $ign if (($nbjrrestant < $this->nbrejrsdemande) and ($commentaireconge->nbjrspris < $commentaireconge->nbjoursajoute)) { // On ne garde que les informations des récupérations qui sont valables durant la période 01/09/XXXX et 31/08/(XXXX+1) - $dbconstante = 'VALIDRECUP'; - $validrecup = '2'; - if ($this->fonctions->testexistdbconstante($dbconstante)) { $validrecup = $this->fonctions->liredbconstante($dbconstante); } - $datefinvalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($this->fonctions->formatdatedb($commentaireconge->dateajout)))); - if (($datefinvalidite < $datedebutanneeuniv) or ($this->fonctions->formatdatedb($commentaireconge->dateajout)>$datefinanneeuniv)) + //$dbconstante = 'VALIDRECUP'; + //$validrecup = '2'; + //if ($this->fonctions->testexistdbconstante($dbconstante)) { $validrecup = $this->fonctions->liredbconstante($dbconstante); } + //$datefinvalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($this->fonctions->formatdatedb($commentaireconge->dateajout)))); + + $datefinvalidite = $this->fonctions->finvaliditerecuperation($commentaireconge->dateajout); + + //if (($datefinvalidite < $datedebutanneeuniv) or ($this->fonctions->formatdatedb($commentaireconge->dateajout)>$datefinanneeuniv)) + if (($datefinvalidite < $datedebutdb) or ($this->fonctions->formatdatedb($commentaireconge->dateajout)>$datefindb)) { // Cette récupération n'est pas dans la période universitaire => On ne la conserve pas //var_dump("L'interval est hors période"); diff --git a/html/class/fonctions.php b/html/class/fonctions.php index 9c365e5..8042103 100644 --- a/html/class/fonctions.php +++ b/html/class/fonctions.php @@ -122,10 +122,10 @@ public function formatdate($date) /** * - * @param + * @param string $anneeref (optionel) * @return string list (comma separated) of unworked days */ - public function jourferier() + public function jourferier($anneeref = null) { // Chargement des jours fériés $dbconstante='FERIE%'; @@ -136,7 +136,11 @@ public function jourferier() $jrs_feries = ";"; foreach ($jrs_feries_liste as $key => $liste) { - $jrs_feries = $jrs_feries . $liste . ";"; + $annee = trim(str_replace('FERIE',"",$key)); + if (is_null($anneeref) or $annee==($anneeref-1) or $annee==$anneeref or $annee==($anneeref+1)) + { + $jrs_feries = $jrs_feries . $liste . ";"; + } } //var_dump($jrs_feries); return $jrs_feries; @@ -145,31 +149,6 @@ public function jourferier() { return ""; } - - -/* - $sql = "SELECT NOM,VALEUR FROM CONSTANTES WHERE NOM LIKE 'FERIE%'"; - $params = array(); - $query = $this->prepared_select($sql, $params); - $erreur = mysqli_error($this->dbconnect); - if ($erreur != "") { - $errlog = "Fonctions->jourferier : " . $erreur; - echo $errlog . "
"; - error_log(basename(__FILE__) . " " . $this->stripAccents($errlog)); - } - if (mysqli_num_rows($query) == 0) { - $errlog = "Fonctions->jourferier : Pas de jour férié défini dans la base"; - echo $errlog . "
"; - error_log(basename(__FILE__) . " " . $this->stripAccents($errlog)); - } - $jrs_feries = ";"; - while ($result = mysqli_fetch_row($query)) { - $jrs_feries = $jrs_feries . $result[1] . ";"; - } - - // echo "Jours fériés = " . $jrs_feries . "
"; - return $jrs_feries; -*/ } /** @@ -551,7 +530,13 @@ public function anneeref($date = null) { // echo "La date = " . $date . "
"; if (is_null($date)) + { $date = date("d/m/Y"); + } + else + { + $date = $this->formatdate($date); + } // echo "La date = " . $date . "
"; if ($this->verifiedate($date)) { $finperiode = $this->finperiode(); @@ -5491,6 +5476,29 @@ function lirecommentaire(string $commentaireid) return $commentaireconge; } + function finvaliditerecuperation(string $dateref) + { + $dbconstante = 'VALIDRECUP'; + $validrecup = '2'; + if ($this->testexistdbconstante($dbconstante)) { $validrecup = $this->liredbconstante($dbconstante); } + + $dateref = $this->formatdatedb($dateref); + $datefin = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($dateref))); + +/* /////////////////////// + // Bloc pour limiter la validité des récupérations à la date de fin de période => Donc fin de l'année universitaire + //$anneref = $this->anneeref($this->formatdate($dateref)); + $anneref = $this->anneeref($dateref); + // Si l'année de référence de la date de fin est différente de l'année de référence de la date de référence + if ($this->anneeref($datefin) <> $anneref) + { + $datefin = ($anneref+1) . $this->finperiode(); + } + /////////////////////// + */ + return $datefin; + } + } ?> \ No newline at end of file diff --git a/html/class/planning.php b/html/class/planning.php index 0ccc682..c42e7d7 100644 --- a/html/class/planning.php +++ b/html/class/planning.php @@ -54,9 +54,10 @@ function load($agentid, $datedebut, $datefin, $includeteletravail = false, $incl $this->datedebut = $datedebut; $this->datefin = $datefin; - $jrs_feries = $this->fonctions->jourferier(); + //$jrs_feries = $this->fonctions->jourferier(); + $jrs_feries = $this->fonctions->jourferier($this->fonctions->anneeref($datedebut)); - // echo "Jours fériés = " . $jrs_feries . "
"; + //var_dump("Jours fériés = " . $jrs_feries); unset($listeelement); $autodeclaration = null; diff --git a/html/class/recuperation.php b/html/class/recuperation.php index 39301c5..37ded94 100644 --- a/html/class/recuperation.php +++ b/html/class/recuperation.php @@ -130,12 +130,12 @@ function load($agentid, $dateref) :string $dbconstante = 'VALIDRECUP'; $validrecup = '2'; if ($this->fonctions->testexistdbconstante($dbconstante)) { $validrecup = $this->fonctions->liredbconstante($dbconstante); } - - $sql = "SELECT SUM(NBRJRSAJOUTE), SUM(NBJRSPRIS) + + $sql = "SELECT SUM(COMMENTAIRECONGE.NBRJRSAJOUTE), SUM(COMMENTAIRECONGE.NBJRSPRIS) FROM COMMENTAIRECONGE - WHERE AGENTID = ? - AND TYPEABSENCEID = ? - AND ADDDATE(DATEAJOUTCONGE, INTERVAL $validrecup MONTH) >= ? + WHERE COMMENTAIRECONGE.AGENTID = ? + AND COMMENTAIRECONGE.TYPEABSENCEID = ? + AND ADDDATE(COMMENTAIRECONGE.DATEAJOUTCONGE, INTERVAL $validrecup MONTH) >= ? AND COMMENTAIRECONGE.COMMENTAIRECONGEID NOT IN ( SELECT REPLACE(COMPLEMENT.COMPLEMENTID,'" . complement::AVISRH_CONGES_SUP_LABEL . "','') FROM COMPLEMENT @@ -143,6 +143,22 @@ function load($agentid, $dateref) :string AND COMPLEMENT.COMPLEMENTID LIKE '" . complement::AVISRH_CONGES_SUP_LABEL . "%' )"; $params = array($agentid, recuperation::RECUP_ID, $this->fonctions->formatdatedb($dateref)); + +/* $anneeref = $this->fonctions->anneeref($dateref); + $datefinperiode = ($anneeref+1) . $this->fonctions->finperiode(); + $sql = "SELECT SUM(COMMENTAIRECONGE.NBRJRSAJOUTE), SUM(COMMENTAIRECONGE.NBJRSPRIS) + FROM COMMENTAIRECONGE + WHERE COMMENTAIRECONGE.AGENTID = ? + AND COMMENTAIRECONGE.TYPEABSENCEID = ? + AND ? <= LEAST(ADDDATE(COMMENTAIRECONGE.DATEAJOUTCONGE, INTERVAL $validrecup MONTH),STR_TO_DATE(?,'%Y%m%d')) + AND COMMENTAIRECONGE.COMMENTAIRECONGEID NOT IN ( + SELECT REPLACE(COMPLEMENT.COMPLEMENTID,'" . complement::AVISRH_CONGES_SUP_LABEL . "','') + FROM COMPLEMENT + WHERE COMPLEMENT.AGENTID = COMMENTAIRECONGE.AGENTID + AND COMPLEMENT.COMPLEMENTID LIKE '" . complement::AVISRH_CONGES_SUP_LABEL . "%' + )"; + $params = array($agentid, recuperation::RECUP_ID, $this->fonctions->formatdatedb($dateref), $datefinperiode); + */ $query = $this->fonctions->prepared_select($sql, $params); $erreur = mysqli_error($this->dbconnect); if ($erreur != "") diff --git a/html/class/structure.php b/html/class/structure.php index bea0d83..755ba5a 100644 --- a/html/class/structure.php +++ b/html/class/structure.php @@ -1745,7 +1745,8 @@ function pdf($mois_annee_debut, $noiretblanc = false,$includeteletravail = false // /Création des entetes de colones contenant les 31 jours///// $titre_a_ajouter = TRUE; $elementlegende = array(); - foreach ($planningservice as $agentid => $planning) { + + foreach ((array)$planningservice as $agentid => $planning) { if ($titre_a_ajouter) { $pdf->SetFont('helvetica', 'B', 8, '', true); diff --git a/html/etablir_demande.php b/html/etablir_demande.php index 22a5758..2e77dd5 100644 --- a/html/etablir_demande.php +++ b/html/etablir_demande.php @@ -1055,10 +1055,13 @@ function planning_rclick(date,moment) if ($commentaireconge->nbjrspris < $commentaireconge->nbjoursajoute) { // On affiche les informations des récupérations qui sont valables durant la période 01/09/XXXX et 31/08/(XXXX+1) - $dbconstante = 'VALIDRECUP'; - $validrecup = '2'; - if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } - $findatevalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); + //$dbconstante = 'VALIDRECUP'; + //$validrecup = '2'; + //if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } + //$findatevalidite = date('Ymd',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaireconge->dateajout)))); + + $findatevalidite = $fonctions->finvaliditerecuperation($commentaireconge->dateajout); + if (($findatevalidite < $datedebutanneeuniv) or ($fonctions->formatdatedb($commentaireconge->dateajout)>$datefinanneeuniv)) { // Cette récupération n'est pas dans la période universitaire => On ne l'affiche pas diff --git a/html/gestion_dossier.php b/html/gestion_dossier.php index c880e8e..f0b1ebc 100644 --- a/html/gestion_dossier.php +++ b/html/gestion_dossier.php @@ -896,7 +896,8 @@ // Si la structure n'a pas de structures filles => On n'affiche pas ce paramétrage $structlistefille = $structure->structurefille(); - if (count((array)$structlistefille)>0 and false) + //if (count((array)$structlistefille)>0 and false) + if (count((array)$structlistefille)>0 and date('Ymd') >= '20240901') { echo ""; echo ""; diff --git a/html/includes/menu.php b/html/includes/menu.php index a6e289a..ebf0d9e 100644 --- a/html/includes/menu.php +++ b/html/includes/menu.php @@ -353,7 +353,7 @@ function dateIsValid(dateStr) { diff --git a/html/index.php b/html/index.php index f57ea38..5ecab94 100644 --- a/html/index.php +++ b/html/index.php @@ -606,36 +606,6 @@ function start_animation_horizontale() load('DGH_3'); - $structure->gestvalidrespstructfille('N'); - $structure->store(); - - $user = new agent($dbcon); - $user->load(12615); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - - $user = new agent($dbcon); - $user->load(9328); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - - $user = new agent($dbcon); - $user->load(95283); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - - $user = new agent($dbcon); - $user->load(85688); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - - $user = new agent($dbcon); - $user->load(3944); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - - $user = new agent($dbcon); - $user->load(95800); - $nvsolde = $user->newcalculsoldeannuel($fonctions->anneeref(), false, true, false); - */ ?> diff --git a/html/structure_planning.php b/html/structure_planning.php index d5c6c20..85b1eaf 100644 --- a/html/structure_planning.php +++ b/html/structure_planning.php @@ -684,7 +684,7 @@ { echo "
"; //echo "Le code de la structure : " . $structure->id() . "
"; - if ($structure->responsable()->agentid() == $user->agentid()) + if ($structure->responsable()->agentid() == $user->agentid() or $structure->responsablesiham()->agentid() == $user->agentid()) { $planninggris = false; } @@ -693,7 +693,6 @@ $planninggris = true; } - $planninghtml = $structure->planninghtml($indexmois . "/" . $annee,$structure->sousstructure(),$planninggris,true,true); echo $planninghtml; diff --git a/html/valider_jourscomplementaires.php b/html/valider_jourscomplementaires.php index dc7286c..6dbcacd 100644 --- a/html/valider_jourscomplementaires.php +++ b/html/valider_jourscomplementaires.php @@ -148,11 +148,12 @@ //$corpmail = $corpmail . "Suite à cette validation, votre solde de jours complémentaires est de " . ($solde->droitaquis() - $solde->droitpris()) . " jour(s).\n"; //$cronuser->sendmail($currentagent, "Validation d'ajout de jours complémentaires", $corpmail); $commentaire = $fonctions->lirecommentaire($commentaireid); - $dbconstante = 'VALIDRECUP'; - $validrecup = '2'; - if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } - $findatevalidite = date('d/m/Y',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaire->dateajout)))); + //$dbconstante = 'VALIDRECUP'; + //$validrecup = '2'; + //if ($fonctions->testexistdbconstante($dbconstante)) { $validrecup = $fonctions->liredbconstante($dbconstante); } + //$findatevalidite = date('d/m/Y',strtotime('+' . $validrecup . ' month',strtotime($fonctions->formatdatedb($commentaire->dateajout)))); + $findatevalidite = $fonctions->finvaliditerecuperation($commentaire->dateajout); $corpmail = $user->identitecomplete() . " vient de valider l'ajout de " . $commentaire->nbjoursajoute . " jour(s) de récupération.\n"; $corpmail = $corpmail . "Pour rappel, le motif de cet ajout est : \n" . $commentaire->commentaire . ".\n\n";