diff --git a/config/autoload/unicaen-app.global.php b/config/autoload/unicaen-app.global.php index 479dfaa948ed4b25570889120cb38b2353763bb0..01cf554c307dd48728c90faaca1ea56c15568cc3 100644 --- a/config/autoload/unicaen-app.global.php +++ b/config/autoload/unicaen-app.global.php @@ -14,8 +14,8 @@ return [ 'app_infos' => [ 'nom' => "PrEECoG", 'desc' => "Gestion Prévisionnelle des effectifs, des emplois et des compétences", - 'version' => "0.0.3", - 'date' => "18/12/2018", + 'version' => "0.1.0", + 'date' => "24/12/2018", 'contact' => ['mail' => "dsi.applications@unicaen.fr", /*'tel' => "01 02 03 04 05"*/], 'mentionsLegales' => "http://www.unicaen.fr/acces-direct/mentions-legales/", 'informatiqueEtLibertes' => "http://www.unicaen.fr/acces-direct/informatique-et-libertes/", diff --git a/module/Application/config/merged/ressource-rh.config.php b/module/Application/config/merged/ressource-rh.config.php index 9f62e658ebe6c8e11749b395e517dc9d3e58bdf6..dcd2e23b5fe48b8d42f6caae3699792cee7c2123 100644 --- a/module/Application/config/merged/ressource-rh.config.php +++ b/module/Application/config/merged/ressource-rh.config.php @@ -8,6 +8,13 @@ use Application\Controller\RessourceRh\RessourceRhControllerFactory; use Application\Form\RessourceRh\DomaineForm; use Application\Form\RessourceRh\DomaineFormFactory; use Application\Form\RessourceRh\DomaineHydrator; +use Application\Form\RessourceRh\FonctionForm; +use Application\Form\RessourceRh\FonctionFormFactory; +use Application\Form\RessourceRh\FonctionHydrator; +use Application\Form\RessourceRh\GradeForm; +use Application\Form\RessourceRh\GradeFormFactory; +use Application\Form\RessourceRh\GradeHydrator; +use Application\Form\RessourceRh\GradeHydratorFactory; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierFamilleFormFactory; use Application\Form\RessourceRh\MetierFamilleHydrator; @@ -39,6 +46,7 @@ return [ 'controller' => RessourceRhController::class, 'action' => [ 'index', + 'get-grades-json', ], 'privileges' => [ RessourceRhPrivileges::AFFICHER, @@ -53,6 +61,8 @@ return [ 'creer-metier', 'creer-famille', 'ajouter-domaine', + 'ajouter-fonction', + 'ajouter-grade', ], 'privileges' => [ RessourceRhPrivileges::AJOUTER, @@ -67,6 +77,8 @@ return [ 'modifier-metier', 'modifier-famille', 'modifier-domaine', + 'modifier-fonction', + 'modifier-grade', ], 'privileges' => [ RessourceRhPrivileges::MODIFIER, @@ -81,6 +93,8 @@ return [ 'effacer-agent-status', 'effacer-famille', 'supprimer-domaine', + 'supprimer-fonction', + 'supprimer-grade', ], 'privileges' => [ RessourceRhPrivileges::EFFACER, @@ -341,6 +355,94 @@ return [ ], ], ], + 'fonction' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/fonction', + ], + 'may_terminate' => false, + 'child_routes' => [ + 'ajouter' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/ajouter', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'ajouter-fonction', + ], + ], + ], + 'modifier' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/modifier/:fonction', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'modifier-fonction', + ], + ], + ], + 'supprimer' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/supprimer/:fonction', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'supprimer-fonction', + ], + ], + ], + ], + ], + 'grade' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/grade', + ], + 'may_terminate' => false, + 'child_routes' => [ + 'get-grades' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/get-grades', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'get-grades-json', + ], + ], + ], + 'ajouter' => [ + 'type' => Literal::class, + 'options' => [ + 'route' => '/ajouter', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'ajouter-grade', + ], + ], + ], + 'modifier' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/modifier/:grade', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'modifier-grade', + ], + ], + ], + 'supprimer' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/supprimer/:grade', + 'defaults' => [ + 'controller' => RessourceRhController::class, + 'action' => 'supprimer-grade', + ], + ], + ], + ], + ], ], ], ], @@ -366,6 +468,8 @@ return [ MetierForm::class => MetierFormFactory::class, MetierFamilleForm::class => MetierFamilleFormFactory::class, DomaineForm::class => DomaineFormFactory::class, + FonctionForm::class => FonctionFormFactory::class, + GradeForm::class => GradeFormFactory::class, ], ], 'hydrators' => [ @@ -375,9 +479,11 @@ return [ CorrespondanceHydrator::class => CorrespondanceHydrator::class, MetierFamilleHydrator::class => MetierFamilleHydrator::class, DomaineHydrator::class => DomaineHydrator::class, + FonctionHydrator::class => FonctionHydrator::class, ], 'factories' => [ MetierHydrator::class => MetierHydratorFactory::class, + GradeHydrator::class => GradeHydratorFactory::class, ], ] diff --git a/module/Application/src/Application/Controller/Agent/AgentController.php b/module/Application/src/Application/Controller/Agent/AgentController.php index 430feea7fb95aea1fc6206f917bf53deee534b65..f6535daff108d94ba25ef2be4fb01a7ad4779f0f 100644 --- a/module/Application/src/Application/Controller/Agent/AgentController.php +++ b/module/Application/src/Application/Controller/Agent/AgentController.php @@ -53,7 +53,7 @@ class AgentController extends AbstractActionController } $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); + $vm->setTemplate('application/agent/modifier'); $vm->setVariables([ 'title' => 'Ajouter un agent', 'form' => $form, @@ -83,7 +83,7 @@ class AgentController extends AbstractActionController } $vm = new ViewModel(); - $vm->setTemplate('application/default/default-form'); + $vm->setTemplate('application/agent/modifier'); $vm->setVariables([ 'title' => 'Modifier un agent', 'form' => $form, diff --git a/module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php b/module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php index f04af69fd00224a443b58b20edd00d253aa38449..c8dfc1d142cee274feacf8c2afcd9f6e0709db70 100644 --- a/module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php +++ b/module/Application/src/Application/Controller/RessourceRh/RessourceRhController.php @@ -6,9 +6,13 @@ use Application\Entity\Db\AgentStatus; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; +use Application\Entity\Db\Fonction; +use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\MetierFamille; use Application\Form\RessourceRh\DomaineForm; +use Application\Form\RessourceRh\FonctionForm; +use Application\Form\RessourceRh\GradeForm; use Application\Form\RessourceRh\MetierFamilleForm; use Application\Form\RessourceRh\MetierForm; use Application\Form\RessourceRh\AgentStatusForm; @@ -17,6 +21,7 @@ use Application\Form\RessourceRh\CorrespondanceForm; use Application\Service\RessourceRh\RessourceRhServiceAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; +use Zend\View\Model\JsonModel; use Zend\View\Model\ViewModel; class RessourceRhController extends AbstractActionController { @@ -30,6 +35,8 @@ class RessourceRhController extends AbstractActionController { $corps = $this->getRessourceRhService()->getCorpsListe('libelle'); $familles = $this->getRessourceRhService()->getMetiersFamilles('libelle'); $domaines = $this->getRessourceRhService()->getDomaines('libelle'); + $fonctions = $this->getRessourceRhService()->getFonctions('libelle'); + $grades = $this->getRessourceRhService()->getGrades(); return new ViewModel([ 'status' => $status, @@ -38,6 +45,8 @@ class RessourceRhController extends AbstractActionController { 'familles' => $familles, 'corps' => $corps, 'domaines' => $domaines, + 'fonctions' => $fonctions, + 'grades' => $grades, ]); } @@ -136,7 +145,7 @@ class RessourceRhController extends AbstractActionController { $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ - 'title' => 'Ajouter une nouvelle correspondance', + 'title' => 'Ajouter une nouvelle catégorie', 'form' => $form, ]); return $vm; @@ -165,7 +174,7 @@ class RessourceRhController extends AbstractActionController { $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ - 'title' => 'Éditer une correspondance', + 'title' => 'Éditer une catégorie', 'form' => $form, ]); return $vm; @@ -470,4 +479,171 @@ class RessourceRhController extends AbstractActionController { $this->redirect()->toRoute('ressource-rh', [], [], true); } + /** FONCTION ******************************************************************************************************/ + + public function ajouterFonctionAction() + { + /** @var Fonction $fonction */ + $fonction = new Fonction(); + + /** @var FonctionForm $form */ + $form = $this->getServiceLocator()->get('FormElementManager')->get(FonctionForm::class); + $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/fonction/ajouter', [], [], true)); + $form->bind($fonction); + + /** @var Request $request */ + $request = $this->getRequest(); + if ($request->isPost()) { + $data = $request->getPost(); + $form->setData($data); + if ($form->isValid()) { + $this->getRessourceRhService()->createFonction($fonction); + } + } + + $vm = new ViewModel(); + $vm->setTemplate('application/default/default-form'); + $vm->setVariables([ + 'title' => 'Ajouter une fonction', + 'form' => $form, + ]); + return $vm; + } + + public function modifierFonctionAction() + { + /** @var Fonction $fonction */ + $fonctionId = $this->params()->fromRoute('fonction'); + $fonction = $this->getRessourceRhService()->getFonction($fonctionId); + + /** @var FonctionForm $form */ + $form = $this->getServiceLocator()->get('FormElementManager')->get(FonctionForm::class); + $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/fonction/modifier', ['fonction' => $fonction->getId()], [], true)); + $form->bind($fonction); + + /** @var Request $request */ + $request = $this->getRequest(); + if ($request->isPost()) { + $data = $request->getPost(); + $form->setData($data); + if ($form->isValid()) { + $this->getRessourceRhService()->updateFonction($fonction); + } + } + + $vm = new ViewModel(); + $vm->setTemplate('application/default/default-form'); + $vm->setVariables([ + 'title' => 'Modifier une fonction', + 'form' => $form, + ]); + return $vm; + } + + public function supprimerFonctionAction() + { + /** @var Fonction $fonction */ + $fonctionId = $this->params()->fromRoute('fonction'); + $fonction = $this->getRessourceRhService()->getFonction($fonctionId); + + if ($fonction !== null) { + $this->getRessourceRhService()->deleteFonction($fonction); + } + + $this->redirect()->toRoute('ressource-rh', [], [], true); + } + + /** Grade ******************************************************************************************************/ + + public function ajouterGradeAction() + { + /** @var Grade $grade */ + $grade = new Grade(); + + /** @var GradeForm $form */ + $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); + $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/ajouter', [], [], true)); + $form->bind($grade); + + /** @var Request $request */ + $request = $this->getRequest(); + if ($request->isPost()) { + $data = $request->getPost(); + $form->setData($data); + if ($form->isValid()) { + $this->getRessourceRhService()->createGrade($grade); + } + } + + $vm = new ViewModel(); + $vm->setTemplate('application/default/default-form'); + $vm->setVariables([ + 'title' => 'Ajouter un grade', + 'form' => $form, + ]); + return $vm; + } + + public function modifierGradeAction() + { + /** @var Grade $grade */ + $gradeId = $this->params()->fromRoute('grade'); + $grade = $this->getRessourceRhService()->getGrade($gradeId); + + /** @var GradeForm $form */ + $form = $this->getServiceLocator()->get('FormElementManager')->get(GradeForm::class); + $form->setAttribute('action', $this->url()->fromRoute('ressource-rh/grade/modifier', ['grade' => $grade->getId()], [], true)); + $form->bind($grade); + + /** @var Request $request */ + $request = $this->getRequest(); + if ($request->isPost()) { + $data = $request->getPost(); + $form->setData($data); + if ($form->isValid()) { + $this->getRessourceRhService()->updateGrade($grade); + } + } + + $vm = new ViewModel(); + $vm->setTemplate('application/default/default-form'); + $vm->setVariables([ + 'title' => 'Modifier un grade', + 'form' => $form, + ]); + return $vm; + } + + public function supprimerGradeAction() + { + /** @var Grade $grade */ + $gradeId = $this->params()->fromRoute('grade'); + $grade = $this->getRessourceRhService()->getGrade($gradeId); + + if ($grade !== null) { + $this->getRessourceRhService()->deleteGrade($grade); + } + + $this->redirect()->toRoute('ressource-rh', [], [], true); + } + + public function getGradesJsonAction() + { + $grades = $this->getRessourceRhService()->getGrades(); + + $result = []; + foreach ($grades as $grade) { + $result[$grade->getId()] = [ + 'id' => $grade->getId(), + 'corps' => $grade->getCorps()->getId(), + 'libelle' => $grade->getLibelle(), + ]; + } + $jm = new JsonModel( + $result + ); + return $jm; + + } + } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Agent.php b/module/Application/src/Application/Entity/Db/Agent.php index 79b665363011eadf797143dcf251bb032fb4f304..2086f9261a4953f897b63d9f8f8703d79ace3ef9 100644 --- a/module/Application/src/Application/Entity/Db/Agent.php +++ b/module/Application/src/Application/Entity/Db/Agent.php @@ -3,7 +3,6 @@ namespace Application\Entity\Db; use DateTime; -use Doctrine\Common\Collections\ArrayCollection; class Agent { @@ -30,16 +29,13 @@ class Agent { private $correspondance; /** @var Corps */ private $corps; + /** @var Grade */ + private $grade; + /** @var string */ private $missionsComplementaires; - - public function __construct() - { - $this->missionsComplementaires = new ArrayCollection(); - } - /** * @return int */ @@ -233,6 +229,25 @@ class Agent { return $this; } + /** + * @return Grade + */ + public function getGrade() + { + return $this->grade; + } + + /** + * @param Grade $grade + * @return Agent + */ + public function setGrade($grade) + { + $this->grade = $grade; + return $this; + } + + } \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/FicheMetier.php b/module/Application/src/Application/Entity/Db/FicheMetier.php index 17a3b438c8da726f656b858b0d1da61a6c46a436..8bc0919434a4d83b787cf61259313faeac625ec5 100644 --- a/module/Application/src/Application/Entity/Db/FicheMetier.php +++ b/module/Application/src/Application/Entity/Db/FicheMetier.php @@ -12,8 +12,6 @@ class FicheMetier private $id; /** @var string */ private $libelle; - /** @var Affectation */ - private $affectation; /** @var Agent */ private $agent; @@ -47,24 +45,6 @@ class FicheMetier return $this; } - /** - * @return Affectation - */ - public function getAffectation() - { - return $this->affectation; - } - - /** - * @param Affectation $affectation - * @return FicheMetier - */ - public function setAffectation($affectation) - { - $this->affectation = $affectation; - return $this; - } - /** * @return Agent */ diff --git a/module/Application/src/Application/Entity/Db/Fonction.php b/module/Application/src/Application/Entity/Db/Fonction.php new file mode 100644 index 0000000000000000000000000000000000000000..7338a62f0cc5206583c96996bd9805aa5e4bcdb4 --- /dev/null +++ b/module/Application/src/Application/Entity/Db/Fonction.php @@ -0,0 +1,39 @@ +<?php + +namespace Application\Entity\Db; + +class Fonction { + + /** @var integer */ + private $id; + /** @var string */ + private $libelle; + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getLibelle() + { + return $this->libelle; + } + + /** + * @param string $libelle + * @return Fonction + */ + public function setLibelle($libelle) + { + $this->libelle = $libelle; + return $this; + } + + +}; \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Grade.php b/module/Application/src/Application/Entity/Db/Grade.php new file mode 100644 index 0000000000000000000000000000000000000000..49b5a174ee2cae181ccc634b71369f5b83305e9e --- /dev/null +++ b/module/Application/src/Application/Entity/Db/Grade.php @@ -0,0 +1,84 @@ +<?php + +namespace Application\Entity\Db; + +class Grade { + + /** @var integer */ + private $id; + /** @var Corps */ + private $corps; + /** @var string */ + private $libelle; + /** @var integer */ + private $rang; + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @return Corps + */ + public function getCorps() + { + return $this->corps; + } + + /** + * @param Corps $corps + * @return Grade + */ + public function setCorps($corps) + { + $this->corps = $corps; + return $this; + } + + /** + * @return string + */ + public function getLibelle() + { + return $this->libelle; + } + + /** + * @param string $libelle + * @return Grade + */ + public function setLibelle($libelle) + { + $this->libelle = $libelle; + return $this; + } + + public function __toString() + { + $texte = $this->getCorps()->getLibelle() . " ". $this->getLibelle(); + return $texte; + } + + /** + * @return int + */ + public function getRang() + { + return $this->rang; + } + + /** + * @param int $rang + * @return Grade + */ + public function setRang($rang) + { + $this->rang = $rang; + return $this; + } + + +} \ No newline at end of file diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml index 654d41e0bad33fc72dfa383c7c805c0a0ccb960c..84984c071d02d46378a4a94351c1952e9607726f 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Agent.dcm.xml @@ -23,6 +23,9 @@ <many-to-one target-entity="Application\Entity\Db\Corps" field="corps"> <join-column name="corps" referenced-column-name="id" /> </many-to-one> + <many-to-one target-entity="Application\Entity\Db\Grade" field="grade"> + <join-column name="grade" referenced-column-name="id" /> + </many-to-one> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetier.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetier.dcm.xml index 7f6704246f4317e534de347e92bcff50bfb4e004..fe404c5a2103161f42ffe954ffabc7f510b849b0 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetier.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.FicheMetier.dcm.xml @@ -7,11 +7,6 @@ </id> <field name="libelle" type="string" length="256" column="libelle" nullable="false"/> - - <many-to-one target-entity="Application\Entity\Db\Affectation" field="affectation"> - <join-column name="affectation" referenced-column-name="id"/> - </many-to-one> - <field name="histoCreation" type="datetime" column="histo_creation" nullable="false"/> <field name="histoModification" type="datetime" column="histo_modification" nullable="false"/> <field name="histoDestruction" type="datetime" column="histo_destruction" nullable="true"/> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Fonction.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Fonction.dcm.xml new file mode 100644 index 0000000000000000000000000000000000000000..98b097c571739920397e96e1771560e6794293ea --- /dev/null +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Fonction.dcm.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> + <entity name="Application\Entity\Db\Fonction" table="fonction"> + + <id name="id" type="integer" column="id"> + <generator strategy="IDENTITY"/> + </id> + + <field name="libelle" type="string" length="255" column="libelle" nullable="false"/> + + </entity> +</doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml new file mode 100644 index 0000000000000000000000000000000000000000..0ecbc96eae6e3484d52103c496b7c67cf01c4daa --- /dev/null +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Grade.dcm.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> + <entity name="Application\Entity\Db\Grade" table="grade"> + + <id name="id" type="integer" column="id"> + <generator strategy="IDENTITY"/> + </id> + + <field name="libelle" type="string" length="256" column="libelle" nullable="false" /> + <field name="rang" type="integer" column="rang" nullable="true" /> + <many-to-one target-entity="Application\Entity\Db\Corps" field="corps"> + <join-column name="corps" referenced-column-name="id" /> + </many-to-one> + + </entity> +</doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Poste.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Poste.dcm.xml index 93338d7a1a64160879c9d1624c2bc91d4093187a..a310cfd072c1415d0d8eb91aef925e0ef9a14630 100644 --- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Poste.dcm.xml +++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Poste.dcm.xml @@ -8,6 +8,7 @@ <field name="numeroPoste" type="string" length="128" column="numero_poste" nullable="true"/> <field name="localisation" type="string" length="128" column="localisation" nullable="true"/> + <field name="lien" type="string" length="256" column="lien" nullable="true"/> <many-to-one target-entity="Application\Entity\Db\Agent" field="rattachementHierarchique"> <join-column name="rattachement_hierarchique" referenced-column-name="id" /> @@ -21,6 +22,9 @@ <many-to-one target-entity="Application\Entity\Db\Domaine" field="domaine"> <join-column name="domaine" referenced-column-name="id" /> </many-to-one> + <many-to-one target-entity="Application\Entity\Db\Fonction" field="fonction"> + <join-column name="fonction" referenced-column-name="id" /> + </many-to-one> </entity> </doctrine-mapping> diff --git a/module/Application/src/Application/Entity/Db/Poste.php b/module/Application/src/Application/Entity/Db/Poste.php index 0752c361eb44605f31175d5af83e1ede89e18f64..c6d95046298bf9f3e44299da51ff2cb6f9506dc9 100644 --- a/module/Application/src/Application/Entity/Db/Poste.php +++ b/module/Application/src/Application/Entity/Db/Poste.php @@ -18,6 +18,10 @@ class Poste { private $rattachementHierarchique; /** @var Domaine */ private $domaine; + /** @var string */ + private $lien; + /** @var Fonction */ + private $fonction; /** * @return int @@ -135,5 +139,39 @@ class Poste { return $this; } + /** + * @return string + */ + public function getLien() + { + return $this->lien; + } + + /** + * @param string $lien + * @return Poste + */ + public function setLien($lien) + { + $this->lien = $lien; + return $this; + } + + /** + * @return Fonction + */ + public function getFonction() + { + return $this->fonction; + } + /** + * @param Fonction $fonction + * @return Poste + */ + public function setFonction($fonction) + { + $this->fonction = $fonction; + return $this; + } } \ No newline at end of file diff --git a/module/Application/src/Application/Form/Agent/AgentForm.php b/module/Application/src/Application/Form/Agent/AgentForm.php index c61d070d2a1f152986b0bc0496ea9a21e8e23d4d..114769c0d5d7ce5469c0009afe280743426925db 100644 --- a/module/Application/src/Application/Form/Agent/AgentForm.php +++ b/module/Application/src/Application/Form/Agent/AgentForm.php @@ -5,6 +5,7 @@ namespace Application\Form\Agent; use Application\Entity\Db\AgentStatus; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; +use Application\Entity\Db\Grade; use DoctrineModule\Form\Element\ObjectSelect; use UnicaenApp\Form\Element\Date; use UnicaenApp\Service\EntityManagerAwareTrait; @@ -98,9 +99,6 @@ class AgentForm extends Form { '70' => ' 70 % ', '60' => ' 60 % ', '50' => ' 50 % ', - '40' => ' 40 % ', - '30' => ' 30 % ', - '20' => ' 20 % ', ], ], 'attributes' => [ @@ -153,7 +151,7 @@ class AgentForm extends Form { 'id' => 'correspondance', ], ]); - // Status + // Corps $this->add([ 'type' => ObjectSelect::class, 'name' => 'corps', @@ -176,6 +174,29 @@ class AgentForm extends Form { 'id' => 'corps', ], ]); + // Grade + $this->add([ + 'type' => ObjectSelect::class, + 'name' => 'grade', + 'options' => [ + 'label' => "Grade* :", + 'empty_option' => "Sélectionner un grade ...", + 'object_manager' => $this->getEntityManager(), + 'target_class' => Grade::class, + 'property' => 'libelle', + 'find_method' => [ + 'name' => 'findBy', + 'params' => [ + 'criteria' => [], + 'orderBy' => ['libelle' => 'ASC'], + ], + ], + 'disable_inarray_validator' => true, + ], + 'attributes' => [ + 'id' => 'grade', + ], + ]); // description $this->add([ @@ -235,6 +256,9 @@ class AgentForm extends Form { 'corps' => [ 'required' => true, ], + 'grade' => [ + 'required' => true, + ], 'missions' => [ 'required' => false, ], diff --git a/module/Application/src/Application/Form/Agent/AgentHydrator.php b/module/Application/src/Application/Form/Agent/AgentHydrator.php index 1a36a143abb70f8094b46095476c079ff69e0545..28e23206a63d574d09e9812eae4ae2d85ab52e33 100644 --- a/module/Application/src/Application/Form/Agent/AgentHydrator.php +++ b/module/Application/src/Application/Form/Agent/AgentHydrator.php @@ -26,6 +26,7 @@ class AgentHydrator implements HydratorInterface { 'status' => $object->getStatus(), 'correspondance' => $object->getCorrespondance(), 'corps' => $object->getCorps(), + 'grade' => $object->getGrade(), 'description' => $object->getMissionsComplementaires(), ]; @@ -42,6 +43,7 @@ class AgentHydrator implements HydratorInterface { $status = $this->getRessourceRhService()->getAgentStatus($data['status']); $correspondance = $this->getRessourceRhService()->getCorrespondance($data['correspondance']); $corps = $this->getRessourceRhService()->getCorps($data['corps']); + $grade = $this->getRessourceRhService()->getGrade($data['grade']); $object->setPrenom($data['prenom']); $object->setNom($data['nom']); @@ -58,6 +60,7 @@ class AgentHydrator implements HydratorInterface { $object->setStatus($status); $object->setCorrespondance($correspondance); $object->setCorps($corps); + $object->setGrade($grade); $object->setMissionsComplementaires($data['description']); return $object; diff --git a/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationForm.php b/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationForm.php index 1e96a110421ac693dc8cf740101789fb025fc535..2f3b83b2f702b7e1483379fdb2ae17af394cad06 100644 --- a/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationForm.php +++ b/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationForm.php @@ -2,15 +2,11 @@ namespace Application\Form\FicheMetier; -use Application\Entity\Db\Affectation; -use DoctrineModule\Form\Element\ObjectSelect; -use UnicaenApp\Service\EntityManagerAwareTrait; use Zend\Form\Element\Button; use Zend\Form\Element\Text; use Zend\Form\Form; class FicheMetierCreationForm extends Form { - use EntityManagerAwareTrait; public function init() { @@ -25,29 +21,6 @@ class FicheMetierCreationForm extends Form { 'id' => 'libelle', ], ]); - //Selection obligatoire AFFECTATION - $this->add([ - 'type' => ObjectSelect::class, - 'name' => 'affectation', - 'options' => [ - 'label' => "Service/composante/direction d'affectation :", - 'empty_option' => "Sélectionner une affectation", - 'object_manager' => $this->getEntityManager(), - 'target_class' => Affectation::class, - 'property' => 'libelle', - 'find_method' => [ - 'name' => 'findBy', - 'params' => [ - 'criteria' => [], - 'orderBy' => ['libelle' => 'ASC'], - ], - ], - 'disable_inarray_validator' => true, - ], - 'attributes' => [ - 'id' => 'affectation', - ], - ]); // submit $this->add([ diff --git a/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationHydrator.php b/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationHydrator.php index 55ac5a73a1859cf1dfc76c1e1c1bc1a541f86e61..2268f86e9f0fcc70b938b4e9f33eafa13eb79f2e 100644 --- a/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationHydrator.php +++ b/module/Application/src/Application/Form/FicheMetier/FicheMetierCreationHydrator.php @@ -17,7 +17,6 @@ class FicheMetierCreationHydrator implements HydratorInterface { { $data = [ 'libelle' => $object->getLibelle(), - 'affectation' => ($object->getAffectation())?$object->getAffectation()->getId():null, ]; return $data; @@ -33,7 +32,6 @@ class FicheMetierCreationHydrator implements HydratorInterface { $affectation = $this->getAffectationService()->getAffectation($data['affectation']); $object->setLibelle($data['libelle']); - $object->setAffectation($affectation); return $object; } diff --git a/module/Application/src/Application/Form/Poste/PosteForm.php b/module/Application/src/Application/Form/Poste/PosteForm.php index 0386d404dc9672a1725b2c46ea98a60464c95921..c687c429771c989b3d24bf9311a81dc3744560e1 100644 --- a/module/Application/src/Application/Form/Poste/PosteForm.php +++ b/module/Application/src/Application/Form/Poste/PosteForm.php @@ -4,6 +4,7 @@ namespace Application\Form\Poste; use Application\Entity\Db\Affectation; use Application\Entity\Db\Domaine; +use Application\Entity\Db\Fonction; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\RessourceRh\RessourceRhServiceAwareTrait; use DoctrineModule\Form\Element\ObjectSelect; @@ -71,7 +72,7 @@ class PosteForm extends Form { 'type' => Select::class, 'name' => 'correspondance', 'options' => [ - 'label' => "Correspondance :", + 'label' => "Catégorie :", 'value_options' => $this->generateCorrespondanceSelectOptions(), ], 'attributes' => [ @@ -116,6 +117,42 @@ class PosteForm extends Form { ], ]); + // domaine + $this->add([ + 'type' => ObjectSelect::class, + 'name' => 'fonction', + 'options' => [ + 'label' => "Fonction :", + 'empty_option' => "Sélectionner une fonction", + 'object_manager' => $this->getEntityManager(), + 'target_class' => Fonction::class, + 'property' => 'libelle', + 'find_method' => [ + 'name' => 'findBy', + 'params' => [ + 'criteria' => [], + 'orderBy' => ['libelle' => 'ASC'], + ], + ], + 'disable_inarray_validator' => true, + ], + 'attributes' => [ + 'id' => 'fonction', + ], + ]); + + // liens exterieur vers fiche de poste + $this->add([ + 'type' => Text::class, + 'name' => 'lien', + 'options' => [ + 'label' => "Lien externe ver la fiche de poste :", + ], + 'attributes' => [ + 'id' => 'lien', + ], + ]); + // button $this->add([ 'type' => Button::class, diff --git a/module/Application/src/Application/Form/Poste/PosteHydrator.php b/module/Application/src/Application/Form/Poste/PosteHydrator.php index cab10e20ef7b68b9d92bf77a06b817651465c94c..8cb0382433631932487a80b63ecad621eca8b0d9 100644 --- a/module/Application/src/Application/Form/Poste/PosteHydrator.php +++ b/module/Application/src/Application/Form/Poste/PosteHydrator.php @@ -26,6 +26,8 @@ class PosteHydrator implements HydratorInterface { 'correspondance' => ($object->getCorrespondance())?$object->getCorrespondance()->getId():null, 'rattachement' => ($object->getRattachementHierarchique())?$object->getRattachementHierarchique()->getId():null, 'domaine' => ($object->getDomaine())?$object->getDomaine()->getId():null, + 'fonction' => ($object->getFonction())?$object->getFonction()->getId():null, + 'lien' => $object->getLien(), ]; return $data; } @@ -41,6 +43,7 @@ class PosteHydrator implements HydratorInterface { $correspondance = $this->getRessourceRhService()->getCorrespondance($data['correspondance']); $rattachement = $this->getAgentService()->getAgent($data['rattachement']); $domaine = $this->getRessourceRhService()->getDomaine($data['domaine']); + $fonction = $this->getRessourceRhService()->getFonction($data['fonction']); $object->setNumeroPoste($data['numero_poste']); $object->setLocalisation($data['localisation']); @@ -48,6 +51,8 @@ class PosteHydrator implements HydratorInterface { $object->setCorrespondance($correspondance); $object->setRattachementHierarchique($rattachement); $object->setDomaine($domaine); + $object->setFonction($fonction); + $object->setLien($data['lien']); return $object; } diff --git a/module/Application/src/Application/Form/RessourceRh/FonctionForm.php b/module/Application/src/Application/Form/RessourceRh/FonctionForm.php new file mode 100644 index 0000000000000000000000000000000000000000..32a9cff4a607a2fbc9dd775fe4ab0fc16cdf7482 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/FonctionForm.php @@ -0,0 +1,40 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Zend\Form\Element\Button; +use Zend\Form\Element\Text; +use Zend\Form\Form; + +class FonctionForm extends Form { + + public function init() + { + // libelle + $this->add([ + 'type' => Text::class, + 'name' => 'libelle', + 'options' => [ + 'label' => "Libelle :", + ], + 'attributes' => [ + 'id' => 'libelle', + ], + ]); + // button + $this->add([ + 'type' => Button::class, + 'name' => 'creer', + 'options' => [ + 'label' => '<i class="fas fa-save"></i> Enregistrer la fonction', + 'label_options' => [ + 'disable_html_escape' => true, + ], + ], + 'attributes' => [ + 'type' => 'submit', + 'class' => 'btn btn-primary', + ], + ]); + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/FonctionFormFactory.php b/module/Application/src/Application/Form/RessourceRh/FonctionFormFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..15478cad6b6c126d730a4e4eb0855f05497dae63 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/FonctionFormFactory.php @@ -0,0 +1,20 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Zend\Form\FormElementManager; + +class FonctionFormFactory { + + public function __invoke(FormElementManager $manager) + { + /** @var FonctionHydrator $hydrator */ + $hydrator = $manager->getServiceLocator()->get('HydratorManager')->get(FonctionHydrator::class); + + $form = new FonctionForm(); + $form->init(); + $form->setHydrator($hydrator); + + return $form; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/FonctionHydrator.php b/module/Application/src/Application/Form/RessourceRh/FonctionHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..309c6651592ed13d7817f36cf8aa111551a71329 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/FonctionHydrator.php @@ -0,0 +1,33 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Application\Entity\Db\Fonction; +use Zend\Stdlib\Hydrator\HydratorInterface; + +class FonctionHydrator implements HydratorInterface { + + /** + * @param Fonction $object + * @return array + */ + public function extract($object) + { + $data = [ + 'libelle' => $object->getLibelle(), + ]; + return $data; + } + + /** + * @param array $data + * @param Fonction $object + * @return Fonction + */ + public function hydrate(array $data, $object) + { + $object->setLibelle($data['libelle']); + return $object; + } + +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/GradeForm.php b/module/Application/src/Application/Form/RessourceRh/GradeForm.php new file mode 100644 index 0000000000000000000000000000000000000000..03ee6434b3423ff0574357c3d8be95f35e20c726 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/GradeForm.php @@ -0,0 +1,78 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Application\Entity\Db\Corps; +use DoctrineModule\Form\Element\ObjectSelect; +use UnicaenApp\Service\EntityManagerAwareTrait; +use Zend\Form\Element\Button; +use Zend\Form\Element\Text; +use Zend\Form\Form; + +class GradeForm extends Form { + use EntityManagerAwareTrait; + + public function init() + { + // Status + $this->add([ + 'type' => ObjectSelect::class, + 'name' => 'corps', + 'options' => [ + 'label' => "Corps* :", + 'empty_option' => "Sélectionner un corps ...", + 'object_manager' => $this->getEntityManager(), + 'target_class' => Corps::class, + 'property' => 'libelle', + 'find_method' => [ + 'name' => 'findBy', + 'params' => [ + 'criteria' => [], + 'orderBy' => ['libelle' => 'ASC'], + ], + ], + 'disable_inarray_validator' => true, + ], + 'attributes' => [ + 'id' => 'corps', + ], + ]); + // libelle + $this->add([ + 'type' => Text::class, + 'name' => 'libelle', + 'options' => [ + 'label' => "Libelle :", + ], + 'attributes' => [ + 'id' => 'libelle', + ], + ]); + // rang + $this->add([ + 'type' => Text::class, + 'name' => 'rang', + 'options' => [ + 'label' => "Rang :", + ], + 'attributes' => [ + 'id' => 'rang', + ], + ]); + // button + $this->add([ + 'type' => Button::class, + 'name' => 'creer', + 'options' => [ + 'label' => '<i class="fas fa-save"></i> Enregistrer le grade', + 'label_options' => [ + 'disable_html_escape' => true, + ], + ], + 'attributes' => [ + 'type' => 'submit', + 'class' => 'btn btn-primary', + ], + ]); + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/GradeFormFactory.php b/module/Application/src/Application/Form/RessourceRh/GradeFormFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..5380758bfea8d5ce7168e233ca36f523143c41d4 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/GradeFormFactory.php @@ -0,0 +1,20 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Zend\Form\FormElementManager; + +class GradeFormFactory { + + public function __invoke(FormElementManager $manager) + { + /** @var GradeHydrator $hydrator */ + $hydrator = $manager->getServiceLocator()->get('HydratorManager')->get(GradeHydrator::class); + + $form = new GradeForm(); + $form->init(); + $form->setHydrator($hydrator); + + return $form; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/GradeHydrator.php b/module/Application/src/Application/Form/RessourceRh/GradeHydrator.php new file mode 100644 index 0000000000000000000000000000000000000000..28464deb8ea975b27c5c90a0d44151c6c18cfcaf --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/GradeHydrator.php @@ -0,0 +1,41 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Application\Entity\Db\Grade; +use Application\Service\RessourceRh\RessourceRhServiceAwareTrait; +use Zend\Stdlib\Hydrator\HydratorInterface; + +class GradeHydrator implements HydratorInterface { + use RessourceRhServiceAwareTrait; + + /** + * @param Grade $object + * @return array + */ + public function extract($object) + { + $data = [ + 'libelle' => $object->getLibelle(), + 'rang' => $object->getRang(), + 'corps' => ($object && $object->getCorps())?$object->getCorps()->getId():0, + ]; + return $data; + } + + /** + * @param array $data + * @param Grade $object + * @return Grade + */ + public function hydrate(array $data, $object) + { + $corps = $this->getRessourceRhService()->getCorps($data['corps']); + + $object->setLibelle($data['libelle']); + $object->setRang($data['rang']); + $object->setCorps($corps); + return $object; + } + +} \ No newline at end of file diff --git a/module/Application/src/Application/Form/RessourceRh/GradeHydratorFactory.php b/module/Application/src/Application/Form/RessourceRh/GradeHydratorFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..c3876d54d5472e36810fc0af13ad6d5b4769a860 --- /dev/null +++ b/module/Application/src/Application/Form/RessourceRh/GradeHydratorFactory.php @@ -0,0 +1,22 @@ +<?php + +namespace Application\Form\RessourceRh; + +use Application\Service\RessourceRh\RessourceRhService; +use Zend\ServiceManager\ServiceLocatorInterface; + +class GradeHydratorFactory { + + public function __invoke(ServiceLocatorInterface $serviceLocator) + { + /** @var ServiceLocatorInterface $parentLocator */ + $parentLocator = $serviceLocator->getServiceLocator(); + /** @var RessourceRhService $ressourceService */ + $ressourceService = $parentLocator->get(RessourceRhService::class); + + $hydrator = new GradeHydrator(); + $hydrator->setRessourceRhService($ressourceService); + + return $hydrator; + } +} \ No newline at end of file diff --git a/module/Application/src/Application/Service/RessourceRh/RessourceRhService.php b/module/Application/src/Application/Service/RessourceRh/RessourceRhService.php index c559c02d111640e7aead174d332309db2e7d6ed2..67ce0e8e996ccb42d95f4a4f94eb024fdcab305f 100644 --- a/module/Application/src/Application/Service/RessourceRh/RessourceRhService.php +++ b/module/Application/src/Application/Service/RessourceRh/RessourceRhService.php @@ -6,6 +6,8 @@ use Application\Entity\Db\AgentStatus; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; +use Application\Entity\Db\Fonction; +use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\MetierFamille; use Doctrine\ORM\NonUniqueResultException; @@ -496,4 +498,166 @@ class RessourceRhService { } } + /** Domaine *******************************************************************************************************/ + + /** + * @param string $order + * @return Fonction[] + */ + public function getFonctions($order = null) + { + $qb = $this->getEntityManager()->getRepository(Fonction::class)->createQueryBuilder('fonction') + ; + + if ($order !== null) { + $qb = $qb->addOrderBy('fonction.'.$order, 'ASC'); + } + + $result = $qb->getQuery()->getResult(); + return $result; + } + + /** + * @param integer $id + * @return Fonction + */ + public function getFonction($id) + { + $qb = $this->getEntityManager()->getRepository(Fonction::class)->createQueryBuilder('fonction') + ->andWhere('fonction.id = :id') + ->setParameter('id', $id) + ; + + try { + $result = $qb->getQuery()->getOneOrNullResult(); + } catch (NonUniqueResultException $e) { + throw new RuntimeException("Plusieurs fonctions partagent le même identifiant [".$id."]"); + } + return $result; + } + + /** + * @param Fonction $fonction + * @return Fonction + */ + public function createFonction($fonction) + { + $this->getEntityManager()->persist($fonction); + try { + $this->getEntityManager()->flush($fonction); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la création d'une Fonction", $e); + } + return $fonction; + } + + /** + * @param Fonction $fonction + * @return Fonction + */ + public function updateFonction($fonction) + { + try { + $this->getEntityManager()->flush($fonction); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la mise à jour d'une Fonction.", $e); + } + return $fonction; + } + + /** + * @param Fonction $fonction + */ + public function deleteFonction($fonction) + { + $this->getEntityManager()->remove($fonction); + try { + $this->getEntityManager()->flush(); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la suppression d'une Fonction", $e); + } + } + + /** Grade *******************************************************************************************************/ + + /** + * @param string $order + * @return Grade[] + */ + public function getGrades($order = null) + { + $qb = $this->getEntityManager()->getRepository(Grade::class)->createQueryBuilder('grade') + ; + + if ($order !== null) { + $qb = $qb->addOrderBy('grade.'.$order, 'ASC'); + } else { + $qb = $qb->addOrderBy('grade.corps, grade.rang', 'ASC'); + } + + $result = $qb->getQuery()->getResult(); + return $result; + } + + /** + * @param integer $id + * @return Grade + */ + public function getGrade($id) + { + $qb = $this->getEntityManager()->getRepository(Grade::class)->createQueryBuilder('grade') + ->andWhere('grade.id = :id') + ->setParameter('id', $id) + ; + + try { + $result = $qb->getQuery()->getOneOrNullResult(); + } catch (NonUniqueResultException $e) { + throw new RuntimeException("Plusieurs grades partagent le même identifiant [".$id."]"); + } + return $result; + } + + /** + * @param Grade $grade + * @return Grade + */ + public function createGrade($grade) + { + $this->getEntityManager()->persist($grade); + try { + $this->getEntityManager()->flush($grade); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la création d'un Grade", $e); + } + return $grade; + } + + /** + * @param Grade $grade + * @return Grade + */ + public function updateGrade($grade) + { + try { + $this->getEntityManager()->flush($grade); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la mise à jour d'un Grade.", $e); + } + return $grade; + } + + /** + * @param Grade $grade + */ + public function deleteGrade($grade) + { + $this->getEntityManager()->remove($grade); + try { + $this->getEntityManager()->flush(); + } catch (OptimisticLockException $e) { + throw new RuntimeException("Un problème s'est produit lors de la suppression d'un Grade", $e); + } + } + } \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/AgentViewHelper.php b/module/Application/src/Application/View/Helper/AgentViewHelper.php index e9eada783c86f2fa212357d29b4018baaea35de0..0867e06d0e34ffa605315339e19569e352f0a4d5 100644 --- a/module/Application/src/Application/View/Helper/AgentViewHelper.php +++ b/module/Application/src/Application/View/Helper/AgentViewHelper.php @@ -53,6 +53,8 @@ class AgentViewHelper extends AbstractHelper $texte .= '<dd> '. $agent->getCorrespondance() .'</dd>'; $texte .= '<dt> Corps </dt>'; $texte .= '<dd> '. $agent->getCorps() .'</dd>'; + $texte .= '<dt> Grade </dt>'; + $texte .= '<dd> '. $agent->getGrade()->getLibelle() .'</dd>'; $texte .= '</dl>'; $texte .= '<br/>'; diff --git a/module/Application/src/Application/View/Helper/PosteViewHelper.php b/module/Application/src/Application/View/Helper/PosteViewHelper.php index 9b17e4af61f6e18c0cc9cb1f8ec9bc01ea4c2621..53936cd0991f2589d20550f9768fb793d58a67ab 100644 --- a/module/Application/src/Application/View/Helper/PosteViewHelper.php +++ b/module/Application/src/Application/View/Helper/PosteViewHelper.php @@ -43,10 +43,16 @@ class PosteViewHelper extends AbstractHelper $texte .= '<dd class="siham">'.$poste->getLocalisation().'</dd>'; $texte .= '<dt> Rattachement hiérarchique </dt>'; $texte .= '<dd class="siham">'.(($poste->getRattachementHierarchique())?$poste->getRattachementHierarchique()->getDenomination():"---").'</dd>'; - $texte .= '<dt> Correspondance </dt>'; + $texte .= '<dt> Catégorie </dt>'; $texte .= '<dd class="siham">'.$poste->getCorrespondance().'</dd>'; $texte .= '<dt> Domaine UNICAEN </dt>'; $texte .= '<dd class="gpeec">'.(($poste->getDomaine())?$poste->getDomaine()->getLibelle():"---").'</dd>'; + $texte .= '<dt> Fonction </dt>'; + $texte .= '<dd class="gpeec">'.(($poste->getFonction())?$poste->getFonction()->getLibelle():"---").'</dd>'; + if ($poste->getLien()) { + $texte .= '<dt> Lien externe </dt>'; + $texte .= '<dd class="gpeec"><a href="'.$poste->getLien().'">'.$poste->getLien().'</a></dd>'; + } $texte .= '</dl>'; return $texte; diff --git a/module/Application/view/application/agent/modifier.phtml b/module/Application/view/application/agent/modifier.phtml new file mode 100644 index 0000000000000000000000000000000000000000..fc2aa3bb02ddb39ec794393ba439b63ddaeaa169 --- /dev/null +++ b/module/Application/view/application/agent/modifier.phtml @@ -0,0 +1,43 @@ +<?php + +?> + + +<?php + + + +echo $this->form($form); +?> + +<script> + adaptForm(); + + $('select#corps').change(function() { + // console.log("Changement de corps : " + $(this).val()); + adaptForm(); + }); + + function adaptForm() { + let requestUrl = '<?php echo $this->url('ressource-rh/grade/get-grades'); ?>'; + + $.ajax({ + url: requestUrl, + }).done(function(data) { + let corps = $('select#corps').find(":selected").val(); + // console.log("Le corps selectionné est " + corps); + let selected = $('select#grade').find(":selected").val(); + $('select#grade').find('option:not(:first)').remove(); + $.each(data, function(index, value) { + if (value['corps'] == corps) { + if (value['id'] == selected) { + $("select#grade").append(new Option(value['libelle'], value['id'], false, true)); + } else { + $("select#grade").append(new Option(value['libelle'], value['id'], false, false)); + } + } + }); + }); + } + +</script> diff --git a/module/Application/view/application/fiche-metier/afficher.phtml b/module/Application/view/application/fiche-metier/afficher.phtml index e2db28c20cedef8fe6d43e076e6310b8dd2b04cc..8f45d2729c9b4cfe34e736460b0445cb71643546 100644 --- a/module/Application/view/application/fiche-metier/afficher.phtml +++ b/module/Application/view/application/fiche-metier/afficher.phtml @@ -21,7 +21,6 @@ $canEditer = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPr <h1 class="page-header"> Fiche métier : <?php echo $fiche->getLibelle(); ?> <br/> - Affectation : <?php echo $fiche->getAffectation(); ?> </h1> @@ -82,13 +81,13 @@ $canEditer = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPr </div> <div class="panel-body"> <h3> Affectation du poste </h3> - <?php if ($fiche->getAffectation() !== null) : ?> - <?php if ($fiche->getAffectation()->getDescription() !== null) :?> - <?php echo $fiche->getAffectation()->getDescription(); ?> + <?php if ($fiche->getPoste() !== null && $fiche->getPoste()->getAffectation() !== null) : ?> + <?php if ($fiche->getPoste()->getAffectation()->getDescription() !== null) :?> + <?php echo $fiche->getPoste()->getAffectation()->getDescription(); ?> <?php else: ?> <div class="alert alert-warning"> <i class="fas fa-exclamation-triangle"></i> - Aucune description de fournie pour l'affectation <em><?php echo $fiche->getAffectation()->getLibelle(); ?></em>. + Aucune description de fournie pour l'affectation <em><?php echo $fiche->getPoste()->getAffectation()->getLibelle(); ?></em>. </div> <?php endif; ?> <?php else : ?> diff --git a/module/Application/view/application/fiche-metier/index.phtml b/module/Application/view/application/fiche-metier/index.phtml index b780948248a9ffcee1dbfa4ce6fa4485e92c9b22..a4c7bc640591e6ca9b5fcfaf563dc31123960bd9 100644 --- a/module/Application/view/application/fiche-metier/index.phtml +++ b/module/Application/view/application/fiche-metier/index.phtml @@ -38,7 +38,6 @@ $canHistoriser = $this->isAllowed(FicheMetierPrivileges::getResourceId(Fich <tr> <th> Id </th> <th> Libellé </th> - <th> Affectation </th> <th> Dernière modification </th> <th> Action </th> </tr> @@ -48,7 +47,6 @@ $canHistoriser = $this->isAllowed(FicheMetierPrivileges::getResourceId(Fich <tr> <td> <?php echo $ficheMetier->getId(); ?></td> <td> <?php echo $ficheMetier->getLibelle(); ?></td> - <td> <?php echo $ficheMetier->getAffectation(); ?></td> <td> <?php echo $ficheMetier->getHistoModification()->format('H:i:s d/m/Y'); ?></td> <td> <?php if ($canVoir) : ?> diff --git a/module/Application/view/application/ressource-rh/index.phtml b/module/Application/view/application/ressource-rh/index.phtml index ec10ba54546fd19c46b6bf8f9c6cac75bc53830f..2d9b7dc302fa202763c203b12df6b52284a7b1f1 100644 --- a/module/Application/view/application/ressource-rh/index.phtml +++ b/module/Application/view/application/ressource-rh/index.phtml @@ -6,13 +6,17 @@ * @var Metier[] $metiers * @var MetierFamille[] $familles * @var Corps[] $corps + * @var Grade[] $grades * @var Domaine[] $domaines + * @var Fonction[] $fonctions */ use Application\Entity\Db\AgentStatus; use Application\Entity\Db\Corps; use Application\Entity\Db\Correspondance; use Application\Entity\Db\Domaine; +use Application\Entity\Db\Fonction; +use Application\Entity\Db\Grade; use Application\Entity\Db\Metier; use Application\Entity\Db\MetierFamille; use Application\Provider\Privilege\RessourceRhPrivileges; @@ -28,11 +32,13 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( <a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'status']); ?>" class="btn btn-primary action">Status</a> -<a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'correspondance']); ?>" class="btn btn-primary action">Correspondance</a> +<a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'correspondance']); ?>" class="btn btn-primary action">Catégorie</a> <a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'metier']); ?>" class="btn btn-primary action">Métier</a> <a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'famille']); ?>" class="btn btn-primary action">Famille de métier</a> <a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'corps']); ?>" class="btn btn-primary action">Corps</a> +<a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'grade']); ?>" class="btn btn-primary action">Grade</a> <a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'domaine']); ?>" class="btn btn-primary action">Domaine</a> +<a href="<?php echo $this->url('ressource-rh', [], ['fragment' => 'fonction']); ?>" class="btn btn-primary action">Fonction</a> <div class="main"> @@ -97,7 +103,7 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( <a name="correspondance"></a> <div class="col-md-8"> <h2> - Liste des correspondances + Liste des catégorie <span class="badge"> <?php echo count($correspondances); ?> </span> @@ -110,7 +116,7 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( data-event="modification" > <i class="fas fa-plus-square"></i> - Ajouter une correspondance + Ajouter une catégorie </a> <?php endif;?> </div> @@ -274,7 +280,6 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( </div> - <div class="main"> <a name="corps"></a> <div class="col-md-8"> @@ -334,6 +339,68 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( </div> +<div class="main"> + <a name="grade"></a> + <div class="col-md-8"> + <h2> + Liste des grades + <span class="badge"> + <?php echo count($grades); ?> + </span> + </h2> + </div> + + <div class="pull-right"> + <?php if ($canAjouterRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/grade/ajouter', [], [], true);?>" + class="btn btn-primary action ajax-modal" + data-event="modification" + > + <i class="fas fa-plus-square"></i> + Ajouter un grade + </a> + <?php endif;?> + </div> + + <br/> + + <table class="table table-condensed"> + <thead> + <tr> + <th> Id</th> + <th> Corps</th> + <th> Libelle</th> + <th> Progression</th> + <th class="action"> Action </th> + </tr> + </thead> + <tbody> + <?php foreach($grades as $grade): ?> + <tr> + <td> <?php echo $grade->getId(); ?> </td> + <td> <?php echo $grade->getCorps()->getLibelle(); ?> </td> + <td> <?php echo $grade->getLibelle(); ?> </td> + <td> <?php echo $grade->getRang(); ?> </td> + <td> + <?php if ($canEditerRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/grade/modifier', ['grade' => $grade->getId()], [], true); ?>" class="ajax-modal" data-event="modification"> + <i class="fas fa-pencil-alt" title="Éditer le grade"></i> + </a> + <?php endif; ?> + <?php if ($canEffacerRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/grade/supprimer', ['grade' => $grade->getId()], [], true); ?>"> + <i class="fas fa-trash-alt" title="Supprimer le grade"></i> + </a> + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + +</div> + + <div class="main"> <a name="domaine"></a> <div class="col-md-8"> @@ -391,6 +458,64 @@ $canEffacerRessource = $this->isAllowed(RessourceRhPrivileges::getResourceId( <?php endif; ?> </div> +<div class="main"> + <a name="fonction"></a> + <div class="col-md-8"> + <h2> + Liste des fonctions + <span class="badge"> + <?php echo count($fonctions); ?> + </span> + </h2> + </div> + <div class="pull-right"> + <?php if ($canAjouterRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/fonction/ajouter', [], [], true);?>" + class="btn btn-primary action ajax-modal" + data-event="modification" + > + <i class="fas fa-plus-square"></i> + Ajouter une fonction + </a> + <?php endif;?> + </div> + <?php if (count($fonctions) > 0) : ?> + <table class="table table-condensed"> + <thead> + <tr> + <th> Id </th> + <th> Libelle </th> + <th class="action"> Action </th> + </tr> + </thead> + <tbody> + <?php foreach ($fonctions as $fonction) : ?> + <tr> + <td> <?php echo $fonction->getId(); ?> </td> + <td> <?php echo $fonction->getLibelle(); ?> </td> + <td> + <?php if ($canEditerRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/fonction/modifier', ['fonction' => $fonction->getId()], [], true); ?>" + data-event="modification" + class="ajax-modal" + > + <i class="fas fa-pencil-alt" title="Éditer la fonction"></i> + </a> + <?php endif; ?> + <?php if ($canEffacerRessource) : ?> + <a href="<?php echo $this->url('ressource-rh/fonction/supprimer', ['fonction' => $fonction->getId()], [], true); ?>" > + <i class="fas fa-trash-alt" title="Effacer la fonction"></i> + </a> + <?php endif; ?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> + <?php endif; ?> +</div> + + <script> $(function() { $("body").on("modification", function (event) {