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

Régularisation de différent warning du code_sniffer

parent a7de2c89
Loading
Loading
Loading
Loading
+24 −10
Changes for module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php: 24 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -11,12 +11,15 @@ use Application\Service\Role\RoleServiceAwareTrait;
use Application\Service\Source\SourceServiceAwareTrait;
use Application\Service\Utilisateur\UtilisateurServiceAwareTrait;
use DateInterval;
use Doctrine\ORM\Exception\ORMException;
use Exception;
use Fichier\Entity\Db\NatureFichier;
use Fichier\Service\Fichier\FichierServiceAwareTrait;
use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Individu\Entity\Db\Individu;
use Individu\Service\IndividuServiceAwareTrait;
use JetBrains\PhpStorm\NoReturn;
use Laminas\Http\Response;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\ViewModel;
@@ -118,6 +121,13 @@ class PresoutenanceController extends AbstractController
        $validationBDD = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_VALIDATION_PROPOSITION_BDD, $these);
        $validationPDC = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_PAGE_DE_COUVERTURE, $these);

        /** Parametres ---------------------------------------------------------------------------------------------- */
        try {
            $deadline = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DELAI_RETOUR);
        } catch (Exception $e) {
            throw new RuntimeException("Une erreur est survenue lors de la récupération de la valeur d'un paramètre", 0 , $e);
        }

        return new ViewModel([
            'these' => $these,
            'proposition' => $proposition,
@@ -132,7 +142,7 @@ class PresoutenanceController extends AbstractController
            'justificatifsOk' => $justificatifsOk,
            'justificatifs' => $justificatifs,

            'deadline' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DELAI_RETOUR),
            'deadline' => $deadline,

            'autorisation' => $autorisation,
            'pv' => $pv,
@@ -182,7 +192,7 @@ class PresoutenanceController extends AbstractController
        $membres = $proposition->getMembres();
        $membre = $this->getMembreService()->getRequestedMembre($this);

        /** Ici on prépare la liste des acteurs correspondant aux différents rôles pour le Select du formulaire
        /** Ici, on prépare la liste des acteurs correspondant aux différents rôles pour le Select du formulaire
         *  d'association. On part du principe :
         *  - qu'un Rapporteur du jury est Rapporteur et Membre du jury,
         *  - qu'un Rapporteur absent est Rapporteur,
@@ -235,7 +245,7 @@ class PresoutenanceController extends AbstractController
            $acteur = $this->getActeurService()->getRepository()->find($acteurId);
            $individu = $acteur->getIndividu();

            if (!$acteur) throw new RuntimeException("Aucun acteur à associer !");
            if (! isset($acteur)) throw new RuntimeException("Aucun acteur à associer !");

            //mise à jour du membre de soutenance
            $membre->setActeur($acteur);
@@ -455,7 +465,7 @@ class PresoutenanceController extends AbstractController
    }

    /** Document pour la signature en présidence */
    public function procesVerbalSoutenanceAction()
    #[NoReturn] public function procesVerbalSoutenanceAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -473,7 +483,7 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    public function avisSoutenanceAction()
    #[NoReturn] public function avisSoutenanceAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -491,7 +501,7 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    public function rapportSoutenanceAction()
    #[NoReturn] public function rapportSoutenanceAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -509,7 +519,7 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    public function rapportTechniqueAction()
    #[NoReturn] public function rapportTechniqueAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -589,7 +599,7 @@ class PresoutenanceController extends AbstractController
    }

    /** Document pour la signature en présidence */
    public function convocationsAction()
    #[NoReturn] public function convocationsAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -617,7 +627,7 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    public function convocationDoctorantAction()
    #[NoReturn] public function convocationDoctorantAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -643,7 +653,7 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    public function convocationMembreAction()
    #[NoReturn] public function convocationMembreAction(): void
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
@@ -840,6 +850,7 @@ class PresoutenanceController extends AbstractController
        $proposition = $this->getPropositionService()->findOneForThese($these);
        $membres = $proposition->getMembres();

        try {
            foreach ($membres as $membre) {
                /** @var Acteur $acteur */
                $source_code_acteur = 'SyGAL_Simulation_Rapporteur_' . $membre->getId();
@@ -865,6 +876,9 @@ class PresoutenanceController extends AbstractController
                    $this->getActeurService()->getEntityManager()->flush($individu);
                }
            }
        } catch (ORMException $e) {
            throw new RuntimeException("Un problème est survenu en Base de donnée", 0 , $e);
        }

        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }
+21 −20
Changes for module/Soutenance/src/Soutenance/Controller/PropositionController.php: 21 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Entity\Db\Role;
use Application\Entity\Db\Utilisateur;
use Application\Service\Role\RoleServiceAwareTrait;
use Application\Service\UserContextServiceAwareTrait;
use Exception;
use Fichier\Entity\Db\NatureFichier;
use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Individu\Entity\Db\Individu;
@@ -133,32 +134,20 @@ class PropositionController extends AbstractController
        /** @var IndividuRole[] $ecoleResponsables */
        $ecoleResponsables = [];
        if ($these->getEcoleDoctorale() !== null) {
            // todo : utiliser findIndividuRoleByStructure(..., null, $these->getEtablissement())
            $ecoleResponsables = $this->getRoleService()->findIndividuRoleByStructure($these->getEcoleDoctorale()->getStructure());
            $ecoleResponsables = array_filter($ecoleResponsables, function (IndividuRole $ir) use ($these) {
                return $ir->getIndividu()->getEtablissement() and $ir->getIndividu()->getEtablissement()->getId() === $these->getEtablissement()->getId();
            });
            $ecoleResponsables = $this->getRoleService()->findIndividuRoleByStructure($these->getEcoleDoctorale()->getStructure(), null, $these->getEtablissement());
        }
        /** @var IndividuRole[] $uniteResponsables */
        $uniteResponsables = [];
        if ($these->getUniteRecherche() !== null) {
            // todo : utiliser findIndividuRoleByStructure(..., null, $these->getEtablissement())
            $uniteResponsables = $this->getRoleService()->findIndividuRoleByStructure($these->getUniteRecherche()->getStructure());
            $uniteResponsables = array_filter($uniteResponsables, function (IndividuRole $ir) use ($these) {
                return $ir->getIndividu()->getEtablissement() and $ir->getIndividu()->getEtablissement()->getId() === $these->getEtablissement()->getId();
            });
            $uniteResponsables = $this->getRoleService()->findIndividuRoleByStructure($these->getUniteRecherche()->getStructure(), null, $these->getEtablissement());
        }
        /** @var IndividuRole[] $etablissementResponsables */
        $etablissementResponsables = [];
        if ($these->getEtablissement() !== null) {
            // todo : utiliser findIndividuRoleByStructure(..., Role::CODE_BDD, $these->getEtablissement())
            $etablissementResponsables = $this->roleService->findIndividuRoleByStructure($these->getEtablissement()->getStructure());
            $etablissementResponsables = $this->roleService->findIndividuRoleByStructure($these->getEtablissement()->getStructure(), null, $these->getEtablissement());
            $etablissementResponsables = array_filter($etablissementResponsables, function (IndividuRole $ir) {
                return $ir->getRole()->getCode() === Role::CODE_BDD;
            });
            $etablissementResponsables = array_filter($etablissementResponsables, function (IndividuRole $ir) use ($these) {
                return $ir->getIndividu()->getEtablissement() and $ir->getIndividu()->getEtablissement()->getId() === $these->getEtablissement()->getId();
            });
        }
        $informationsOk = true;
        $directeurs = $this->getActeurService()->getRepository()->findEncadrementThese($these);
@@ -201,6 +190,18 @@ class PropositionController extends AbstractController
        /** Récupération des éléments liés au bloc 'intégrité scientifique' */
        $attestationsIntegriteScientifique = $this->getJustificatifService()->getJustificatifsByPropositionAndNature($proposition, NatureFichier::CODE_FORMATION_INTEGRITE_SCIENTIFIQUE);

        /** Paramètres ---------------------------------------------------------------------------------------------- */

        try {
            $FORMULAIRE_DELOCALISATION = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_DELOCALISATION);
            $FORMULAIRE_DELEGUATION = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_DELEGATION_SIGNATURE);
            $FORMULAIRE_DEMANDE_LABEL = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_LABEL_EUROPEEN);
            $FORMULAIRE_DEMANDE_ANGLAIS = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_REDACTION_ANGLAIS);
            $FORMULAIRE_DEMANDE_CONFIDENTIALITE = $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_CONFIDENTIALITE);
        } catch (Exception $e) {
            throw new RuntimeException("Une erreur est survenue lors de la récupération de paramètre.",0,$e);
        }

        return new ViewModel([
            'these' => $these,
            'proposition' => $proposition,
@@ -224,11 +225,11 @@ class PropositionController extends AbstractController
            'informationsOk' => $informationsOk,
            'avis' => $this->getAvisService()->getAvisByThese($these),

            'FORMULAIRE_DELOCALISATION' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_DELOCALISATION),
            'FORMULAIRE_DELEGUATION' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_DELEGATION_SIGNATURE),
            'FORMULAIRE_DEMANDE_LABEL' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_LABEL_EUROPEEN),
            'FORMULAIRE_DEMANDE_ANGLAIS' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_REDACTION_ANGLAIS),
            'FORMULAIRE_DEMANDE_CONFIDENTIALITE' => $this->getParametreService()->getValeurForParametre(SoutenanceParametres::CATEGORIE, SoutenanceParametres::DOC_CONFIDENTIALITE),
            'FORMULAIRE_DELOCALISATION' => $FORMULAIRE_DELOCALISATION,
            'FORMULAIRE_DELEGUATION' => $FORMULAIRE_DELEGUATION,
            'FORMULAIRE_DEMANDE_LABEL' => $FORMULAIRE_DEMANDE_LABEL,
            'FORMULAIRE_DEMANDE_ANGLAIS' => $FORMULAIRE_DEMANDE_ANGLAIS,
            'FORMULAIRE_DEMANDE_CONFIDENTIALITE' => $FORMULAIRE_DEMANDE_CONFIDENTIALITE,

        ]);
    }