Commit 02525d4b authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Adaptation pour qu'un intervenant accède à ses PJ des années précédentes. (cf. commit 9b9a9d34)

parent 2c1aecfc
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ class PieceJointeController extends AbstractController
    use WorkflowServiceAwareTrait;



    /**
     * Initialisation des filtres Doctrine pour les historique.
     * Objectif : laisser passer les enregistrements passés en historique pour mettre en évidence ensuite les erreurs
@@ -168,6 +167,8 @@ class PieceJointeController extends AbstractController
        return compact('pj');
    }



    public function validerAction()
    {
        $this->initFilters();
@@ -184,6 +185,8 @@ class PieceJointeController extends AbstractController
        return $viewModel;
    }



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


        return $viewModel;

    }


@@ -230,12 +232,11 @@ class PieceJointeController extends AbstractController
        $this->initFilters();
        $intervenant = $this->getEvent()->getParam('intervenant');
        $pj          = $this->getEvent()->getParam('pieceJointe');
        if(empty($pj))
        {
        if (empty($pj)) {
            $typePieceJointe = $this->getEvent()->getParam('typePieceJointe');
            $pj              = $this->getServicePieceJointe()->getByType($intervenant, $typePieceJointe);
        } else {
            if ($pj->getIntervenant() != $intervenant) {
            if ($pj->getIntervenant()->getCode() != $intervenant->getCode()) {
                // un intervenant tente d'archiver la PJ d'un autre intervenant
                throw new \Exception('Vous ne pouvez pas visualiser la liste des pièces jointes d\'un autre intervenant');
            }
@@ -281,7 +282,7 @@ class PieceJointeController extends AbstractController
        /** @var Intervenant $intervenant */
        $intervenant = $this->getEvent()->getParam('intervenant');

        if (!$pieceJointe || $pieceJointe->getIntervenant() != $intervenant) {
        if (!$pieceJointe || $pieceJointe->getIntervenant()->getCode() != $intervenant->getCode()) {
            // un intervenant tente de télécharger la PJ d'un autre intervenant
            throw new \Exception('La pièce jointe n\'existe pas ou bien elle appartient à un autre intervenant');
        }
@@ -492,7 +493,6 @@ class PieceJointeController extends AbstractController
        $this->getServiceWorkflow()->calculerTableauxBord([
            'piece_jointe',
        ], $intervenants);

    }

}