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

Ajout des temoins hiérarchique et fonctionnelle pour les affectations

parent 4db2007f
Loading
Loading
Loading
Loading
+19 −0
Changes for documentation/release/3.1.5.md: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
**CHANGES version 3.1.4**

-----------

**Changements**

* Ajout des temoins hiérarchique et fonctionnelle pour les affectations

**Modifications de la base de donnée**

```sql
alter table agent_carriere_affectation add t_hierarchique varchar(1) default 'N';
alter table agent_carriere_affectation add t_fonctionnelle varchar(1) default 'N';
```

**Évolution des bibliothèques**

```bash
```
+1 −1
Changes for module/Application/src/Application/Controller/AgentController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ class AgentController extends AbstractActionController

        //Récupération des status
        $agentStatuts = $this->getAgentStatutService()->getAgentStatutsByAgent($agent);
        $agentAffectations = $this->getAgentAffectationService()->getAgentAffectationsByAgent($agent);
        $agentAffectations = $this->getAgentAffectationService()->getAgentAffectationsByAgent($agent,true,true,false);
        $agentGrades = $this->getAgentGradeService()->getAgentGradesByAgent($agent);

        //Récupération des supérieures et autorités
+22 −32
Changes for module/Application/src/Application/Entity/Db/AgentAffectation.php: 22 added lines, 32 removed lines.
Original line number Diff line number Diff line
@@ -15,59 +15,49 @@ class AgentAffectation implements HasPeriodeInterface {
    use DbImportableAwareTrait;
    use HasPeriodeTrait;

    /** @var integer */
    private $id;
    /** @var Agent */
    private $agent;
    /** @var Structure */
    private $structure;
    /** @var string */
    private $idOrig;
    /** @var string */
    private $principale;
    private ?int $id = null;
    private ?Agent $agent = null;
    private ?Structure $structure = null;
    private ?string $idOrig = null;
    private ?string $principale = null;
    private ?string $hierarchique = null;
    private ?string $fonctionnelle = null;



    /**
     * @return int
     */
    public function getId()
    public function getId() : ?int
    {
        return $this->id;
    }

    /**
     * @return Agent
     */
    public function getAgent()
    public function getAgent() : ?Agent
    {
        return $this->agent;
    }

    /**
     * @return Structure
     */
    public function getStructure()
    public function getStructure() : ?Structure
    {
        return $this->structure;
    }

    /**
     * @return string
     */
    public function getIdOrig()
    public function getIdOrig() : ?string
    {
        return $this->idOrig;
    }

    /**
     * @return boolean
     */
    public function isPrincipale()
    public function isPrincipale() : bool
    {
        return ($this->principale === 'O');
    }

    public function isHierarchique() : bool
    {
        return ($this->hierarchique === 'O');
    }

    public function isFonctionnelle() : bool
    {
        return ($this->fonctionnelle === 'O');
    }

    /**
     * @param AgentAffectation[] $agentAffectations
     * @return string[]
+2 −0
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentAffectation.dcm.xml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
        <field name="dateFin"                 column="date_fin"         type="datetime"/>
        <field name="idOrig"                  column="id_orig"          type="string" length="255"/>
        <field name="principale"              column="t_principale"     type="string" length="1"/>
        <field name="hierarchique"            column="t_hierarchique"   type="string" length="1"/>
        <field name="fonctionnelle"           column="t_fonctionnelle"  type="string" length="1"/>

        <!-- DB IMPORT #############################  -->
        <field name="created_on"               column="created_on"       type="datetime"/>
+3 −1
Changes for module/Application/src/Application/Service/AgentAffectation/AgentAffectationService.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -30,9 +30,10 @@ class AgentAffectationService {
     * @param Agent $agent
     * @param bool $actif
     * @param bool $principale
     * @param bool $fonctionnelle
     * @return AgentAffectation[]
     */
    public function getAgentAffectationsByAgent(Agent $agent, bool $actif = true, bool $principale = false) : array
    public function getAgentAffectationsByAgent(Agent $agent, bool $actif = true, bool $principale = false, bool $fonctionnelle = true) : array
    {
        $qb = $this->createQueryBuilder()
            ->andWhere('agentaffectation.agent = :agent')
@@ -41,6 +42,7 @@ class AgentAffectationService {
        ;

        if ($principale) $qb = $qb->andWhere("agentaffectation.principale = 'O'");
        if ($fonctionnelle) $qb = $qb->andWhere("agentaffectation.fonctionnelle = 'O'");
        if ($actif === true) $qb = AgentAffectation::decorateWithActif($qb, 'agentaffectation');

        $result = $qb->getQuery()->getResult();
Loading