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

Horodatage de la soutenance : done

parent f3cfeb89
Loading
Loading
Loading
Loading
+17 −0
Changes for doc/release-notes/v5.2.11.md: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -346,4 +346,21 @@ FROM tmp_these tmp
         LEFT JOIN unite_rech ur ON ur.source_code::text = tmp.unite_rech_id::text
         LEFT JOIN version_corrigee_deposee vcd ON vcd.source_code::text = tmp.source_code::text;

-- Horodatage
drop table soutenance_evenement;

create table horodatage_horodatage (
  id         serial        constraint horodatage_horodatage_pk       primary key,
  date       timestamp     not null,
  user_id    integer       not null constraint horodatage_horodatage_utilisateur_id_fk references utilisateur,
  type       varchar(1024) not null,
  complement varchar(1024)
);
create table soutenance_horodatage
(
  proposition_id integer not null constraint soutenance_horodatage_soutenance_proposition_id_fk references soutenance_proposition on delete cascade,
  horodatage_id  integer not null constraint soutenance_horodatage_horodatage_horodatage_id_fk  references horodatage_horodatage  on delete cascade,
  constraint soutenance_horodatage_pk primary key (proposition_id, horodatage_id)
);

```
 No newline at end of file
+0 −39
Changes for module/Soutenance/config/others/evenement.config.php: 0 added lines, 39 removed lines.
Original line number Diff line number Diff line
<?php

namespace Soutenance;

use Soutenance\Service\Evenement\EvenementService;
use Soutenance\Service\Evenement\EvenementServiceFactory;
use UnicaenAuth\Provider\Rule\PrivilegeRuleProvider;

return array(
    'bjyauthorize' => [
        'rule_providers' => [
            PrivilegeRuleProvider::class => [
            ],
        ],
    ],

    'router' => [
        'routes' => [
        ],
    ],

    'service_manager' => [
        'factories' => [
            EvenementService::class => EvenementServiceFactory::class,
        ],
    ],
    'controllers' => [
        'factories' => [
        ],
    ],
    'form_elements' => [
        'factories' => [
        ],
    ],
    'hydrators' => [
        'invokables' => [
        ],
    ],
);
+15 −25
Changes for module/Soutenance/src/Soutenance/Controller/EngagementImpartialiteController.php: 15 added lines, 25 removed lines.
Original line number Diff line number Diff line
@@ -4,19 +4,18 @@ namespace Soutenance\Controller;

use Application\Controller\AbstractController;
use Application\Entity\Db\Validation;
use Laminas\View\Model\ViewModel;
use Notification\Exception\RuntimeException;
use Soutenance\Provider\Template\TexteTemplates;
use Soutenance\Service\Notification\SoutenanceNotificationFactoryAwareTrait;
use These\Service\Acteur\ActeurServiceAwareTrait;
use Soutenance\Entity\Evenement;
use Notification\Service\NotifierServiceAwareTrait;
use Soutenance\Entity\Membre;
use Soutenance\Provider\Template\TexteTemplates;
use Soutenance\Service\EngagementImpartialite\EngagementImpartialiteServiceAwareTrait;
use Soutenance\Service\Evenement\EvenementServiceAwareTrait;
use Soutenance\Service\Horodatage\HorodatageService;
use Soutenance\Service\Horodatage\HorodatageServiceAwareTrait;
use Soutenance\Service\Membre\MembreServiceAwareTrait;
use Notification\Service\NotifierServiceAwareTrait;
use Soutenance\Service\Notification\SoutenanceNotificationFactoryAwareTrait;
use Soutenance\Service\Proposition\PropositionServiceAwareTrait;
use UnicaenAuthToken\Service\TokenServiceAwareTrait;
use Laminas\View\Model\ViewModel;
use These\Service\Acteur\ActeurServiceAwareTrait;
use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait;

/**
@@ -27,14 +26,13 @@ use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait;
class EngagementImpartialiteController extends AbstractController
{
    use ActeurServiceAwareTrait;
    use EvenementServiceAwareTrait;
    use EngagementImpartialiteServiceAwareTrait;
    use HorodatageServiceAwareTrait;
    use MembreServiceAwareTrait;
    use NotifierServiceAwareTrait;
    use SoutenanceNotificationFactoryAwareTrait;
    use PropositionServiceAwareTrait;
    use RenduServiceAwareTrait;
    use TokenServiceAwareTrait;

    public function engagementImpartialiteAction() : ViewModel
    {
@@ -73,20 +71,16 @@ class EngagementImpartialiteController extends AbstractController
            if ($membre->getActeur() and $membre->estRapporteur()) {
                $validation = $this->getEngagementImpartialiteService()->getEngagementImpartialiteByMembre($these, $membre);
                if (!$validation) {
                    $token = $this->getMembreService()->retrieveOrCreateToken($membre);
                    $url_rapporteur = $this->url()->fromRoute("soutenance/index-rapporteur", ['these' => $these->getId()], ['force_canonical' => true], true);
                    $url = $this->url()->fromRoute('zfcuser/login', ['type' => 'token'], ['query' => ['token' => $token->getToken(), 'redirect' => $url_rapporteur, 'role' => $membre->getActeur()->getRole()->getRoleId()], 'force_canonical' => true], true);
                    try {
                        $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $membre);
                        $this->notifierService->trigger($notif);
                    } catch (RuntimeException $e) {
                        // aucun destintaire, todo : cas à gérer !
                        throw new RuntimeException("Aucun mail trouvé pour le rapporteur [".$membre->getDenomination()."]");
                    }
                }
            }
        }

        $this->getEvenementService()->ajouterEvenement($proposition, Evenement::EVENEMENT_ENGAGEMENT);
        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_NOTIFICATION, "Demande de signature de l'engagement d'impartialité");
        $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

@@ -97,24 +91,21 @@ class EngagementImpartialiteController extends AbstractController
        $membre = $this->getMembreService()->getRequestedMembre($this);

        if ($membre->getActeur()) {
            $token = $this->getMembreService()->retrieveOrCreateToken($membre);
            $url_rapporteur = $this->url()->fromRoute("soutenance/index-rapporteur", ['these' => $these->getId()], ['force_canonical' => true], true);
            $url = $this->url()->fromRoute('zfcuser/login', ['type' => 'token'], ['query' => ['token' => $token->getToken(), 'redirect' => $url_rapporteur, 'role' => $membre->getActeur()->getRole()->getRoleId()], 'force_canonical' => true], true);
            try {
                $notif = $this->soutenanceNotificationFactory->createNotificationDemandeSignatureEngagementImpartialite($these, $membre);
                $this->notifierService->trigger($notif);
            } catch (RuntimeException $e) {
                // aucun destintaire, todo : cas à gérer !
                throw new RuntimeException("Aucun mail trouvé pour le rapporteur [".$membre->getDenomination()."]");
            }
        }

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_NOTIFICATION, "Demande de signature de l'engagement d'impartialité");
        $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

    public function signerEngagementImpartialiteAction()
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
        $membre = $this->getMembreService()->getRequestedMembre($this);

        $signature = $this->getEngagementImpartialiteService()->getEngagementImpartialiteByMembre($these, $membre);
@@ -124,7 +115,7 @@ class EngagementImpartialiteController extends AbstractController
                $notif = $this->soutenanceNotificationFactory->createNotificationSignatureEngagementImpartialite($these, $membre);
                $this->notifierService->trigger($notif);
            } catch (RuntimeException $e) {
                // aucun destintaire, todo : cas à gérer !
                throw new RuntimeException("Aucun mail trouvé pour le rapporteur [".$membre->getDenomination()."]");
            }
        }

@@ -143,7 +134,7 @@ class EngagementImpartialiteController extends AbstractController
            $notif = $this->soutenanceNotificationFactory->createNotificationRefusEngagementImpartialite($these, $membre);
            $this->notifierService->trigger($notif);
        } catch (RuntimeException $e) {
            // aucun destintaire, todo : cas à gérer !
            throw new RuntimeException("Aucun mail trouvé");
        }


@@ -153,7 +144,6 @@ class EngagementImpartialiteController extends AbstractController
    public function annulerEngagementImpartialiteAction()
    {
        $these = $this->requestedThese();
        $proposition = $this->getPropositionService()->findOneForThese($these);
        $membre = $this->getMembreService()->getRequestedMembre($this);

        /** @var Validation[] $validations */
@@ -162,7 +152,7 @@ class EngagementImpartialiteController extends AbstractController
            $notif = $this->soutenanceNotificationFactory->createNotificationAnnulationEngagementImpartialite($these, $membre);
            $this->notifierService->trigger($notif);
        } catch (RuntimeException $e) {
            // aucun destintaire, todo : cas à gérer !
            throw new RuntimeException("Aucun mail trouvé pour le rapporteur [".$membre->getDenomination()."]");
        }

        $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
+11 −16
Changes for module/Soutenance/src/Soutenance/Controller/EngagementImpartialiteControllerFactory.php: 11 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -2,18 +2,16 @@

namespace Soutenance\Controller;

use Interop\Container\ContainerInterface;
use Notification\Service\NotifierService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Soutenance\Service\Notification\SoutenanceNotificationFactory;
use These\Service\Acteur\ActeurService;
use Interop\Container\ContainerInterface;
use Soutenance\Service\EngagementImpartialite\EngagementImpartialiteService;
use Soutenance\Service\Evenement\EvenementService;
use Soutenance\Service\Horodatage\HorodatageService;
use Soutenance\Service\Membre\MembreService;
use Notification\Service\NotifierService;
use Soutenance\Service\Notification\SoutenanceNotificationFactory;
use Soutenance\Service\Proposition\PropositionService;
use UnicaenAuthToken\Service\TokenService;
use UnicaenAuthToken\Service\TokenServiceAwareTrait;
use These\Service\Acteur\ActeurService;
use UnicaenRenderer\Service\Rendu\RenduService;

class EngagementImpartialiteControllerFactory
@@ -28,34 +26,31 @@ class EngagementImpartialiteControllerFactory
    {
        /**
         * @var ActeurService $acteurService
         * @var EvenementService $evenementService
         * @var PropositionService $propositionService
         * @var EngagementImpartialiteService $engagementImpartialiteService
         * @var HorodatageService $horodatageService
         * @var MembreService $membreService
         * @var NotifierService $notifierService
         * @var EngagementImpartialiteService $engagementImpartialiteService
         * @var PropositionService $propositionService
         * @var RenduService $renduService
         * @var TokenService $tokenService
         */
        $acteurService                  = $container->get(ActeurService::class);
        $evenementService               = $container->get(EvenementService::class);
        $horodatageService              = $container->get(HorodatageService::class);
        $propositionService             = $container->get(PropositionService::class);
        $membreService                  = $container->get(MembreService::class);
        $notifierService                = $container->get(NotifierService::class);
        $engagementImpartialiteService  = $container->get(EngagementImpartialiteService::class);
        $renduService                   = $container->get(RenduService::class);
        $tokenService                   = $container->get(TokenService::class);

        $controller = new EngagementImpartialiteController();
        $controller->setActeurService($acteurService);
        $controller->setEvenementService($evenementService);
        $controller->setHorodatageService($horodatageService);
        $controller->setPropositionService($propositionService);
        $controller->setMembreService($membreService);
        $controller->setNotifierService($notifierService);
        $controller->setEngagementImpartialiteService($engagementImpartialiteService);
        $controller->setRenduService($renduService);
        $controller->setTokenService($tokenService);

        /** @var \Soutenance\Service\Notification\SoutenanceNotificationFactory $soutenanceNotificationFactory */
        /** @var SoutenanceNotificationFactory $soutenanceNotificationFactory */
        $soutenanceNotificationFactory = $container->get(SoutenanceNotificationFactory::class);
        $controller->setSoutenanceNotificationFactory($soutenanceNotificationFactory);

+58 −50
Changes for module/Soutenance/src/Soutenance/Controller/PresoutenanceController.php: 58 added lines, 50 removed lines.
Original line number Diff line number Diff line
@@ -21,16 +21,15 @@ use Laminas\Http\Response;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\ViewModel;
use Laminas\View\Renderer\PhpRenderer;
use Notification\Service\NotifierServiceAwareTrait;
use Soutenance\Entity\Avis;
use Soutenance\Entity\Etat;
use Soutenance\Entity\Evenement;
use Soutenance\Entity\Membre;
use Soutenance\Form\AdresseSoutenance\AdresseSoutenanceFormAwareTrait;
use Soutenance\Form\DateRenduRapport\DateRenduRapportFormAwareTrait;
use Soutenance\Provider\Parametre\SoutenanceParametres;
use Soutenance\Service\Avis\AvisServiceAwareTrait;
use Soutenance\Service\EngagementImpartialite\EngagementImpartialiteServiceAwareTrait;
use Soutenance\Service\Evenement\EvenementServiceAwareTrait;
use Soutenance\Service\Exporter\AvisSoutenance\AvisSoutenancePdfExporter;
use Soutenance\Service\Exporter\Convocation\ConvocationPdfExporter;
use Soutenance\Service\Exporter\ProcesVerbal\ProcesVerbalSoutenancePdfExporter;
@@ -41,7 +40,6 @@ use Soutenance\Service\Horodatage\HorodatageServiceAwareTrait;
use Soutenance\Service\Justificatif\JustificatifServiceAwareTrait;
use Soutenance\Service\Membre\MembreServiceAwareTrait;
use Soutenance\Service\Notification\SoutenanceNotificationFactoryAwareTrait;
use Notification\Service\NotifierServiceAwareTrait;
use Soutenance\Service\Proposition\PropositionServiceAwareTrait;
use Soutenance\Service\Validation\ValidatationServiceAwareTrait;
use Structure\Entity\Db\Etablissement;
@@ -59,7 +57,6 @@ use UnicaenParametre\Service\Parametre\ParametreServiceAwareTrait;

class PresoutenanceController extends AbstractController
{
    use EvenementServiceAwareTrait;
    use HorodatageServiceAwareTrait;
    use TheseServiceAwareTrait;
    use MembreServiceAwareTrait;
@@ -134,9 +131,6 @@ class PresoutenanceController extends AbstractController
            'justificatifsOk' => $justificatifsOk,
            'justificatifs' => $justificatifs,

            'evenementsEngagement' => $this->getEvenementService()->getEvenementsByPropositionAndType($proposition, Evenement::EVENEMENT_ENGAGEMENT),
            'evenementsPrerapport' => $this->getEvenementService()->getEvenementsByPropositionAndType($proposition, Evenement::EVENEMENT_PRERAPPORT),

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

            'autorisation' => $autorisation,
@@ -338,7 +332,7 @@ class PresoutenanceController extends AbstractController
            }
        }

        $this->getEvenementService()->ajouterEvenement($proposition, Evenement::EVENEMENT_PRERAPPORT);
        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_NOTIFICATION, "Demande de rapport de pré-soutenance");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

@@ -373,6 +367,7 @@ class PresoutenanceController extends AbstractController
            //->setNamespace('presoutenance')
            ->addSuccessMessage("Notifications d'accord de soutenance envoyées");

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_ETAT, "Feu vert pour la soutenance");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

@@ -395,6 +390,7 @@ class PresoutenanceController extends AbstractController
            //->setNamespace('presoutenance')
            ->addSuccessMessage("Notifications d'arrêt des démarches de soutenance soutenance envoyées");

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_ETAT, "Annulation de la soutenance");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

@@ -413,6 +409,7 @@ class PresoutenanceController extends AbstractController
            $form->setData($data);
            if ($form->isValid()) {
                $this->getPropositionService()->update($proposition);
                $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_MODIFICATION, "Adresse du lieu de soutenance");
            }
        }

@@ -431,7 +428,6 @@ class PresoutenanceController extends AbstractController
        $proposition = $this->getPropositionService()->findOneForThese($these);

        $pdcData = $this->getTheseService()->fetchInformationsPageDeCouverture($these);

        $exporter = new ProcesVerbalSoutenancePdfExporter($this->renderer, 'A4');
        $exporter->setVars([
            'proposition' => $proposition,
@@ -439,6 +435,8 @@ class PresoutenanceController extends AbstractController
            'informations' => $pdcData,
        ]);
        $exporter->export($these->getId() . '_proces_verbal.pdf');

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_EDITION, "Procès verbal");
        exit;
    }

@@ -448,7 +446,6 @@ class PresoutenanceController extends AbstractController
        $proposition = $this->getPropositionService()->findOneForThese($these);

        $pdcData = $this->getTheseService()->fetchInformationsPageDeCouverture($these);

        $exporter = new AvisSoutenancePdfExporter($this->renderer, 'A4');
        $exporter->setVars([
            'proposition' => $proposition,
@@ -456,6 +453,8 @@ class PresoutenanceController extends AbstractController
            'informations' => $pdcData,
        ]);
        $exporter->export($these->getId() . '_avis_soutenance.pdf');

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_EDITION, "Avis de soutenance");
        exit;
    }

@@ -465,7 +464,6 @@ class PresoutenanceController extends AbstractController
        $proposition = $this->getPropositionService()->findOneForThese($these);

        $pdcData = $this->getTheseService()->fetchInformationsPageDeCouverture($these);

        $exporter = new RapportSoutenancePdfExporter($this->renderer, 'A4');
        $exporter->setVars([
            'proposition' => $proposition,
@@ -473,20 +471,25 @@ class PresoutenanceController extends AbstractController
            'informations' => $pdcData,
        ]);
        $exporter->export($these->getId() . '_rapport_soutenance.pdf');

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_EDITION, "Rapport de soutenance");
        exit;
    }

    public function rapportTechniqueAction()
    {
        $these = $this->requestedThese();
        $pdcData = $this->getTheseService()->fetchInformationsPageDeCouverture($these);
        $proposition = $this->getPropositionService()->findOneForThese($these);

        $pdcData = $this->getTheseService()->fetchInformationsPageDeCouverture($these);
        $exporter = new RapportTechniquePdfExporter($this->renderer, 'A4');
        $exporter->setVars([
            'these' => $these,
            'informations' => $pdcData,
        ]);
        $exporter->export($these->getId() . '_rapport_technique.pdf');

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_EDITION, "Rapport technique");
        exit;
    }

@@ -514,6 +517,44 @@ class PresoutenanceController extends AbstractController
        return $ville;
    }

    private function findSignatureEtablissement(These $these): ?string
    {
        $fichier = $this->structureDocumentService->findDocumentFichierForStructureNatureAndEtablissement(
            $these->getEtablissement()->getStructure(),
            NatureFichier::CODE_SIGNATURE_CONVOCATION,
            $these->getEtablissement());

        if ($fichier === null) {
            return null;
        }

        try {
            $this->fichierStorageService->setGenererFichierSubstitutionSiIntrouvable(false);
            return $this->fichierStorageService->getFileForFichier($fichier);
        } catch (StorageAdapterException $e) {
            throw new RuntimeException("Un problème est survenu lors de la récupération de la signature de l'établissement !", 0, $e);
        }
    }

    private function findSignatureEcoleDoctorale(These $these): ?string
    {
        $fichier = $this->structureDocumentService->findDocumentFichierForStructureNatureAndEtablissement(
            $these->getEcoleDoctorale()->getStructure(),
            NatureFichier::CODE_SIGNATURE_CONVOCATION,
            $these->getEtablissement());

        if ($fichier === null) {
            return null;
        }

        try {
            $this->fichierStorageService->setGenererFichierSubstitutionSiIntrouvable(false);
            return $this->fichierStorageService->getFileForFichier($fichier);
        } catch (StorageAdapterException $e) {
            throw new RuntimeException("Un problème est survenu lors de la récupération de la signature de l'ED !", 0, $e);
        }
    }

    /** Document pour la signature en présidence */
    public function convocationsAction()
    {
@@ -538,6 +579,8 @@ class PresoutenanceController extends AbstractController
            'signature' => $signature,
        ]);
        $exporter->export($these->getId() . '_convocation.pdf');

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_EDITION, "Convocations");
        exit;
    }

@@ -567,44 +610,6 @@ class PresoutenanceController extends AbstractController
        exit;
    }

    private function findSignatureEtablissement(These $these): ?string
    {
        $fichier = $this->structureDocumentService->findDocumentFichierForStructureNatureAndEtablissement(
            $these->getEtablissement()->getStructure(),
            NatureFichier::CODE_SIGNATURE_CONVOCATION,
            $these->getEtablissement());

        if ($fichier === null) {
            return null;
        }

        try {
            $this->fichierStorageService->setGenererFichierSubstitutionSiIntrouvable(false);
            return $this->fichierStorageService->getFileForFichier($fichier);
        } catch (StorageAdapterException $e) {
            throw new RuntimeException("Un problème est survenu lors de la récupération de la signature de l'établissement !", 0, $e);
        }
    }

    private function findSignatureEcoleDoctorale(These $these): ?string
    {
        $fichier = $this->structureDocumentService->findDocumentFichierForStructureNatureAndEtablissement(
            $these->getEcoleDoctorale()->getStructure(),
            NatureFichier::CODE_SIGNATURE_CONVOCATION,
            $these->getEtablissement());

        if ($fichier === null) {
            return null;
        }

        try {
            $this->fichierStorageService->setGenererFichierSubstitutionSiIntrouvable(false);
            return $this->fichierStorageService->getFileForFichier($fichier);
        } catch (StorageAdapterException $e) {
            throw new RuntimeException("Un problème est survenu lors de la récupération de la signature de l'ED !", 0, $e);
        }
    }

    public function convocationMembreAction()
    {
        $these = $this->requestedThese();
@@ -685,6 +690,8 @@ class PresoutenanceController extends AbstractController
                }
            }
        }

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_NOTIFICATION, "Convocations");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

@@ -718,6 +725,7 @@ class PresoutenanceController extends AbstractController
            // aucun destinataire, todo : cas à gérer !
        }

        $this->getHorodatageService()->addHorodatage($proposition, HorodatageService::TYPE_NOTIFICATION, "Transmission des documents");
        return $this->redirect()->toRoute('soutenance/presoutenance', ['these' => $these->getId()], [], true);
    }

Loading