Loading documentation/release/3.1.2.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ **Changements** * Ajout d'un parametre indiquant le chamin d'installation pour la partie Vérification * [FIX] correction du choix de l'échelon (si plusieurs échelons actifs alors selection du plus récent "en terme de date de passage") * [FIX] propagation d'un renommage de variable sur l'interface des supérieurs hiérarchique **Modifications de la base de donnée** Loading module/Application/src/Application/Entity/Db/Agent.php +9 −6 Original line number Diff line number Diff line Loading @@ -416,18 +416,21 @@ class Agent implements $echelons = $this->echelons->toArray(); $grades = array_filter($echelons, function (AgentEchelon $ag) { return !$ag->isDeleted();}); usort($grades, function (AgentEchelon $a, AgentEchelon $b) { return $a->getDate() > $b->getDate(); return $a->getDateDebut() > $b->getDateDebut(); }); return $grades; } /** * @return AgentEchelon|null */ public function getEchelonActif() : ?AgentEchelon public function getEchelonActif(?DateTime $date = null) : ?AgentEchelon { if ($date === null) $date = new DateTime(); $echelons = $this->getEchelons(); $echelon = (!empty($echelons))?$echelons[0]:null; $echelons = array_filter($echelons, function (AgentEchelon $a) use ($date) {return $a->estEnCours($date);}); $echelon = null; foreach ($echelons as $echelon_) { if ($echelon === null OR $echelon_->getDateDebut() > $echelon->getDateDebut()) $echelon = $echelon_; } return $echelon; } Loading module/Application/src/Application/Entity/Db/AgentEchelon.php +5 −55 Original line number Diff line number Diff line Loading @@ -15,77 +15,27 @@ use Structure\Entity\Db\Structure; * Données synchronisées depuis Octopus : * - pas de setter sur les données ainsi remontées */ class AgentEchelon { class AgentEchelon implements HasPeriodeInterface { use DbImportableAwareTrait; use HasPeriodeTrait; /** @var int */ private $id; /** @var Agent */ private $agent; /** @var int */ private $echelon; /** @var DateTime */ private $date; private ?int $id = -1; private ?Agent $agent = null; private ?int $echelon = null; /** * @return int|null */ public function getId() : ?int { return $this->id; } /** * @return Agent|null */ public function getAgent(): ?Agent { return $this->agent; } /** * @param Agent $agent * @return AgentEchelon */ public function setAgent(Agent $agent): AgentEchelon { $this->agent = $agent; return $this; } /** * @return int|null */ public function getEchelon(): ?int { return $this->echelon; } /** * @param int $echelon * @return AgentEchelon */ public function setEchelon(int $echelon): AgentEchelon { $this->echelon = $echelon; return $this; } /** * @return DateTime|null */ public function getDate(): ?DateTime { return $this->date; } /** * @param DateTime $date * @return AgentEchelon */ public function setDate(DateTime $date): AgentEchelon { $this->date = $date; return $this; } } No newline at end of file module/Application/src/Application/Entity/Db/MacroContent/AgentMacroTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,7 @@ trait AgentMacroTrait $echelon = $agent->getEchelonActif(); if ($echelon) { return $echelon->getDate()->format('d/m/Y'); return $echelon->getDateDebut()->format('d/m/Y'); } return ""; } Loading module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentEchelon.dcm.xml +2 −1 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ <join-column name="agent_id" referenced-column-name="c_individu"/> </many-to-one> <field name="date" type="datetime" column="d_debut" nullable="false"/> <field name="echelon" type="integer" column="echelon" nullable="false"/> <field name="dateDebut" type="datetime" column="d_debut" nullable="false"/> <field name="dateFin" type="datetime" column="d_fin" nullable="true"/> <!-- DB IMPORT ############################# --> <field name="created_on" column="created_on" type="datetime"/> Loading Loading
documentation/release/3.1.2.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ **Changements** * Ajout d'un parametre indiquant le chamin d'installation pour la partie Vérification * [FIX] correction du choix de l'échelon (si plusieurs échelons actifs alors selection du plus récent "en terme de date de passage") * [FIX] propagation d'un renommage de variable sur l'interface des supérieurs hiérarchique **Modifications de la base de donnée** Loading
module/Application/src/Application/Entity/Db/Agent.php +9 −6 Original line number Diff line number Diff line Loading @@ -416,18 +416,21 @@ class Agent implements $echelons = $this->echelons->toArray(); $grades = array_filter($echelons, function (AgentEchelon $ag) { return !$ag->isDeleted();}); usort($grades, function (AgentEchelon $a, AgentEchelon $b) { return $a->getDate() > $b->getDate(); return $a->getDateDebut() > $b->getDateDebut(); }); return $grades; } /** * @return AgentEchelon|null */ public function getEchelonActif() : ?AgentEchelon public function getEchelonActif(?DateTime $date = null) : ?AgentEchelon { if ($date === null) $date = new DateTime(); $echelons = $this->getEchelons(); $echelon = (!empty($echelons))?$echelons[0]:null; $echelons = array_filter($echelons, function (AgentEchelon $a) use ($date) {return $a->estEnCours($date);}); $echelon = null; foreach ($echelons as $echelon_) { if ($echelon === null OR $echelon_->getDateDebut() > $echelon->getDateDebut()) $echelon = $echelon_; } return $echelon; } Loading
module/Application/src/Application/Entity/Db/AgentEchelon.php +5 −55 Original line number Diff line number Diff line Loading @@ -15,77 +15,27 @@ use Structure\Entity\Db\Structure; * Données synchronisées depuis Octopus : * - pas de setter sur les données ainsi remontées */ class AgentEchelon { class AgentEchelon implements HasPeriodeInterface { use DbImportableAwareTrait; use HasPeriodeTrait; /** @var int */ private $id; /** @var Agent */ private $agent; /** @var int */ private $echelon; /** @var DateTime */ private $date; private ?int $id = -1; private ?Agent $agent = null; private ?int $echelon = null; /** * @return int|null */ public function getId() : ?int { return $this->id; } /** * @return Agent|null */ public function getAgent(): ?Agent { return $this->agent; } /** * @param Agent $agent * @return AgentEchelon */ public function setAgent(Agent $agent): AgentEchelon { $this->agent = $agent; return $this; } /** * @return int|null */ public function getEchelon(): ?int { return $this->echelon; } /** * @param int $echelon * @return AgentEchelon */ public function setEchelon(int $echelon): AgentEchelon { $this->echelon = $echelon; return $this; } /** * @return DateTime|null */ public function getDate(): ?DateTime { return $this->date; } /** * @param DateTime $date * @return AgentEchelon */ public function setDate(DateTime $date): AgentEchelon { $this->date = $date; return $this; } } No newline at end of file
module/Application/src/Application/Entity/Db/MacroContent/AgentMacroTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -343,7 +343,7 @@ trait AgentMacroTrait $echelon = $agent->getEchelonActif(); if ($echelon) { return $echelon->getDate()->format('d/m/Y'); return $echelon->getDateDebut()->format('d/m/Y'); } return ""; } Loading
module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.AgentEchelon.dcm.xml +2 −1 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ <join-column name="agent_id" referenced-column-name="c_individu"/> </many-to-one> <field name="date" type="datetime" column="d_debut" nullable="false"/> <field name="echelon" type="integer" column="echelon" nullable="false"/> <field name="dateDebut" type="datetime" column="d_debut" nullable="false"/> <field name="dateFin" type="datetime" column="d_fin" nullable="true"/> <!-- DB IMPORT ############################# --> <field name="created_on" column="created_on" type="datetime"/> Loading