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

Génération de la page de couverture : ajout d'un bouton pour forcer l'import...

Génération de la page de couverture : ajout d'un bouton pour forcer l'import d'une thèse lorsqu'il manque des infos nécessaires à la PDC (Tâche #16284).
parent 571afe1a
Loading
Loading
Loading
Loading
+30
Changes for data/SQL/privilege.sql: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -24,6 +24,36 @@ insert into ROLE_PRIVILEGE(ROLE_ID, PRIVILEGE_ID)
;


--
-- Ajout de ROLE_PRIVILEGE_MODELE.
--

INSERT INTO ROLE_PRIVILEGE_MODELE (ROLE_CODE, PRIVILEGE_ID)
  with data(role, priv) as (
    select 'ADMIN',       'refresh-these' from dual union
    select 'ADMIN_TECH',  'refresh-these' from dual union
    select 'BU',          'refresh-these' from dual union
    select 'BDD',         'refresh-these' from dual
  )
    select role, p.id
    from data
    join PRIVILEGE p on p.code = data.priv
;

--
-- Application des modèles (ceux pas déjà appliqués).
--

insert into ROLE_PRIVILEGE (ROLE_ID, PRIVILEGE_ID)
  SELECT r.id, p.ID
  from ROLE_PRIVILEGE_MODELE rpm
    join role r on r.CODE = rpm.ROLE_CODE
    join PRIVILEGE p on p.id = rpm.PRIVILEGE_ID
  where not exists (
      select * from ROLE_PRIVILEGE rp where rp.ROLE_ID = r.id and rp.PRIVILEGE_ID = p.id
  );


--
-- Mise en conformité brutale entre 2 bdd des CATEGORIE_PRIVILEGE, PRIVILEGE, ROLE_PRIVILEGE.
--
+20
Changes for module/Application/config/others/these.config.php: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ return [
                            ThesePrivileges::THESE_SAISIE_CONFORMITE_VERSION_ARCHIVAGE_INITIALE,
                            ThesePrivileges::THESE_SAISIE_CONFORMITE_VERSION_ARCHIVAGE_CORRIGEE,
                            ThesePrivileges::THESE_SAISIE_RDV_BU,
//                            ThesePrivileges::THESE_REFRESH,
                        ],
                        'resources'  => ['These'],
                        'assertion'  => 'Assertion\\These',
@@ -95,6 +96,13 @@ return [
                    'privileges' => ThesePrivileges::THESE_CONSULTATION_FICHE,
                    'assertion'  => 'Assertion\\These',
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
                        'refresh-these',
                    ],
                    'privileges' => ThesePrivileges::THESE_REFRESH,
                ],
                [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
@@ -347,6 +355,18 @@ return [
                            ],
                        ],
                    ],
                    'refresh-these' => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/refresh/:these',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'refresh-these',
                            ],
                        ],
                    ],
                    'version-papier' => [
                        'type'          => 'Segment',
                        'options'       => [
+4
Changes for module/Application/src/Application/Controller/Factory/TheseControllerFactory.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ use Application\Service\Variable\VariableService;
use Application\Service\VersionFichier\VersionFichierService;
use Application\Service\Workflow\WorkflowService;
use Doctrine\ORM\EntityManager;
use Import\Service\ImportService;
use Zend\Mvc\Controller\ControllerManager;
use Zend\ServiceManager\ServiceLocatorInterface;

@@ -45,6 +46,7 @@ class TheseControllerFactory
         * @var UniteRechercheService $uniteService
         * @var MailConfirmationService $mailConfirmationService
         * @var EntityManager $entityManager
         * @var ImportService $importService
         */
        $variableService = $controllerManager->getServiceLocator()->get('VariableService');
        $validationService = $controllerManager->getServiceLocator()->get('ValidationService');
@@ -59,6 +61,7 @@ class TheseControllerFactory
        $mailConfirmationService = $controllerManager->getServiceLocator()->get('MailConfirmationService');
        $entityManager = $controllerManager->getServiceLocator()->get('doctrine.entitymanager.orm_default');
        $notifierService = $controllerManager->getServiceLocator()->get(NotifierService::class);
        $importService = $controllerManager->getServiceLocator()->get('ImportService');

        $controller = new TheseController();
        $controller->setTimeoutRetraitement($this->getTimeoutRetraitementFromOptions($options));
@@ -75,6 +78,7 @@ class TheseControllerFactory
        $controller->setMailConfirmationService($mailConfirmationService);
        $controller->setEntityManager($entityManager);
        $controller->setNotifierService($notifierService);
        $controller->setImportService($importService);

        return $controller;
    }
+2
Changes for module/Application/src/Application/Controller/Plugin/Url/UrlThesePlugin.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ use Zend\Mvc\Controller\Plugin\AbstractPlugin;
/**
 * Aide de vue de génération d'URL.
 *
 * @method string refreshTheseUrl(These $these, $redirect = null)
 * @method validationPageDeCouvertureUrl(These $these)
 * @method depotFichiers(These $these, $nature, $version = null, $retraite = false, array $queryParams = [])
 * @method identiteThese(These $these)
 * @method depotThese(These $these, $version = null)
+22
Changes for module/Application/src/Application/Controller/TheseController.php: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ use Application\Service\VersionFichier\VersionFichierServiceAwareTrait;
use Application\Service\Workflow\WorkflowServiceAwareTrait;
use Doctrine\ORM\Tools\Pagination\Paginator;
use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator;
use Import\Service\Traits\ImportServiceAwareTrait;
use mPDF;
use Retraitement\Exception\TimedOutCommandException;
use UnicaenApp\Exception\RuntimeException;
@@ -72,6 +73,7 @@ class TheseController extends AbstractController
    use EntityManagerAwareTrait;
    use MailConfirmationServiceAwareTrait;
    use UniteRechercheServiceAwareTrait;
    use ImportServiceAwareTrait;

    private $timeoutRetraitement;

@@ -254,6 +256,25 @@ class TheseController extends AbstractController
        return $view;
    }

    /**
     * Import forcé d'une thèse et des inf.
     *
     * @return Response
     */
    public function refreshTheseAction()
    {
        $these = $this->requestedThese();

        $this->importService->updateThese($these);

        $redirect = $this->params()->fromQuery('redirect', '/');

        return $this->redirect()->toUrl($redirect);
    }

    /**
     * @return ViewModel
     */
    public function validationPageDeCouvertureAction()
    {
        $these = $this->requestedThese();
@@ -269,6 +290,7 @@ class TheseController extends AbstractController
            'these'            => $these,
            'validation'       => $validation ?: null,
            'apercevoirPdcUrl' => $this->urlFichierThese()->apercevoirPageDeCouverture($these),
            'refreshTheseUrl'  => $this->urlThese()->refreshTheseUrl($these, $this->urlThese()->validationPageDeCouvertureUrl($these)),
            'validerUrl'       => $this->urlThese()->validerPageDeCouvertureUrl($these),
            'devaliderUrl'     => $this->urlThese()->devaliderPageDeCouvertureUrl($these),
            'nextStepUrl'      => $this->urlWorkflow()->nextStepBox($these, null, [WfEtape::CODE_VALIDATION_PAGE_DE_COUVERTURE]),
Loading