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

Merge branch 'develop'

parents e7fe6997 fde478ef
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ class NatureFichier
    const CODE_PROLONG_CONFIDENT = 'PROLONG_CONFIDENT';
    const CODE_CONV_MISE_EN_LIGNE = 'CONV_MISE_EN_LIGNE';
    const CODE_AVENANT_CONV_MISE_EN_LIGNE = 'AVENANT_CONV_MISE_EN_LIGNE';
    const CODE_INFORMATION = 'INFORMATION';

    /**
     * @var string
+17 −0
Original line number Diff line number Diff line
@@ -124,4 +124,21 @@ class FichierRepository extends DefaultEntityRepository
        $fichiers = $this->fetchFichiers($these, NatureFichier::CODE_THESE_PDF , $version);
        return !empty($fichiers);
    }

    /**
     * @param NatureFichier|string $nature
     * @return Fichier[]
     */
    public function fetchFichiersByNature($nature)
    {
        $qb = $this->createQueryBuilder("fichier")
            ->andWhere('fichier.nature = :nature')
            ->andWhere('fichier.histoDestruction IS NULL')
            ->setParameter("nature", $nature)
            ->orderBy('fichier.histoCreation')
        ;

        $result = $qb->getQuery()->getResult();
        return $result;
    }
}
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
@@ -698,4 +698,18 @@ class FichierService extends BaseService
        }
    }

    /**
     * @param Fichier $fichier
     * @return Fichier
     */
    public function update($fichier)
    {
        try {
            $this->getEntityManager()->flush($fichier);
        } catch (OptimisticLockException $e) {
            throw new RuntimeException("Problème lors de la mise à jour du Fichier", $e);
        }
        return $fichier;
    }

}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -184,4 +184,9 @@ class FileService

        return $content;
    }

    public function computeDirectoryPathForInformation() {
        $path = $this->rootDirectoryPathForUploadedFiles . '/' . 'information';
        return $path;
    }
}
 No newline at end of file
+55 −0
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\Repository\DefaultEntityRepository;
use Information\Controller\FichierController;
use Information\Controller\InformationController;
use Information\Controller\InformationControllerFactory;
use Information\Form\FichierForm;
use Information\Form\InformationForm;
use Information\Form\InformationFormFactory;
use Information\Form\InformationHydrator;
use Information\Provider\Privilege\InformationPrivileges;
use Information\Service\InformationFichierService;
use Information\Service\InformationFichierServiceFactory;
use Information\Service\InformationService;
use Information\Service\InformationServiceFactory;
use Zend\Mvc\Router\Http\Literal;
@@ -102,6 +106,17 @@ return [
                    ],
                    'roles' => [],
                ],
                [
                    'controller' => FichierController::class,
                    'action'     => [
                        'index',
                        'supprimer',
                        'telecharger',
                    ],
                    'privileges' => [
                        InformationPrivileges::INFORMATION_MODIFIER,
                    ]
                ],
            ],
        ],
    ],
@@ -118,6 +133,41 @@ return [
                ],
                'may_terminate' => true,
                'child_routes'  => [
                    'fichiers' => [
                        'type'          => Literal::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/fichiers',
                            'defaults'    => [
                                'controller'    => FichierController::class,
                                'action' => 'index',
                            ],
                        ],
                        'child_routes'  => [
                            'supprimer' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/supprimer/:id',
                                    'defaults'    => [
                                        'controller'    => FichierController::class,
                                        'action' => 'supprimer',
                                    ],
                                ],
                            ],
                            'telecharger' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/telecharger/:id',
                                    'defaults'    => [
                                        'controller'    => FichierController::class,
                                        'action' => 'telecharger',
                                    ],
                                ],
                            ],
                        ],
                    ],
                    'afficher' => [
                        'type'          => Segment::class,
                        'options'       => [
@@ -192,15 +242,20 @@ return [
        ],
        'factories' => [
            InformationService::class => InformationServiceFactory::class,
            InformationFichierService::class => InformationFichierServiceFactory::class,
        ],
    ],

    'controllers' => [
        'factories' => [
            InformationController::class => InformationControllerFactory::class,
            FichierController::class => \Information\Controller\FichierControllerFactory::class,
        ],
    ],
    'form_elements'   => [
        'invokables' => [
            FichierForm::class => FichierForm::class,
        ],
        'factories' => [
            InformationForm::class => InformationFormFactory::class,
        ],
Loading