Commit b4348e8d authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'feature_cotutelle' into test

parents e3d561f7 df7424d3
Loading
Loading
Loading
Loading
+3 −8
Changes for module/TheseCotutelle/src/TheseCotutelle/Controller/TheseCotutelleFichierController.php: 3 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -40,7 +40,9 @@ class TheseCotutelleFichierController extends AbstractController
    public function modifierAction(): Response|ViewModel
    {
        $this->theseCotutelleFichier = $this->getRequestedTheseCotutelleFichier();
        $this->theseCotutelle = $this->theseCotutelleFichier->getTheseCotutelle();
        $this->theseCotutelle = $this->theseCotutelleService->getRepository()->find( // refetch avec jointures
            $this->theseCotutelleFichier->getTheseCotutelle()->getId()
        );

        return $this->ajouterModifier();
    }
@@ -60,13 +62,6 @@ class TheseCotutelleFichierController extends AbstractController
            if ($this->theseCotutelleFichierForm->isValid()) {
                try {
                    $this->saveTheseCotutelleFichier();
                    // en cas de remplacement du fichier, suppression du fichier précédent
                    if (($fichierPrecId = $data[$this->theseCotutelleFichierForm->getFichierHiddenElementName()] ?? null)
                        && $fichierPrecId !== $this->theseCotutelleFichier->getFichier()->getId()) {
                        /** @var \Fichier\Entity\Db\Fichier $fichierPrec */
                        $fichierPrec = $this->fichierService->getRepository()->find($fichierPrecId);
                        $this->fichierService->supprimerFichiers([$fichierPrec]);
                    }
                    $this->flashMessenger()->addSuccessMessage(sprintf(
                        "Le document pour la cotutelle de thèse de %s a été enregistré avec succès.",
                        $this->theseCotutelle->getThese()->getDoctorant()
+2 −1
Changes for module/TheseCotutelle/src/TheseCotutelle/Controller/TheseCotutelleInscriptionController.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ class TheseCotutelleInscriptionController extends AbstractController
    public function supprimerAction(): Response
    {
        $this->theseCotutelleInscription = $this->getRequestedTheseCotutelleInscription();
        $this->theseCotutelle = $this->theseCotutelleInscription->getTheseCotutelle();

        $this->theseCotutelleInscription->historiser($this->userContextService->getDbUser());

@@ -137,7 +138,7 @@ class TheseCotutelleInscriptionController extends AbstractController
    private function getRequestedTheseCotutelleInscription(): TheseCotutelleInscription
    {
        /** @var \TheseCotutelle\Entity\Db\TheseCotutelleInscription $theseCotutelleInscription */
        $theseCotutelleInscription = $this->theseCotutelleInscriptionService->getRepository()->find($this->params('these-cotutelle-inscription'));
        $theseCotutelleInscription = $this->theseCotutelleInscriptionService->getRepository()->find($this->params('theseCotutelleInscription'));
        Assert::notNull($theseCotutelleInscription);
        return $theseCotutelleInscription;
    }
+1 −1
Changes for module/TheseCotutelle/src/TheseCotutelle/Entity/Db/Mapping/TheseCotutelle.Entity.Db.TheseCotutelleInscription.dcm.xml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
                <join-column name="etablissement_id" referenced-column-name="id"/>
            </join-columns>
        </many-to-one>
        <many-to-one field="justifInscriptionFichier" target-entity="Fichier\Entity\Db\Fichier">
        <many-to-one field="fichier" target-entity="Fichier\Entity\Db\Fichier">
            <join-columns>
                <join-column name="justificatif_inscription_fichier_id" referenced-column-name="id"/>
            </join-columns>
+1 −1
Changes for module/TheseCotutelle/src/TheseCotutelle/Entity/Db/Repository/TheseCotutelleRepository.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class TheseCotutelleRepository extends DefaultEntityRepository
        $qb
            ->leftJoin('cotut.inscriptions', 'i', Join::WITH, 'i.histoDestruction is null')->addSelect('i')
            ->leftJoin('i.etablissement', 'ie')->addSelect('ie')
            ->leftJoin('i.justifInscriptionFichier', 'if')->addSelect('if');
            ->leftJoin('i.fichier', 'if')->addSelect('if');
        $qb
            ->leftJoin('cotut.presences', 'p', Join::WITH, 'p.histoDestruction is null')->addSelect('p')
            ->leftJoin('p.etablissement', 'pe')->addSelect('pe')
+5 −0
Changes for module/TheseCotutelle/src/TheseCotutelle/Entity/Db/Service/TheseCotutelleFichierService.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -38,6 +38,11 @@ class TheseCotutelleFichierService extends BaseService
                $this->entityManager->persist($theseCotutelleFichier);
            }

            // en cas de remplacement du fichier, suppression du fichier précédent
            if ($fichierPrec = $theseCotutelleFichier->getFichierInitial()) {
                $this->fichierService->supprimerFichiers([$fichierPrec]);
            }

            $this->entityManager->flush();
            $this->entityManager->commit();
        } catch (Exception $e) {
Loading