From 47fcb5389ca7264ff21f0535e8a1519c43a63f47 Mon Sep 17 00:00:00 2001
From: Antony Le Courtes <antony.lecourtes@unicaen.fr>
Date: Mon, 24 Feb 2025 14:41:58 +0100
Subject: [PATCH] =?UTF-8?q?Prise=20en=20compte=20d'un=20nouveau=20param?=
 =?UTF-8?q?=C3=A8tre=20pour=20l'export=20RH,=20pour=20forcer=20les=20dates?=
 =?UTF-8?q?=20de=20d=C3=A9but=20et=20de=20fin=20de=20contrat=20=C3=A0=20la?=
 =?UTF-8?q?=20date=20de=20l'ann=C3=A9e=20universitaire,=20notamment=20pour?=
 =?UTF-8?q?=20les=20contrats=20de=20missions=20=C3=A9tudiantes=20(#60541)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ExportRh/src/Connecteur/Siham/SihamConnecteur.php | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/module/ExportRh/src/Connecteur/Siham/SihamConnecteur.php b/module/ExportRh/src/Connecteur/Siham/SihamConnecteur.php
index 38a07b5bf8..f79fbbfd70 100644
--- a/module/ExportRh/src/Connecteur/Siham/SihamConnecteur.php
+++ b/module/ExportRh/src/Connecteur/Siham/SihamConnecteur.php
@@ -210,9 +210,9 @@ class SihamConnecteur implements ConnecteurRhInterface
             /*Recherche de la date d'effet à passer selon enseignement ou mission, si mission on prend la première mission de l'année universitaire
             sinon on prend les dates de début et de fin de l'année universitaire*/
             $firstMission = $this->getServiceContrat()->getFirstContratMission($intervenant);
+            $dateMission = ($this->siham->getConfig()['contrat']['missionDate'])??'MISSION';
 
-
-            if (!empty($firstMission)) {
+            if (!empty($firstMission) && $dateMission == 'MISSION') {
                 $dateEffet = $firstMission->getDateDebut()->format('Y-m-d');
                 $dateFin   = $firstMission->getDateFin()->format('Y-m-d');
             } else {
@@ -237,6 +237,7 @@ class SihamConnecteur implements ConnecteurRhInterface
                  'temoinValidite'    => 1,
                 ];
 
+
             /*CONTRAT*/
             //On récupére le nombre d'heures du contrat et le taux horaire appliqué
             $infos = $this->getInfosContrat($intervenant, $firstMission);
@@ -524,7 +525,9 @@ class SihamConnecteur implements ConnecteurRhInterface
             sinon on prend les dates de début et de fin de l'année universitaire*/
 
             $firstMission = $this->getServiceContrat()->getFirstContratMission($intervenant);
-            if (!empty($firstMission)) {
+            $dateMission = ($this->siham->getConfig()['contrat']['missionDate'])??'MISSION';
+
+            if (!empty($firstMission) && $dateMission == 'MISSION') {
                 $dateEffet = $firstMission->getDateDebut()->format('Y-m-d');
                 $dateFin   = $firstMission->getDateFin()->format('Y-m-d');
             } else {
@@ -534,8 +537,6 @@ class SihamConnecteur implements ConnecteurRhInterface
             }
 
             /*Formatage du matricule*/
-
-            $matricule = '';
             //On récupére le code RH par le INSEE
             $matricule = $this->trouverCodeRhByInsee($intervenant);
 
-- 
GitLab