Commit 325251b9 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] Module Admission : plantage lors de la suppression complète d'un dossier.

parent 019b8a82
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ Journal des modifications
- [FIX] Rapport CSI : rétablissement du bouton de suppression d'un rapport.
- [FIX] Corrections de divers plantages dûs à des valeurs null.
- [FIX] Variable possiblement indéfinie dans le footer de la convention de mise en ligne de la thèse.
- [FIX] Module Admission : plantage lors de la suppression complète d'un dossier.

12.0.0
------
+6 −8
Original line number Diff line number Diff line
@@ -130,8 +130,7 @@ class AdmissionService extends BaseService
     */
    public function delete(Admission $admission): void
    {
        $this->getEntityManager()->beginTransaction();

        $this->entityManager->beginTransaction();
        try {
            $etudiant = $admission->getEtudiant()->first();
            if ($etudiant instanceof Etudiant) {
@@ -148,6 +147,7 @@ class AdmissionService extends BaseService
                $this->admissionFinancementService->delete($financement);
            }

            /** @var \Admission\Entity\Db\ConventionFormationDoctorale $conventionFormationDoctorale */
            $conventionFormationDoctorale = $this->conventionFormationDoctoraleService->getRepository()->findOneBy(["admission" => $admission]);
            if($conventionFormationDoctorale){
                $this->conventionFormationDoctoraleService->delete($conventionFormationDoctorale);
@@ -157,13 +157,11 @@ class AdmissionService extends BaseService
            $this->admissionValidationService->deleteValidationForAdmission($admission);
            $this->admissionAvisService->deleteAllAvisForAdmission($admission);

            $this->getEntityManager()->remove($admission);
            $this->getEntityManager()->flush($admission);

            // commit
            $this->commit();
            $this->entityManager->remove($admission);
            $this->entityManager->flush();
            $this->entityManager->commit();
        } catch (ORMException $e) {
            $this->rollBack();
            $this->entityManager->rollback();
            throw $e;
        }
    }
+5 −2
Original line number Diff line number Diff line
@@ -137,15 +137,18 @@ class AdmissionAvisService extends BaseService
     *
     * @param Admission $admission
     */
    public function deleteAllAvisForAdmission(Admission $admission)
    public function deleteAllAvisForAdmission(Admission $admission): void
    {
        $this->entityManager->beginTransaction();
        try {
            foreach ($admission->getAdmissionAvis(true) as $admissionAvis) {
                $admission->removeAdmissionAvis($admissionAvis);
                $this->entityManager->remove($admissionAvis);
                $this->entityManager->flush($admissionAvis);
                $this->entityManager->flush();
                $this->entityManager->commit();
            }
        } catch (ORMException $e) {
            $this->entityManager->rollback();
            throw new RuntimeException("Erreur rencontrée lors de la suppression en bdd", null, $e);
        }
    }
+5 −8
Original line number Diff line number Diff line
@@ -87,16 +87,13 @@ class ConventionFormationDoctoraleService extends BaseService
     */
    public function delete(ConventionFormationDoctorale $conventionFormationDoctorale): void
    {
        $this->getEntityManager()->beginTransaction();

        $this->entityManager->beginTransaction();
        try {
            $this->getEntityManager()->remove($conventionFormationDoctorale);
            $this->getEntityManager()->flush($conventionFormationDoctorale);

            // commit
            $this->commit();
            $this->entityManager->remove($conventionFormationDoctorale);
            $this->entityManager->flush();
            $this->entityManager->commit();
        } catch (ORMException $e) {
            $this->rollBack();
            $this->entityManager->rollback();
            throw $e;
        }
    }
+8 −5
Original line number Diff line number Diff line
@@ -156,19 +156,22 @@ class DocumentService extends BaseService
     */
    public function delete(Document $document) : Document
    {

        $this->entityManager->beginTransaction();
        try {
            $verification = $document->getVerificationDocument()->first();
            if($verification instanceof Verification){
                $this->verificationService->delete($verification);
            }
            $this->getEntityManager()->remove($document);
            $this->getEntityManager()->flush($document);
            $this->entityManager->remove($document);
            $this->entityManager->flush();
            $this->entityManager->commit();

            $fichier = $document->getFichier();
            if($fichier instanceof Fichier){
                $this->fichierService->supprimerFichiers([$fichier]);
            }
        } catch (ORMException $e) {
        } catch (Exception $e) {
            $this->entityManager->rollback();
            throw new RuntimeException('Un problème est survenu lors de la suppression d\'un document', $e);
        }

@@ -186,7 +189,7 @@ class DocumentService extends BaseService
            foreach ($admission->getDocument() as $document) {
                $this->delete($document);
            }
        } catch (ORMException $e) {
        } catch (Exception $e) {
            throw new RuntimeException("Erreur rencontrée lors de la suppression en bdd", null, $e);
        }
    }
Loading