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

[EMC2] Ajout d'un bouton de retour à la liste des entretiens professionnels...

[EMC2] Ajout d'un bouton de retour à la liste des entretiens professionnels depuis un entretien professionnel
parent cf07e955
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
Version 4.3.2 (XX/01/2024)
====

Évolution
---
- [EMC2] Ajout d'un bouton de retour à la liste des entretiens professionnels depuis un entretien professionnel

Modification en BD
---

```postgresql
create table formation_inscription_fichier
(
    inscription_id integer not null
        constraint formation_inscription_fichier_formation_inscription_id_fk
            references formation_inscription
            on delete cascade,
    fichier_id     varchar(13) not null
        constraint formation_inscription_fichier_fichier_fichier_id_fk
            references fichier_fichier
            on delete cascade,
    constraint formation_inscription_fichier_pk
        primary key (inscription_id, fichier_id)
);

INSERT INTO fichier_nature (code, libelle, description)
VALUES ('INSCRIPTION_ATTESTATION', 'Attestation de formation', 'Attestion de formation déposer dans [Mes Formations] qui se substituera à l''attestation générée');
```

Evolution des librairies
---


```bash
composer upgrade unicaen/autoform
```

ou

```bash
rm -fr vendor
rm -fr composer.lock
composer install
```

Evolution des macros et templates
---
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ use Application\Form\AgentHierarchieImportation\AgentHierarchieImportationForm;
    </div>
<?php endif; ?>

    <?php if ($array) : ?>
    <?php if (isset($array)) : ?>
    <table class="table table-condensed">
        <thead>
        <tr>
+12 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ return [
                    'controller' => EntretienProfessionnelController::class,
                    'action' => [
                        'action',
                        'retour-liste'
                    ],
                ],
                [
@@ -168,6 +169,17 @@ return [
                    ],
                ],
                'child_routes' => [
                    'retour-liste' => [
                        'type'  => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route'    => '/retour-liste/:entretien-professionnel',
                            'defaults' => [
                                /** @see EntretienProfessionnelController::retourListeAction() */
                                'action'     => 'retour-liste',
                            ],
                        ],
                    ],
                    'index-delegue' => [
                        'type'  => Literal::class,
                        'may_terminate' => true,
+41 −1
Original line number Diff line number Diff line
@@ -2,8 +2,11 @@

namespace EntretienProfessionnel\Controller;

use Application\Controller\IndexController;
use Application\Entity\Db\Agent;
use Application\Entity\Db\AgentAutorite;
use Application\Entity\Db\AgentSuperieur;
use Application\Provider\Role\RoleProvider as AppRoleProvider;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait;
use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait;
@@ -28,6 +31,8 @@ use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Structure\Controller\StructureController;
use Structure\Provider\Role\RoleProvider as StructureRoleProvider;
use Structure\Service\Structure\StructureServiceAwareTrait;
use UnicaenApp\Exception\RuntimeException;
use UnicaenEtat\Service\EtatInstance\EtatInstanceServiceAwareTrait;
@@ -165,7 +170,7 @@ class EntretienProfessionnelController extends AbstractActionController
        $form->init();
        $form->bind($entretien);

        if ($agent !== null) {
        if (isset($agent)) {
            $element = $form->get('agent');
            $element->setAttribute('readonly', true);
        }
@@ -540,4 +545,39 @@ class EntretienProfessionnelController extends AbstractActionController
        return $vm;
    }

    public function retourListeAction(): Response
    {
        $entretien = $this->getEntretienProfessionnelService()->getRequestedEntretienProfessionnel($this);
        $campagne = $entretien->getCampagne();
        $role = $this->getUserService()->getConnectedRole();
        $user = $this->getUserService()->getConnectedUser();

        switch($role->getRoleId()) {
            case AppRoleProvider::ADMIN_TECH :
            case AppRoleProvider::ADMIN_FONC :
            case AppRoleProvider::DRH:
            case AppRoleProvider::OBSERVATEUR :
                /** @see EntretienProfessionnelController::indexAction() */
                return $this->redirect()->toRoute('entretien-professionnel', [], ['query' => ['campagne' => $campagne->getId()]], true);
            case StructureRoleProvider::RESPONSABLE:
                $structure = current($this->getStructureService()->getStructuresByResponsable($user));
                /** @see CampagneController::structureAction() */
                return $this->redirect()->toRoute('entretien-professionnel/campagne/structure', ['structure' => $structure->getId(), 'campagne' => $campagne->getId()], true);
            case StructureRoleProvider::GESTIONNAIRE:
                $structure = current($this->getStructureService()->getStructuresByGestionnaire($user));
                /** @see CampagneController::structureAction() */
                return $this->redirect()->toRoute('entretien-professionnel/campagne/structure', ['structure' => $structure->getId(), 'campagne' => $campagne->getId()], true);
            case  Agent::ROLE_SUPERIEURE :
                /** @see IndexController::indexSuperieurAction() */
                return $this->redirect()->toRoute('index-superieur', [], ["fragment" => "entretien_". $campagne->getId()], true);
            case  Agent::ROLE_AUTORITE :
                /** @see IndexController::indexAutoriteAction() */
                return $this->redirect()->toRoute('index-autorite', [], ["fragment" => "entretien_". $campagne->getId()], true);
            case  Agent::ROLE_AGENT :
                /** @see EntretienProfessionnelController::indexAgentAction() */
                return $this->redirect()->toRoute('entretien-professionnel/index-agent', [], [], true);
            default:
                throw new RuntimeException("Rôle [".$role->getRoleId()."] non prévu");
        }
    }
}
+5 −7
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenAutoform\Service\Formulaire\FormulaireInstanceServiceAwareTrait;
use UnicaenEtat\Entity\Db\EtatType;
use UnicaenParametre\Service\Parametre\ParametreServiceAwareTrait;
use UnicaenValidation\Entity\Db\ValidationInstance;
use UnicaenValidation\Service\ValidationInstance\ValidationInstanceServiceAwareTrait;
use UnicaenValidation\Service\ValidationType\ValidationTypeServiceAwareTrait;

@@ -108,8 +107,7 @@ class EntretienProfessionnelService
                ->addSelect('fichesr')->leftjoin('responsable.fiches', 'fichesr')
                ->addSelect('campagne')->leftjoin('entretien.campagne', 'campagne')
                ->addSelect('validation')->leftjoin('entretien.validations', 'validation')
                ->addSelect('vtype')->leftjoin('validation.type', 'vtype')
;
                ->addSelect('vtype')->leftjoin('validation.type', 'vtype');
        } catch (NotSupported $e) {
            throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [" . EntretienProfessionnel::class . "]", 0, $e);
        }
@@ -404,10 +402,10 @@ class EntretienProfessionnelService
        if ($params['campagne'] !== null and $params['campagne'] !== "") {
            $qb = $qb->andWhere('campagne.id = :campagne')->setParameter('campagne', $params['campagne']);
        }
        if ($params['etat'] !== null and $params['etat'] !== "") {
        if (isset($params['etat']) and $params['etat'] !== "") {
            $qb = $qb->andWhere('etype.id = :etat')->setParameter('etat', $params['etat']);
        }
        if ($params['structure-filtre'] !== null and $params['structure-filtre']['id'] !== "") {
        if (isset($params['structure-filtre']) and $params['structure-filtre']['id'] !== "") {
            $qb = $qb
                ->leftJoin('agent.affectations', 'affectation')->addSelect('affectation')
                ->leftJoin('affectation.structure', 'structure')->addSelect('structure')
@@ -416,10 +414,10 @@ class EntretienProfessionnelService
                ->andWhere('affectation.dateFin IS NULL OR affectation.dateFin >= entretien.dateEntretien')
                ->andWhere('affectation.id IS NOT NULL');
        }
        if ($params['agent-filtre'] !== null and $params['agent-filtre']['id'] !== "") {
        if (isset($params['agent-filtre']) and $params['agent-filtre']['id'] !== "") {
            $qb = $qb->andWhere('agent.id = :id')->setParameter('id', $params['agent-filtre']['id']);
        }
        if ($params['responsable-filtre'] !== null and $params['responsable-filtre']['id'] !== "") {
        if (isset($params['responsable-filtre']) and $params['responsable-filtre']['id'] !== "") {
            $qb = $qb->andWhere('responsable.id = :id')->setParameter('id', $params['responsable-filtre']['id']);
        }

Loading