Commit 80f746db authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

WIP

parent cc702a46
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for code/test9.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ $tbl = $container->get(\UnicaenTbl\Service\TableauBordService::class);

$params = [
    //'INTERVENANT_ID' => 940962,
    //'ANNEE_ID' => 2024,
    'ANNEE_ID' => 2021,
];

$tbl->calculer('contrat', $params);
+1 −1
Changes for config/autoload/unicaen-tbl.global.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ return [
                'key_values_if_null' => [
                    'STRUCTURE_ID' => 0,
                    'CONTRAT_ID' => 0,
                    'CONTRAT_PARENT_ID',
                    'CONTRAT_PARENT_ID' => 0,
                    'VOLUME_HORAIRE_MISSION_ID' => 0,
                    'VOLUME_HORAIRE_ID' => 0,
                    'VOLUME_HORAIRE_REF_ID' => 0,
+34
Changes for module/Contrat/src/Tbl/Process/ContratProcess.php: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -151,6 +151,39 @@ class ContratProcess implements ProcessInterface



    public function contratHydrateFromVolumeHoraire(Contrat $contrat, VolumeHoraire $volumeHoraire): void
    {
        if ($volumeHoraire->volumeHoraireId){
            $contrat->typeService = $this->getServiceTypeService()->getEnseignement();
            $contrat->isMission    = false;
        }elseif($volumeHoraire->volumeHoraireRefId){
            $contrat->typeService = $this->getServiceTypeService()->getReferentiel();
            $contrat->isMission    = false;
        }elseif($volumeHoraire->volumeHoraireMissionId){
            $contrat->typeService = $this->getServiceTypeService()->getMission();
            $contrat->isMission    = true;
        }

        // calcul de la structure
        if ($contrat->isMission) {
            switch ($this->parametreMis) {
                case Parametre::CONTRAT_MIS_GLOBAL:
                    $contrat->structureId = null;
                case Parametre::CONTRAT_MIS_COMPOSANTE:
                case Parametre::CONTRAT_MIS_MISSION:
                    $contrat->structureId = $volumeHoraire->structureId;
            }
        } else {
            switch ($this->parametreEns) {
                case Parametre::CONTRAT_ENS_GLOBAL:
                    $contrat->structureId = null;
                case Parametre::CONTRAT_ENS_COMPOSANTE:
                    $contrat->structureId = $volumeHoraire->structureId;
            }
        }
    }


    private function getContrat(int $intervenantId, string $uuid): Contrat
    {
        if (!array_key_exists($intervenantId, $this->intervenants)) {
@@ -194,6 +227,7 @@ class ContratProcess implements ProcessInterface
        if (empty($contrat->annee)) {
            $contrat->annee = $this->getServiceAnnee()->get((int)$data['annee_id']);
        }
        $this->contratHydrateFromVolumeHoraire($contrat, $volumeHoraire);
        $volumeHoraire->setContrat($contrat);

        return $volumeHoraire;