Loading module/Carriere/src/Carriere/Controller/CorrespondanceController.php +5 −0 Changes for module/Carriere/src/Carriere/Controller/CorrespondanceController.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -22,8 +22,13 @@ class CorrespondanceController extends AbstractActionController $bool = ($avecAgent) && ($avecAgent->getValeur() === "true"); $correspondances = $this->getCorrespondanceService()->getCorrespondances('libelleLong', 'ASC', $bool); $agentGrades = []; foreach ($correspondances as $correspondance) { $agentGrades[$correspondance->getId()] = $this->getAgentGradeService()->getAgentGradesByCorrespondance($correspondance); } return new ViewModel([ 'correspondances' => $correspondances, 'agentGrades' => $agentGrades, ]); } Loading module/Carriere/src/Carriere/Entity/Db/Correspondance.php +5 −22 Changes for module/Carriere/src/Carriere/Entity/Db/Correspondance.php: 5 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -3,13 +3,17 @@ namespace Carriere\Entity\Db; use Application\Entity\Db\AgentGrade; use Application\Entity\Db\Interfaces\HasPeriodeInterface; use Application\Entity\Db\Traits\DbImportableAwareTrait; use Application\Entity\Db\Traits\HasPeriodeTrait; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; class Correspondance { //todo utiliser interface HasPeriodeInterface class Correspondance implements HasPeriodeInterface { use DbImportableAwareTrait; use HasPeriodeTrait; private ?int $id = null; private ?string $categorie = null; Loading @@ -18,7 +22,6 @@ class Correspondance { private ?DateTime $histo = null; private Collection $agentGrades; private ?CorrespondanceType $type = null; private ?DateTime $dateOuverture = null; private ?DateTime $dateFermeture = null; public function __construct() Loading Loading @@ -71,26 +74,6 @@ class Correspondance { $this->type = $type; } public function getDateOuverture(): ?DateTime { return $this->dateOuverture; } public function setDateOuverture(?DateTime $dateOuverture): void { $this->dateOuverture = $dateOuverture; } public function getDateFermeture(): ?DateTime { return $this->dateFermeture; } public function setDateFermeture(?DateTime $dateFermeture): void { $this->dateFermeture = $dateFermeture; } public function getHisto() : ?DateTime { return $this->histo; Loading module/Carriere/src/Carriere/Entity/Db/Mapping/Carriere.Entity.Db.Correspondance.dcm.xml +2 −2 Changes for module/Carriere/src/Carriere/Entity/Db/Mapping/Carriere.Entity.Db.Correspondance.dcm.xml: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ <field name="categorie" column="c_bap" type="string" length="10" /> <field name="libelleCourt" column="lib_court" type="string" length="20" /> <field name="libelleLong" column="lib_long" type="string" length="200" /> <field name="dateOuverture" column="d_ouverture" type="datetime" /> <field name="dateFermeture" column="d_fermeture" type="datetime" /> <field name="dateDebut" column="d_ouverture" type="datetime" /> <field name="dateFin" column="d_fermeture" type="datetime" /> <many-to-one target-entity="Carriere\Entity\Db\CorrespondanceType" field="type"> <join-column name="type_id" referenced-column-name="id"/> Loading module/Carriere/src/Carriere/Service/Correspondance/CorrespondanceService.php +10 −2 Changes for module/Carriere/src/Carriere/Service/Correspondance/CorrespondanceService.php: 10 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Carriere\Service\Correspondance; use Application\Entity\Db\Interfaces\HasPeriodeInterface; use Application\Entity\Db\Traits\HasPeriodeTrait; use Carriere\Entity\Db\Correspondance; use Carriere\Entity\Db\CorrespondanceType; use Doctrine\ORM\NonUniqueResultException; Loading Loading @@ -34,9 +36,10 @@ class CorrespondanceService { * @param string $champ * @param string $ordre * @param bool $avecAgent * @return Correspondance[] * @param bool $avecHisto * @return Correspondance */ public function getCorrespondances(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=true) : array public function getCorrespondances(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=true, bool $avecHisto = false) : array { $qb = $this->createQueryBuilder() ->orderBy('correspondance.' . $champ, $ordre) Loading @@ -49,6 +52,11 @@ class CorrespondanceService { ->addSelect('agent')->join('agentGrade.agent','agent') ->andWhere('agent.deleted_on IS NULL') ; $qb = HasPeriodeTrait::decorateWithActif($qb, 'agentGrade'); } if ($avecHisto === false) { $qb = HasPeriodeTrait::decorateWithActif($qb, 'correspondance'); } $result = $qb->getQuery()->getResult(); Loading module/Carriere/view/carriere/correspondance/index.phtml +4 −2 Changes for module/Carriere/view/carriere/correspondance/index.phtml: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,13 +3,15 @@ /** * @see \Carriere\Controller\CorrespondanceController::indexAction() * @var Correspondance[] $correspondances * @var AgentGrade[] $agentGrades */ use Application\Entity\Db\AgentGrade; use Carriere\Entity\Db\Correspondance; use Carriere\Provider\Privilege\CorpsPrivileges; $date = new DateTime(); $correspondances = array_filter($correspondances, function (Correspondance $a) use ($date) { return $a->getDateFermeture() === null OR $a->getDateFermeture() > $date;}); $correspondances = array_filter($correspondances, function (Correspondance $a) use ($date) { return $a->getDateFin() === null OR $a->getDateFin() > $date;}); $canAfficher = $this->isAllowed(CorpsPrivileges::getResourceId(CorpsPrivileges::CORPS_AFFICHER)); Loading Loading @@ -71,7 +73,7 @@ $this->headTitle("Liste des correspondances"); Aucun <?php endif; ?> </td> <td> <?php echo count($correspondance->getAgentGrades()); ?> </td> <td> <?php echo count($agentGrades[$correspondance->getId()]); ?> </td> <td> <?php if ($canAfficher) : ?> <a Loading Loading
module/Carriere/src/Carriere/Controller/CorrespondanceController.php +5 −0 Changes for module/Carriere/src/Carriere/Controller/CorrespondanceController.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -22,8 +22,13 @@ class CorrespondanceController extends AbstractActionController $bool = ($avecAgent) && ($avecAgent->getValeur() === "true"); $correspondances = $this->getCorrespondanceService()->getCorrespondances('libelleLong', 'ASC', $bool); $agentGrades = []; foreach ($correspondances as $correspondance) { $agentGrades[$correspondance->getId()] = $this->getAgentGradeService()->getAgentGradesByCorrespondance($correspondance); } return new ViewModel([ 'correspondances' => $correspondances, 'agentGrades' => $agentGrades, ]); } Loading
module/Carriere/src/Carriere/Entity/Db/Correspondance.php +5 −22 Changes for module/Carriere/src/Carriere/Entity/Db/Correspondance.php: 5 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -3,13 +3,17 @@ namespace Carriere\Entity\Db; use Application\Entity\Db\AgentGrade; use Application\Entity\Db\Interfaces\HasPeriodeInterface; use Application\Entity\Db\Traits\DbImportableAwareTrait; use Application\Entity\Db\Traits\HasPeriodeTrait; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; class Correspondance { //todo utiliser interface HasPeriodeInterface class Correspondance implements HasPeriodeInterface { use DbImportableAwareTrait; use HasPeriodeTrait; private ?int $id = null; private ?string $categorie = null; Loading @@ -18,7 +22,6 @@ class Correspondance { private ?DateTime $histo = null; private Collection $agentGrades; private ?CorrespondanceType $type = null; private ?DateTime $dateOuverture = null; private ?DateTime $dateFermeture = null; public function __construct() Loading Loading @@ -71,26 +74,6 @@ class Correspondance { $this->type = $type; } public function getDateOuverture(): ?DateTime { return $this->dateOuverture; } public function setDateOuverture(?DateTime $dateOuverture): void { $this->dateOuverture = $dateOuverture; } public function getDateFermeture(): ?DateTime { return $this->dateFermeture; } public function setDateFermeture(?DateTime $dateFermeture): void { $this->dateFermeture = $dateFermeture; } public function getHisto() : ?DateTime { return $this->histo; Loading
module/Carriere/src/Carriere/Entity/Db/Mapping/Carriere.Entity.Db.Correspondance.dcm.xml +2 −2 Changes for module/Carriere/src/Carriere/Entity/Db/Mapping/Carriere.Entity.Db.Correspondance.dcm.xml: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ <field name="categorie" column="c_bap" type="string" length="10" /> <field name="libelleCourt" column="lib_court" type="string" length="20" /> <field name="libelleLong" column="lib_long" type="string" length="200" /> <field name="dateOuverture" column="d_ouverture" type="datetime" /> <field name="dateFermeture" column="d_fermeture" type="datetime" /> <field name="dateDebut" column="d_ouverture" type="datetime" /> <field name="dateFin" column="d_fermeture" type="datetime" /> <many-to-one target-entity="Carriere\Entity\Db\CorrespondanceType" field="type"> <join-column name="type_id" referenced-column-name="id"/> Loading
module/Carriere/src/Carriere/Service/Correspondance/CorrespondanceService.php +10 −2 Changes for module/Carriere/src/Carriere/Service/Correspondance/CorrespondanceService.php: 10 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Carriere\Service\Correspondance; use Application\Entity\Db\Interfaces\HasPeriodeInterface; use Application\Entity\Db\Traits\HasPeriodeTrait; use Carriere\Entity\Db\Correspondance; use Carriere\Entity\Db\CorrespondanceType; use Doctrine\ORM\NonUniqueResultException; Loading Loading @@ -34,9 +36,10 @@ class CorrespondanceService { * @param string $champ * @param string $ordre * @param bool $avecAgent * @return Correspondance[] * @param bool $avecHisto * @return Correspondance */ public function getCorrespondances(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=true) : array public function getCorrespondances(string $champ = 'categorie', string $ordre = 'ASC', bool $avecAgent=true, bool $avecHisto = false) : array { $qb = $this->createQueryBuilder() ->orderBy('correspondance.' . $champ, $ordre) Loading @@ -49,6 +52,11 @@ class CorrespondanceService { ->addSelect('agent')->join('agentGrade.agent','agent') ->andWhere('agent.deleted_on IS NULL') ; $qb = HasPeriodeTrait::decorateWithActif($qb, 'agentGrade'); } if ($avecHisto === false) { $qb = HasPeriodeTrait::decorateWithActif($qb, 'correspondance'); } $result = $qb->getQuery()->getResult(); Loading
module/Carriere/view/carriere/correspondance/index.phtml +4 −2 Changes for module/Carriere/view/carriere/correspondance/index.phtml: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -3,13 +3,15 @@ /** * @see \Carriere\Controller\CorrespondanceController::indexAction() * @var Correspondance[] $correspondances * @var AgentGrade[] $agentGrades */ use Application\Entity\Db\AgentGrade; use Carriere\Entity\Db\Correspondance; use Carriere\Provider\Privilege\CorpsPrivileges; $date = new DateTime(); $correspondances = array_filter($correspondances, function (Correspondance $a) use ($date) { return $a->getDateFermeture() === null OR $a->getDateFermeture() > $date;}); $correspondances = array_filter($correspondances, function (Correspondance $a) use ($date) { return $a->getDateFin() === null OR $a->getDateFin() > $date;}); $canAfficher = $this->isAllowed(CorpsPrivileges::getResourceId(CorpsPrivileges::CORPS_AFFICHER)); Loading Loading @@ -71,7 +73,7 @@ $this->headTitle("Liste des correspondances"); Aucun <?php endif; ?> </td> <td> <?php echo count($correspondance->getAgentGrades()); ?> </td> <td> <?php echo count($agentGrades[$correspondance->getId()]); ?> </td> <td> <?php if ($canAfficher) : ?> <a Loading