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

Ajout de la suppression de proposition dans l'index des structures

parent c8d21cd7
Loading
Loading
Loading
Loading
+14
Changes for module/Application/src/Application/Entity/Db/Repository/ValidationRepository.php: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -52,5 +52,19 @@ class ValidationRepository extends DefaultEntityRepository
        return $qb->getQuery()->getResult();
    }

    /**
     * @param string $code
     * @param These  $these
     * @return Validation[]
     */
    public function findValidationsByThese(These $these)
    {
        $qb = $this->createQueryBuilder('v')
            ->where('t = :these')
            ->andWhere('1 = pasHistorise(v)')
            ->setParameter('these', $these)
        ;
        return $qb->getQuery()->getResult();
    }

}
 No newline at end of file
+12
Changes for module/Soutenance/config/others/proposition.config.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -128,6 +128,7 @@ return [
                    'controller' => PropositionController::class,
                    'action'     => [
                        'toggle-sursis',
                        'suppression',
                    ],
                    'privileges' => PropositionPrivileges::PROPOSITION_SURSIS,
                ],
@@ -174,6 +175,17 @@ return [
                                    ],
                                ],
                            ],
                            'suppression' => [
                                'type' => Literal::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/suppression',
                                    'defaults' => [
                                        'controller' => PropositionController::class,
                                        'action'     => 'suppression',
                                    ],
                                ],
                            ],
                            'modifier-date-lieu' => [
                                'type' => Literal::class,
                                'may_terminate' => true,
+20
Changes for module/Soutenance/src/Soutenance/Controller/Proposition/PropositionController.php: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Entity\Db\Acteur;
use Application\Entity\Db\Doctorant;
use Application\Entity\Db\Individu;
use Application\Entity\Db\Role;
use Application\Entity\Db\TypeValidation;
use Application\Entity\Db\Utilisateur;
use Application\Entity\Db\VersionFichier;
use Application\Service\Acteur\ActeurServiceAwareTrait;
@@ -413,6 +414,8 @@ class PropositionController extends AbstractController {
        /** Justificatifs attendus ---------------------------------------------------------------------------------- */
        $justificatifs = $this->getJustificatifService()->generateListeJustificatif($proposition);

        $validationPDC = $this->getValidationService()->getRepository()->findValidationByCodeAndThese(TypeValidation::CODE_PAGE_DE_COUVERTURE, $these);

        return new ViewModel([
            'these'             => $these,
            'proposition'       => $proposition,
@@ -421,6 +424,7 @@ class PropositionController extends AbstractController {
            'validations'       => ($proposition)?$this->getPropositionService()->getValidationSoutenance($these):[],
            'directeurs'        => $directeurs,
            'rapporteurs'       => $rapporteurs,
            'validationPDC'     => $validationPDC,
        ]);
    }

@@ -503,4 +507,20 @@ class PropositionController extends AbstractController {
        }
        return $proposition;
    }

    public function suppressionAction() {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findByThese($these);

        //detruire la  || historiser si on histo
        $this->getPropositionService()->delete($proposition);

        //historiser les validations
        $validations = $this->getValidationService()->getRepository()->findValidationsByThese($these);
        foreach ($validations as $validation) {
            $this->getValidationService()->historise($validation);
        }

        return $this->redirect()->toRoute('soutenance', [], [], true);
    }
}
 No newline at end of file
+13
Changes for module/Soutenance/src/Soutenance/Service/Proposition/PropositionService.php: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -126,6 +126,19 @@ class PropositionService {
        }
    }

    /**
     * @param Proposition $proposition
     */
    public function delete($proposition)
    {
        try {
            $this->getEntityManager()->remove($proposition);
            $this->getEntityManager()->flush($proposition);
        } catch (OptimisticLockException $e) {
            throw new RuntimeException("Une erreur s'est produite lors de la mise à jour de la proposition de soutenance !");
        }
    }

    public function findMembre($idMembre)
    {
        $qb = $this->getEntityManager()->getRepository(Membre::class)->createQueryBuilder("membre")
+1 −1
Changes for module/Soutenance/view/soutenance/index/index-structure.phtml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ $canSuppression = ($role->getCode() === Role::CODE_ADMIN_TECH);
                    </a>
                    <br/>
                    <?php if ($canSuppression) : ?>
                    <a href="<?php echo $this->url('soutenance'); ?>"
                    <a href="<?php echo $this->url('soutenance/proposition/suppression', ['these' => $proposition->getThese()->getId()], [], true); ?>"
                       title="">
                        Suppression
                    </a>
Loading