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

Ajout d'un parametre

parent 7289ecdf
Loading
Loading
Loading
Loading
+2 −1
Changes for documentation/002_DB_EMC2_CARRIERE.sql: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -121,7 +121,8 @@ INSERT INTO unicaen_parametre_parametre(CATEGORIE_ID, CODE, LIBELLE, DESCRIPTION
WITH d(CODE, LIBELLE, DESCRIPTION, VALEURS_POSSIBLES, VALEUR, ORDRE) AS (
    SELECT 'CorpsAvecAgent', 'Affichage seulement des corps avec agent', null, 'Boolean', 'true', 100 UNION
    SELECT 'GradeAvecAgent', 'Affichage seulement des grades avec agent', null, 'Boolean', 'true', 200 UNION
    SELECT 'CorrespondanceAvecAgent', 'Affichage seulement des correspondance ayant un agent', null, 'Boolean', 'true', 30
    SELECT 'CorrespondanceAvecAgent', 'Affichage seulement des correspondance ayant un agent', null, 'Boolean', 'true', 300 UNION
    SELECT 'ACTIF_ONLY','Ne considérer que les Corps/Correspondances/Grades actifs',null,'Boolean',true, 1000
)
SELECT cp.id, d.CODE, d.LIBELLE, d.DESCRIPTION, d.VALEURS_POSSIBLES, d.VALEUR, d.ORDRE
FROM d
+9 −0
Changes for documentation/release/3.1.4.md: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,15 @@
**Modifications de la base de donnée**

```sql
-- Nouveau parametre pour l'affichages des corps/correspondances/grades
INSERT INTO unicaen_parametre_parametre(CATEGORIE_ID, CODE, LIBELLE, DESCRIPTION, VALEURS_POSSIBLES, VALEUR, ORDRE)
WITH d(CODE, LIBELLE, DESCRIPTION, VALEURS_POSSIBLES, VALEUR, ORDRE) AS (
    SELECT 'ACTIF_ONLY','Ne considérer que les Corps/Correspondances/Grades actifs',null,'Boolean',true, 1000
)
SELECT cp.id, d.CODE, d.LIBELLE, d.DESCRIPTION, d.VALEURS_POSSIBLES, d.VALEUR, d.ORDRE
FROM d
JOIN unicaen_parametre_categorie cp ON cp.CODE = 'CARRIERE';

-- les templates sont équipés d'un namespace pour faciliter l'exploitation
alter table unicaen_renderer_template add namespace varchar(1024);

+3 −0
Changes for module/Application/src/Application/Service/AgentGrade/AgentGradeService.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ class AgentGradeService {
        $qb = $this->createQueryBuilder()
            ->andWhere('agentgrade.grade = :grade')
            ->setParameter('grade', $grade)
            ->orderBy('agent.nomUsuel, agent.prenom', 'ASC')
        ;

        if ($actif === true) $qb = AgentGrade::decorateWithActif($qb, 'agentgrade');
@@ -97,6 +98,7 @@ class AgentGradeService {
        $qb = $this->createQueryBuilder()
            ->andWhere('agentgrade.corps = :corps')
            ->setParameter('corps', $corps)
            ->orderBy('agent.nomUsuel, agent.prenom', 'ASC')
        ;

        if ($actif === true) $qb = AgentGrade::decorateWithActif($qb, 'agentgrade');
@@ -115,6 +117,7 @@ class AgentGradeService {
        $qb = $this->createQueryBuilder()
            ->andWhere('agentgrade.bap = :correspondance')
            ->setParameter('correspondance', $correspondance)
            ->orderBy('agent.nomUsuel, agent.prenom', 'ASC')
        ;

        if ($actif === true) $qb = AgentGrade::decorateWithActif($qb, 'agentgrade');
+12 −0
Changes for module/Carriere/src/Carriere/Controller/CorpsController.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Carriere\Controller;

use Application\Service\AgentGrade\AgentGradeServiceAwareTrait;
use Carriere\Entity\Db\NiveauEnveloppe;
use Carriere\Form\NiveauEnveloppe\NiveauEnveloppeFormAwareTrait;
use Carriere\Provider\Parametre\CarriereParametres;
@@ -13,6 +14,7 @@ use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class CorpsController extends AbstractActionController {
    use AgentGradeServiceAwareTrait;
    use CategorieServiceAwareTrait;
    use CorpsServiceAwareTrait;
    use NiveauEnveloppeServiceAwareTrait;
@@ -32,11 +34,21 @@ class CorpsController extends AbstractActionController {

    public function afficherAgentsAction() : ViewModel
    {
        $actifOnly = $this->getParametreService()->getParametreByCode(CarriereParametres::TYPE,CarriereParametres::ACTIF_ONLY);
        $bool = ($actifOnly) && ($actifOnly->getValeur() === "true");

        $corps = $this->getCorpsService()->getRequestedCorps($this);
        $agentGrades = $this->getAgentGradeService()->getAgentGradesByCorps($corps, $bool);
        $agents = [];
        foreach ($agentGrades as $agentGrade) {
            $agents[$agentGrade->getAgent()->getId()] = $agentGrade->getAgent();
        }

        return new ViewModel([
            'title' => 'Agents ayant le corps ['. $corps->getLibelleCourt().']',
            'corps' => $corps,
            'agentGrades' => $agentGrades,
            'agents' => $agents,
        ]);
    }

+4 −0
Changes for module/Carriere/src/Carriere/Controller/CorpsControllerFactory.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Carriere\Controller;

use Application\Service\AgentGrade\AgentGradeService;
use Carriere\Form\NiveauEnveloppe\NiveauEnveloppeForm;
use Carriere\Service\Categorie\CategorieService;
use Carriere\Service\Corps\CorpsService;
@@ -22,11 +23,13 @@ class CorpsControllerFactory {
    public function __invoke(ContainerInterface $container) : CorpsController
    {
        /**
         * @var AgentGradeService $agentGradeService
         * @var CategorieService $categorieService
         * @var CorpsService $corpsService
         * @var NiveauEnveloppeService $niveauEnveloppeService
         * @var ParametreService $parametreService
         */
        $agentGradeService = $container->get(AgentGradeService::class);
        $categorieService = $container->get(CategorieService::class);
        $corpsService = $container->get(CorpsService::class);
        $niveauEnveloppeService = $container->get(NiveauEnveloppeService::class);
@@ -38,6 +41,7 @@ class CorpsControllerFactory {
        $niveauEnveloppeForm = $container->get('FormElementManager')->get(NiveauEnveloppeForm::class);

        $controller = new CorpsController();
        $controller->setAgentGradeService($agentGradeService);
        $controller->setCategorieService($categorieService);
        $controller->setCorpsService($corpsService);
        $controller->setNiveauEnveloppeService($niveauEnveloppeService);
Loading