Commit 2784dd4e authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Réparation des pièces justificatives

parent e992bdc3
Loading
Loading
Loading
Loading
+26 −3
Changes for module/Application/src/Controller/PieceJointeController.php: 26 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use Application\Entity\Db\Fichier;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\PieceJointe;
use Application\Entity\Db\TblPieceJointe;
use Application\Entity\Db\TblPieceJointeDemande;
use Application\Entity\Db\TypePieceJointe;
use Application\Entity\Db\TypePieceJointeStatut;
use Application\Entity\Db\Validation;
@@ -57,6 +58,7 @@ class PieceJointeController extends AbstractController
    }



    /**
     *
     * @return ViewModel
@@ -98,6 +100,7 @@ class PieceJointeController extends AbstractController
    }



    /**
     *
     * @return ViewModel
@@ -118,10 +121,14 @@ class PieceJointeController extends AbstractController
    }



    /**
     * @param TblPieceJointe[] $synthesePiecesJointes
     * @param TblPieceJointeDemande[] $demandees
     * @param TblPieceJointeFournie[] $fournies
     *
     * @return array
     */
    protected function makeMessages($demandees, $fournies)
    protected function makeMessages(array $demandees, array $fournies)
    {
        $role                     = $this->getServiceContext()->getSelectedIdentityRole();
        $isIntervenant            = (boolean)$role->getIntervenant();
@@ -131,7 +138,7 @@ class PieceJointeController extends AbstractController
        $nbObligatoiresNonFournis = 0;

        foreach ($demandees as $demandee) {
            if ($demandee->getObligatoire()) {
            if ($demandee->isObligatoire()) {
                $nbDemandees++;
                if (isset($fournies[$demandee->getTypePieceJointe()->getId()])) {
                    $pj = $fournies[$demandee->getTypePieceJointe()->getId()];
@@ -162,6 +169,7 @@ class PieceJointeController extends AbstractController
    }



    public function validationAction()
    {
        $this->initFilters();
@@ -174,6 +182,7 @@ class PieceJointeController extends AbstractController
    }



    public function validerAction()
    {
        $this->initFilters();
@@ -191,6 +200,7 @@ class PieceJointeController extends AbstractController
    }



    public function archiverAction()
    {
        $this->initFilters();
@@ -212,6 +222,7 @@ class PieceJointeController extends AbstractController
    }



    public function devaliderAction()
    {
        $this->initFilters();
@@ -229,6 +240,7 @@ class PieceJointeController extends AbstractController
    }



    public function listerAction()
    {
        $this->initFilters();
@@ -249,6 +261,7 @@ class PieceJointeController extends AbstractController
    }



    public function televerserAction()
    {
        $intervenant     = $this->getEvent()->getParam('intervenant');
@@ -272,6 +285,7 @@ class PieceJointeController extends AbstractController
    }



    public function telechargerAction()
    {
        /** @var Fichier $fichier */
@@ -292,6 +306,7 @@ class PieceJointeController extends AbstractController
    }



    public function supprimerAction()
    {
        if (!$this->getRequest()->isPost()) {
@@ -318,6 +333,7 @@ class PieceJointeController extends AbstractController
    }



    /* Actions liées à la configuration des PJ */

    public function configurationAction()
@@ -326,6 +342,7 @@ class PieceJointeController extends AbstractController
    }



    public function typePieceJointeStatutAction()
    {
        $this->em()->getFilters()->enable('historique')->init(entity: [
@@ -375,6 +392,7 @@ class PieceJointeController extends AbstractController
    }



    public function typePieceJointeDeleteAction()
    {
        $typePieceJointe = $this->getEvent()->getParam('typePieceJointe');
@@ -390,6 +408,7 @@ class PieceJointeController extends AbstractController
    }



    public function typePieceJointeSaisieAction()
    {
        /* @var $typePieceJointe TypePieceJointe */
@@ -409,6 +428,7 @@ class PieceJointeController extends AbstractController
    }



    public function modifierTypePieceJointeStatutAction()
    {
        /* @var $tpjs TypePieceJointeStatut */
@@ -434,6 +454,7 @@ class PieceJointeController extends AbstractController
    }



    public function typePieceJointeTrierAction()
    {
        /* @var $tpj TypePieceJointe */
@@ -459,6 +480,7 @@ class PieceJointeController extends AbstractController
    }



    public function deleteTypePieceJointeStatutAction()
    {
        $typePieceJointeStatut = $this->getEvent()->getParam('typePieceJointeStatut');
@@ -474,6 +496,7 @@ class PieceJointeController extends AbstractController
    }



    private function updateTableauxBord(Intervenant $intervenant, $validation = false)
    {
        $this->getServiceWorkflow()->calculerTableauxBord([
+6 −4
Changes for module/Application/src/Service/PieceJointeService.php: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@

namespace Application\Service;

use Application\Entity\Db\TblPieceJointe;
use Application\Entity\Db\TblPieceJointeDemande;
use Application\Entity\Db\TblPieceJointeFournie;
use Application\Service\Traits\FichierServiceAwareTrait;
use Application\Service\Traits\TypeValidationServiceAwareTrait;
use Application\Service\Traits\ValidationServiceAwareTrait;
@@ -79,7 +81,7 @@ class PieceJointeService extends AbstractEntityService
     *
     * @param Intervenant $intervenant
     *
     * @return TypePieceJointe[]
     * @return TblPieceJointeDemande[]
     */
    public function getTypesPiecesDemandees(Intervenant $intervenant)
    {
@@ -133,9 +135,9 @@ class PieceJointeService extends AbstractEntityService
    /**
     * @param Intervenant $intervenant
     *
     * @return mixed $result
     * @return TblPieceJointe[] $result
     */
    public function getPiecesSynthese(Intervenant $intervenant)
    public function getPiecesSynthese(Intervenant $intervenant): array
    {
        $dql = "
            SELECT 
@@ -163,7 +165,7 @@ class PieceJointeService extends AbstractEntityService
    /**
     * @param Intervenant $intervenant
     *
     * @return \Application\Entity\Db\PieceJointe[]
     * @return TblPieceJointeFournie[]
     */
    public function getPiecesFournies(Intervenant $intervenant)
    {
+1 −1
Changes for module/Application/src/Service/ServiceReferentielService.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ class ServiceReferentielService extends AbstractEntityService
            if (!$entity->getIntervenant() && $intervenant = $role->getIntervenant()) {
                $entity->setIntervenant($intervenant);
            }
            if (!$this->getAuthorize()->isAllowed($entity, Privileges::REFERENTIEL_PREVU_EDITION) || !$this->getAuthorize()->isAllowed($entity, Privileges::REFERENTIEL_REALISE_EDITION)) {
            if (!$this->getAuthorize()->isAllowed($entity, $entity->getTypeVolumeHoraire()->getPrivilegeReferentielEdition())) {
                throw new \BjyAuthorize\Exception\UnAuthorizedException('Saisie interdite');
            }

+4 −3
Changes for module/Application/view/application/piece-jointe/index.phtml: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -6,8 +6,9 @@ use Application\Provider\Privilege\Privileges;
 * @var $this         \Application\View\Renderer\PhpRenderer
 * @var $intervenant  \Application\Entity\Db\Intervenant
 * @var $title        string
 * @var $demandees    \Application\Entity\Db\TypePieceJointe[]
 * @var $fournies     \Application\Entity\Db\PieceJointe[]
 * @var $demandees    \Application\Entity\Db\TblPieceJointeDemande[]
 * @var $fournies     \Application\Entity\Db\TblPieceJointeFournie[]
 * @var $synthese     \Application\Entity\Db\TblPieceJointe[]
 * @var $messages     array
 * @var $alertContrat boolean
 */
@@ -39,7 +40,7 @@ $menuUrl = $this->url('piece-jointe/intervenant', ['intervenant' => $intervenant
            $obligatoire = true;
            foreach ($demandees as $pj) { // on liste les pièces demandées
                //Check si piece obligatoire
                $obligatoire = $pj->getObligatoire();
                $obligatoire = $pj->isObligatoire();
                $tpj         = $pj->getTypePieceJointe();
                if (isset($fournies[$tpj->getId()]) && $synthese[$tpj->getId()]->getFournie() == 1) { // qu'elles soient fournies ou non
                    $pj = $fournies[$tpj->getId()];