Commit 0dfcec9e authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Restriction de la liste des validations à une validation

parent 11879e07
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ class ValidationRepository extends DefaultEntityRepository
     * @param These $these
     * @param string $code
     * @param Individu $individu
     * @return Validation[]
     * @return Validation|null
     */
    public function findValidationByTheseAndCodeAndIndividu(These $these, string $code, Individu $individu) : array
    public function findValidationByTheseAndCodeAndIndividu(These $these, string $code, Individu $individu) : ?Validation
    {
        $qb = $this->createQueryBuilder('v')
            ->where('tv.code = :code')
@@ -52,7 +52,7 @@ class ValidationRepository extends DefaultEntityRepository
            ->setParameter('these', $these)
        ;

        return $qb->getQuery()->getResult();
        return $qb->getQuery()->getOneOrNullResult();
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -267,9 +267,9 @@ class PresoutenanceController extends AbstractController
        $membre->setActeur(null);
        $this->getMembreService()->update($membre);

        $validations = $this->getValidationService()->getRepository()->findValidationByTheseAndCodeAndIndividu($these, TypeValidation::CODE_ENGAGEMENT_IMPARTIALITE, $acteur->getIndividu());
        if (!empty($validations)) {
            $this->getValidationService()->unsignEngagementImpartialite(current($validations));
        $validation = $this->getValidationService()->getRepository()->findValidationByTheseAndCodeAndIndividu($these, TypeValidation::CODE_ENGAGEMENT_IMPARTIALITE, $acteur->getIndividu());
        if ($validation !== null) {
            $this->getValidationService()->unsignEngagementImpartialite($validation);
        }

        $utilisateur = $this->utilisateurService->getRepository()->findByUsername($username);
+2 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ class NotifierSoutenanceService extends NotifierService
     * @param Validation $validation
     * @see Application/view/soutenance/notification/validation-acteur.phtml
     */
    public function triggerValidationProposition($these, $validation)
    public function triggerValidationProposition(These $these, Validation $validation)
    {
        $emails = $this->fetchEmailActeursDirects($these);

@@ -193,6 +193,7 @@ class NotifierSoutenanceService extends NotifierService
                ->setTemplatePath('soutenance/notification/validation-acteur')
                ->setTemplateVariables([
                    'validation' => $validation,
                    'these' => $these,
                ]);
            $this->trigger($notif);
        }
+3 −3
Original line number Diff line number Diff line
@@ -428,7 +428,7 @@ class PropositionService {
        $validations[Role::CODE_DOCTORANT] = [];
        foreach ($doctorants as $doctorant) {
            $validation = $this->getValidationService()->getRepository()->findValidationByTheseAndCodeAndIndividu($these,TypeValidation::CODE_PROPOSITION_SOUTENANCE, $doctorant->getIndividu());
            if ($validation) $validations[Role::CODE_DOCTORANT][] = current($validation);
            if ($validation) $validations[Role::CODE_DOCTORANT][] = $validation;
        }


@@ -437,7 +437,7 @@ class PropositionService {
        $validations[Role::CODE_DIRECTEUR_THESE] = [];
        foreach ($directeurs as $directeur) {
            $validation = $this->getValidationService()->getRepository()->findValidationByTheseAndCodeAndIndividu($these,TypeValidation::CODE_PROPOSITION_SOUTENANCE, $directeur->getIndividu());
            if ($validation) $validations[Role::CODE_DIRECTEUR_THESE][] = current($validation);
            if ($validation) $validations[Role::CODE_DIRECTEUR_THESE][] = $validation;
        }

        /** Recuperation de la validation du codirecteur de thèse */
@@ -445,7 +445,7 @@ class PropositionService {
        $validations[Role::CODE_CODIRECTEUR_THESE] = [];
        foreach ($codirecteurs as $codirecteur) {
            $validation = $this->getValidationService()->getRepository()->findValidationByTheseAndCodeAndIndividu($these,TypeValidation::CODE_PROPOSITION_SOUTENANCE, $codirecteur->getIndividu());
            if ($validation) $validations[Role::CODE_CODIRECTEUR_THESE][] = current($validation);
            if ($validation) $validations[Role::CODE_CODIRECTEUR_THESE][] = $validation;
        }

        /** Recuperation de la validation de l'unite de recherche */
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class ValidationService
     * @param These $these
     * @return Validation
     */
    public function validatePropositionSoutenance($these)
    public function validatePropositionSoutenance(These $these) : Validation
    {
        // l'individu sera enregistré dans la validation pour faire le lien entre Utilisateur et Individu.
        $individu = $this->userContextService->getIdentityIndividu();
Loading