Loading module/Application/src/Application/Controller/FichePosteController.php +19 −2 Changes for module/Application/src/Application/Controller/FichePosteController.php: 19 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -98,6 +98,15 @@ class FichePosteController extends AbstractActionController { public function ajouterAction() { $agent = $this->getAgentService()->getRequestedAgent($this); if ($agent) { $fiche = $this->getFichePosteService()->getFichePosteByAgent($agent); if ($fiche !== null) { $this->flashMessenger()->addErrorMessage("La fiche de poste existe déjà l'ajout n'a pu être effectué."); return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], [], true); } } $fiche = new FichePoste(); $fiche->setAgent($agent); $this->getFichePosteService()->create($fiche); Loading @@ -106,11 +115,19 @@ class FichePosteController extends AbstractActionController { public function dupliquerAction() { $structure = $this->getStructureService()->getRequestedStructure($this); $agent = $this->getAgentService()->getRequestedAgent($this); if ($agent !== null) { $fiche = $this->getFichePosteService()->getFichePosteByAgent($agent); if ($fiche !== null) { $this->flashMessenger()->addErrorMessage("La fiche de poste existe déjà la duplication n'a pu être effectuée."); return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], [], true); } } $structure = $this->getStructureService()->getRequestedStructure($this); $structures = $this->getStructureService()->getStructuresFilles($structure); $structures[] = $structure; $agent = $this->getAgentService()->getRequestedAgent($this); $fiches = $this->getFichePosteService()->getFichesPostesByStructures($structures, true); /** @var Request $request */ Loading module/Application/src/Application/Service/FichePoste/FichePosteService.php +21 Changes for module/Application/src/Application/Service/FichePoste/FichePosteService.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Application\Service\FichePoste; use Application\Entity\Db\Activite; use Application\Entity\Db\Agent; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FichePoste; use Application\Entity\Db\FicheposteApplicationRetiree; Loading Loading @@ -629,4 +630,24 @@ class FichePosteService { return $dictionnaire; } /** * @param Agent $agent * @return FichePoste */ public function getFichePosteByAgent(Agent $agent) { $qb = $this->createQueryBuilder() ->andWhere('fiche.agent = :agent') ->setParameter('agent',$agent) ->andWhere('fiche.histoDestruction IS NULL') ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs fiche de postes actives associés à l'agent [".$agent->getId()."|".$agent->getDenomination()."]",0,$e); } return $result; } } No newline at end of file module/Application/view/application/fiche-poste/editer.phtml +2 Changes for module/Application/view/application/fiche-poste/editer.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ $this->headTitle("Modification de la fiche de poste #".$fiche->getId()); a.action {width: 18em;} </style> <?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?> <div class="row"> <div class="col-md-9"> <h1 class="page-header"> Loading module/Application/view/application/fiche-poste/partial/environnement-poste.phtml +2 Changes for module/Application/view/application/fiche-poste/partial/environnement-poste.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ $canModifier = $this->isAllowed($fiche, FichePostePrivileges::FICHEPOSTE_MODIFIE $poste = $fiche->getPoste(); /** @var Structure[] $structures */ $structures = []; if ($agent !== null) { foreach ($agent->getGradesActifs() as $agentGrade) { $structure = $agentGrade->getStructure(); if ($structure !== null) $structures[] = $structure; } } ?> Loading module/Application/view/application/structure/partial/agents.phtml +1 −1 Changes for module/Application/view/application/structure/partial/agents.phtml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ $canDetruireFichePoste = $this->isAllowed(FichePostePrivileges::getResource <?php if($fiche === null) : ?> <?php if ($canAjouterFichePoste) : ?> <a <?php /** @see \Application\Controller\FichePosteController::afficherAction() */ ?> <?php /** @see \Application\Controller\FichePosteController::ajouterAction() */ ?> href="<?php echo $this->url('fiche-poste/ajouter', ['agent' => $agent->getId()], [], true); ?>" target="_blank" ><span class="icon ajouter" Loading Loading
module/Application/src/Application/Controller/FichePosteController.php +19 −2 Changes for module/Application/src/Application/Controller/FichePosteController.php: 19 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -98,6 +98,15 @@ class FichePosteController extends AbstractActionController { public function ajouterAction() { $agent = $this->getAgentService()->getRequestedAgent($this); if ($agent) { $fiche = $this->getFichePosteService()->getFichePosteByAgent($agent); if ($fiche !== null) { $this->flashMessenger()->addErrorMessage("La fiche de poste existe déjà l'ajout n'a pu être effectué."); return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], [], true); } } $fiche = new FichePoste(); $fiche->setAgent($agent); $this->getFichePosteService()->create($fiche); Loading @@ -106,11 +115,19 @@ class FichePosteController extends AbstractActionController { public function dupliquerAction() { $structure = $this->getStructureService()->getRequestedStructure($this); $agent = $this->getAgentService()->getRequestedAgent($this); if ($agent !== null) { $fiche = $this->getFichePosteService()->getFichePosteByAgent($agent); if ($fiche !== null) { $this->flashMessenger()->addErrorMessage("La fiche de poste existe déjà la duplication n'a pu être effectuée."); return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], [], true); } } $structure = $this->getStructureService()->getRequestedStructure($this); $structures = $this->getStructureService()->getStructuresFilles($structure); $structures[] = $structure; $agent = $this->getAgentService()->getRequestedAgent($this); $fiches = $this->getFichePosteService()->getFichesPostesByStructures($structures, true); /** @var Request $request */ Loading
module/Application/src/Application/Service/FichePoste/FichePosteService.php +21 Changes for module/Application/src/Application/Service/FichePoste/FichePosteService.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Application\Service\FichePoste; use Application\Entity\Db\Activite; use Application\Entity\Db\Agent; use Application\Entity\Db\FicheMetier; use Application\Entity\Db\FichePoste; use Application\Entity\Db\FicheposteApplicationRetiree; Loading Loading @@ -629,4 +630,24 @@ class FichePosteService { return $dictionnaire; } /** * @param Agent $agent * @return FichePoste */ public function getFichePosteByAgent(Agent $agent) { $qb = $this->createQueryBuilder() ->andWhere('fiche.agent = :agent') ->setParameter('agent',$agent) ->andWhere('fiche.histoDestruction IS NULL') ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs fiche de postes actives associés à l'agent [".$agent->getId()."|".$agent->getDenomination()."]",0,$e); } return $result; } } No newline at end of file
module/Application/view/application/fiche-poste/editer.phtml +2 Changes for module/Application/view/application/fiche-poste/editer.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ $this->headTitle("Modification de la fiche de poste #".$fiche->getId()); a.action {width: 18em;} </style> <?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?> <div class="row"> <div class="col-md-9"> <h1 class="page-header"> Loading
module/Application/view/application/fiche-poste/partial/environnement-poste.phtml +2 Changes for module/Application/view/application/fiche-poste/partial/environnement-poste.phtml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -16,10 +16,12 @@ $canModifier = $this->isAllowed($fiche, FichePostePrivileges::FICHEPOSTE_MODIFIE $poste = $fiche->getPoste(); /** @var Structure[] $structures */ $structures = []; if ($agent !== null) { foreach ($agent->getGradesActifs() as $agentGrade) { $structure = $agentGrade->getStructure(); if ($structure !== null) $structures[] = $structure; } } ?> Loading
module/Application/view/application/structure/partial/agents.phtml +1 −1 Changes for module/Application/view/application/structure/partial/agents.phtml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ $canDetruireFichePoste = $this->isAllowed(FichePostePrivileges::getResource <?php if($fiche === null) : ?> <?php if ($canAjouterFichePoste) : ?> <a <?php /** @see \Application\Controller\FichePosteController::afficherAction() */ ?> <?php /** @see \Application\Controller\FichePosteController::ajouterAction() */ ?> href="<?php echo $this->url('fiche-poste/ajouter', ['agent' => $agent->getId()], [], true); ?>" target="_blank" ><span class="icon ajouter" Loading