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

Plantage à la récupération de la thèse pour le RDV-BU (BUG FIXED)

parent 5e6d97e6
Loading
Loading
Loading
Loading
+1 −1
Changes for config/application.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ $modules = [

if ('development' === (getenv('APPLICATION_ENV') ?: 'production')) {
    $modules = array_merge($modules, [
        'ZendDeveloperTools',
//        'ZendDeveloperTools',
        'UnicaenCode',
        'UnicaenTest',
    ]);
+24 −30
Changes for module/Application/src/Application/Controller/TheseController.php: 24 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ use Application\Service\VersionFichier\VersionFichierServiceAwareTrait;
use Application\Service\Workflow\WorkflowServiceAwareInterface;
use Application\Service\Workflow\WorkflowServiceAwareTrait;
use Application\View\Helper\Sortable;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\Paginator;
use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator;
use Retraitement\Exception\TimedOutCommandException;
@@ -77,61 +76,39 @@ class TheseController extends AbstractController implements

    private $timeoutRetraitement;

    /**
     * Spécifie le timout à appliquer au lancement du script de retraitement.
     *
     * @param string $timeoutRetraitement Ex: '30s', '1m', cf. "man timout".
     * @return self
     */
    public function setTimeoutRetraitement($timeoutRetraitement)
    {
        $this->timeoutRetraitement = $timeoutRetraitement;

        return $this;
    }

    /**
     * @return ViewModel|Response
     */
    public function indexAction()
    {
        /**
         * L'utilisateur est un doctorant, redirection vers l'accueil.
         */
        /** L'utilisateur est un doctorant, redirection vers l'accueil. **/
        if ($this->userContextService->getSelectedRoleDoctorant()) {
            return $this->redirect()->toRoute('home');
        }

        /**
         * Application des filtres et tris par défaut.
         */
        /** Application des filtres et tris par défaut.
         * Si aucun état de thèse n'est spécifié alors état = These::ETAT_EN_COURS
         **/
        $needsRedirect  = false;
        $queryParams    = $this->params()->fromQuery();
        // filtres
        $etatThese      = $this->params()->fromQuery($name = 'etatThese');
//        var_dump($etatThese);
        if ($etatThese === null) { // null <=> paramètre absent
            // filtrage par défaut : thèse en préparation
            $queryParams = array_merge($queryParams, [$name => These::ETAT_EN_COURS]);
            $needsRedirect = true;
        }
        // tris
        $sort = $this->params()->fromQuery('sort');
        if ($sort === null) { // null <=> paramètre absent
            // tri par défaut : datePremiereInscription
            $queryParams = array_merge($queryParams, ['sort' => 't.datePremiereInscription', 'direction' => Sortable::ASC]);
            $needsRedirect = true;
        }
        // redirection si nécessaire
        if ($needsRedirect) {
            return $this->redirect()->toRoute(null, [], ['query' => $queryParams], true);
        }

        /** Configuration du paginator **/
        $qb = $this->createQueryBuilder();
        $maxi = $this->params()->fromQuery('maxi', 50);
        $page = $this->params()->fromQuery('page', 1);

        $qb = $this->createQueryBuilder();

        $paginator = new \Zend\Paginator\Paginator(new DoctrinePaginator(new Paginator($qb, true)));
        $paginator
            ->setPageRange(30)
@@ -174,13 +151,14 @@ class TheseController extends AbstractController implements
        $dir  = $this->params()->fromQuery('direction', Sortable::ASC);

        $qb = $this->theseService->getRepository()->createQueryBuilder('t')
            ->addSelect('di')->leftJoin('th.individu', 'di')
            ->addSelect('ed')->leftJoin('t.ecoleDoctorale', 'ed')
            ->addSelect('ur')->leftJoin('t.uniteRecherche', 'ur')
            ->addSelect('a')->leftJoin('t.acteurs', 'a')
            ->addSelect('i')->leftJoin('a.individu', 'i')
            ->addSelect('di')->leftJoin('th.individu', 'di')
            ->addSelect('r')->leftJoin('a.role', 'r')
            ->andWhere('1 = pasHistorise(t)');

        if ($etatThese) {
            $qb->andWhere('t.etatThese = :etat')->setParameter('etat', $etatThese);
        }
@@ -418,6 +396,8 @@ class TheseController extends AbstractController implements
        $estDoctorant = (bool) $this->userContextService->getSelectedRoleDoctorant();
        $these = $this->requestedThese();

        $versionArchivable = $this->fichierService->getRepository()->getVersionArchivable($these);

        $view = new ViewModel([
            'these'        => $these,
            'estDoctorant' => $estDoctorant,
@@ -430,6 +410,7 @@ class TheseController extends AbstractController implements
                WfEtape::CODE_RDV_BU_SAISIE_DOCTORANT,
                WfEtape::CODE_RDV_BU_VALIDATION_BU,
            ]),
            'versionArchivable' => $versionArchivable,
        ]);

        $view->setTemplate('application/these/rdv-bu' . ($estDoctorant ? '-doctorant' : null));
@@ -1366,4 +1347,17 @@ class TheseController extends AbstractController implements
        $exporter->export('export.pdf');
        exit;
    }

    /**
     * Spécifie le timout à appliquer au lancement du script de retraitement.
     *
     * @param string $timeoutRetraitement Ex: '30s', '1m', cf. "man timout".
     * @return self
     */
    public function setTimeoutRetraitement($timeoutRetraitement)
    {
        $this->timeoutRetraitement = $timeoutRetraitement;

        return $this;
    }
}
 No newline at end of file
+3 −1
Changes for module/Application/view/application/these/partial/rdv-bu.phtml: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -3,11 +3,13 @@
 * Affichage des renseignements concernant le RDV BU.
 *
 * @var These $these
 * @var Fichier $versionArchivable
 */

use Application\Entity\Db\MetadonneeThese;
use Application\Entity\Db\RdvBu;
use Application\Entity\Db\These;
use Application\Entity\Db\Fichier;
use Application\Filter\MotsClesFormatter;

$rdvBu = $these->getRdvBu();
@@ -22,7 +24,7 @@ $uncheck_icon = '<span class="glyphicon glyphicon-unchecked"></span>';
$checked        = $check_icon.' Oui';
$unchecked      = $uncheck_icon.' Non';

$fichier = $rdvBu->getThese()->getVersionArchivable();
$fichier = $versionArchivable;
$versionArchivableFournie = $rdvBu->isVersionArchivableFournie();
if ($fichier && $versionArchivableFournie) {
    $ddVersionArchivage = sprintf('%s (%s)', $checked, (bool)$fichier->getRetraitement() ? 'version retraitée et validée' : 'version originale');
+2
Changes for module/Application/view/application/these/rdv-bu.phtml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Provider\Privilege\ThesePrivileges;
use Application\Provider\Privilege\ValidationPrivileges;
use Application\View\Renderer\PhpRenderer;
use UnicaenApp\Service\MessageCollector;
use Application\Entity\Db\Repository\FichierRepository;

/**
 * @var PhpRenderer         $this
@@ -18,6 +19,7 @@ use UnicaenApp\Service\MessageCollector;
 * @var Validation|null     $validation
 * @var MessageCollector    $msgCollector
 * @var string              $nextStepUrl
 * @var FichierRepository   $fichierRepository
 */

$canEdit = $this->isAllowed($these, ThesePrivileges::THESE_SAISIE_RDV_BU);