Commit 4454ceea authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Modification de l'assertion ouvrant la validation de l'UR

parent 1bb8b91a
Loading
Loading
Loading
Loading
+1 −0
Changes for CHANGELOG.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ Journal des modifications
- [FIX] Changement du sujet associé à la validation finale de la proposition de soutenance
- Templatisation de la notification de confirmation d'adresse électronique
- [FIX] Correction de l'envoi multiple de notification vers le président de jury lors du dépôt d'une version corrigée.
- Modification de l'assertion ouvrant la validation de l'UR

3.0.0 (oracle => postgres)
-----
+17 −4
Changes for module/Soutenance/src/Soutenance/Assertion/PropositionAssertion.php: 17 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -140,12 +140,25 @@ class PropositionAssertion implements AssertionInterface {
            case PropositionPrivileges::PROPOSITION_VALIDER_UR:
                switch ($role) {
                    case Role::CODE_RESP_UR :

                        $validationsArray = [];
                        $validationsArray[$these->getDoctorant()->getIndividu()->getId()] = [];
                        /** @var Acteur $directeur */
                        foreach ($these->getActeursByRoleCode(Role::CODE_DIRECTEUR_THESE) as $directeur) $validationsArray[$directeur->getIndividu()->getId()] = [];
                        foreach ($these->getActeursByRoleCode(Role::CODE_CODIRECTEUR_THESE) as $directeur) $validationsArray[$directeur->getIndividu()->getId()] = [];
                        $validations_ACTEUR = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_PROPOSITION_SOUTENANCE, $these);
                        foreach ($validations_ACTEUR as $validation) {
                            $validationsArray[$validation->getIndividu()->getId()][] = $validation;
                        }
                        $ok = true;
                        foreach ($validationsArray as $id => $validations) {
                            if (empty($validations)) {
                                $ok = false;
                                break;
                            }
                        }
                        $validations_UNITE  = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_VALIDATION_PROPOSITION_UR, $these);
                        $nbDirs = count($these->getActeursByRoleCode(Role::CODE_DIRECTEUR_THESE));
                        $nbCoDirs = count($these->getActeursByRoleCode(Role::CODE_CODIRECTEUR_THESE));
                        $nbActeur = 1 + $nbDirs + $nbCoDirs;
                        return !$validations_UNITE && count($validations_ACTEUR) === $nbActeur && $structure === $these->getUniteRecherche()->getStructure();
                        return !$validations_UNITE && $ok && $structure === $these->getUniteRecherche()->getStructure();
                    default:
                        return false;
                }