Commit 64a55088 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fiche de poste pour recrutement

parent 5fc9022d
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -7,9 +7,12 @@ Version 1.2.0 *Module de formation*

Version 1.1.5
-------------
- [Correction bug] l'encart Mes données ne marchait plus faute d'agent fourni
- Parametrage et ajout d'une adresse par défaut pour les profils de recrutement
- Refonte macro pour le profil
+ [Correction bug] l'encart Mes données ne marchait plus faute d'agent fourni
+ [Qualité de vie] Ajout d'un onglet agent sur les structures pour clarifier  
+ Parametrage et ajout d'une adresse par défaut pour les profils de recrutement
+ Refonte macro pour le profil
+ Fiche de poste pour recrutement + modification de l'association d'agent


Version 1.1.4
-------------
+12 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ return [
                    'controller' => StructureController::class,
                    'action' => [
                        'ajouter-fiche-poste-recrutement',
                        'dupliquer-fiche-poste-recrutement',
                    ],
                    'privileges' => StructurePrivileges::STRUCTURE_DESCRIPTION,
                ],
@@ -170,6 +171,17 @@ return [
                        ],
                        'may_terminate' => true,
                    ],
                    'dupliquer-fiche-poste-recrutement' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/dupliquer-fiche-poste-recrutement/:structure',
                            'defaults' => [
                                'controller' => StructureController::class,
                                'action'     => 'dupliquer-fiche-poste-recrutement',
                            ],
                        ],
                        'may_terminate' => true,
                    ],
                    'graphe' => [
                        'type'  => Segment::class,
                        'options' => [
+5 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ class FichePosteController extends AbstractActionController {

        /** @var AssocierAgentForm $form */
        $form = $this->getAssocierAgentForm();
        $form->setAttribute('action', $this->url()->fromRoute('fiche-poste/associer-agent', ['fiche-poste' => $fiche->getId()], [], true));
        $form->setAttribute('action', $this->url()->fromRoute('fiche-poste/associer-agent', ['fiche-poste' => $fiche->getId()], ['query' => ["structure" => ($structure)?$structure->getId():null, "sous-structure" => $sousstructure]], true));

        if ($structure !== null) {
            $form = $form->reinitWithStructure($structure, $sousstructure);
@@ -365,6 +365,10 @@ class FichePosteController extends AbstractActionController {
            } else {
                if ($form->isValid()) {
                    $this->getFichePosteService()->update($fiche);

                    //todo retirer des listes pour recrutement ...
                    $structure->removeFichePosteRecrutement($fiche);
                    $this->getStructureService()->update($structure);
                }
            }
        }
+54 −0
Original line number Diff line number Diff line
@@ -10,12 +10,14 @@ use Application\Form\AgentMissionSpecifique\AgentMissionSpecifiqueFormAwareTrait
use Application\Form\AjouterGestionnaire\AjouterGestionnaireForm;
use Application\Form\AjouterGestionnaire\AjouterGestionnaireFormAwareTrait;
use Application\Form\SelectionAgent\SelectionAgentFormAwareTrait;
use Application\Form\SpecificitePoste\SpecificitePosteFormAwareTrait;
use Application\Form\Structure\StructureFormAwareTrait;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\FichePoste\FichePosteServiceAwareTrait;
use Application\Service\FicheProfil\FicheProfilServiceAwareTrait;
use Application\Service\MissionSpecifique\MissionSpecifiqueAffectationServiceAwareTrait;
use Application\Service\Poste\PosteServiceAwareTrait;
use Application\Service\SpecificitePoste\SpecificitePosteServiceAwareTrait;
use Application\Service\Structure\StructureServiceAwareTrait;
use Application\Service\StructureAgentForce\StructureAgentForceServiceAwareTrait;
use DateTime;
@@ -42,6 +44,7 @@ class StructureController extends AbstractActionController {
    use StructureServiceAwareTrait;
    use StructureAgentForceServiceAwareTrait;
    use UserServiceAwareTrait;
    use SpecificitePosteServiceAwareTrait;

    use EntretienProfessionnelServiceAwareTrait;
    use CampagneServiceAwareTrait;
@@ -416,6 +419,57 @@ class StructureController extends AbstractActionController {
        return $this->redirect()->toRoute('fiche-poste/editer', ['fiche-poste' => $fiche->getId()], ["query" => ["structure" => $structure->getId()]], true);
    }

    public function dupliquerFichePosteRecrutementAction()
    {
        $structure = $this->getStructureService()->getRequestedStructure($this);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            $fiche = $this->getFichePosteService()->getFichePoste($data['fiche']);

            if ($fiche != null) {
                $nouvelleFiche = new FichePoste();
                $nouvelleFiche->setLibelle($fiche->getLibelle());
                if ($fiche->getSpecificite()) {
                    $specifite = $fiche->getSpecificite()->clone_it();
                    $this->getSpecificitePosteService()->create($specifite);
                    $nouvelleFiche->setSpecificite($specifite);
                }
                $nouvelleFiche = $this->getFichePosteService()->create($nouvelleFiche);

                //dupliquer fiche metier externe
                foreach ($fiche->getFichesMetiers() as $ficheMetierExterne) {
                    $nouvelleFicheMetier = $ficheMetierExterne->clone_it();
                    $nouvelleFicheMetier->setFichePoste($nouvelleFiche);
                    $this->getFichePosteService()->createFicheTypeExterne($nouvelleFicheMetier);
                }

                $structure->addFichePosteRecrutement($nouvelleFiche);
                $this->getStructureService()->update($structure);
            }


        }

        $structures = $this->getStructureService()->getStructuresFilles($structure);
        $structures[] = $structure;
        $fichesPostesAgent = $this->getFichePosteService()->getFichesPostesByStructures($structures);
        $fichesPostesRecrutement = $structure->getFichesPostesRecrutements();

        $fichespostes = [];
        foreach ($fichesPostesAgent as $fichePoste) $fichespostes[$fichePoste->getId()] = $fichePoste;
        foreach ($fichesPostesRecrutement as $fichePoste) $fichespostes[$fichePoste->getId()] = $fichePoste;

        $vm =  new ViewModel([
            'title' => 'Sélectionner la fiche de poste à dupliquer',
            'fichespostes' => $fichespostes,
            'url' => $this->url()->fromRoute('structure/dupliquer-fiche-poste-recrutement', ['structure' => $structure->getId()], [], true),
        ]);
        $vm->setTemplate('application/structure/dupliquer-fiche-poste');
        return $vm;
    }

    /** EXTRACTIONS ***************************************************************************************************/

    /**
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Application\Service\FichePoste\FichePosteService;
use Application\Service\FicheProfil\FicheProfilService;
use Application\Service\MissionSpecifique\MissionSpecifiqueAffectationService;
use Application\Service\Poste\PosteService;
use Application\Service\SpecificitePoste\SpecificitePosteService;
use Application\Service\Structure\StructureService;
use Application\Service\StructureAgentForce\StructureAgentForceService;
use EntretienProfessionnel\Service\Campagne\CampagneService;
@@ -34,6 +35,7 @@ class StructureControllerFactory {
         * @var MissionSpecifiqueAffectationService $missionSpecifiqueAffectationService
         * @var PosteService $posteService
         * @var RoleService $roleService
         * @var SpecificitePosteService $specificiteService
         * @var StructureService $structureService
         * @var StructureAgentForceService $structureAgentForceService
         * @var UserService $userService
@@ -47,6 +49,7 @@ class StructureControllerFactory {
        $missionSpecifiqueAffectationService = $container->get(MissionSpecifiqueAffectationService::class);
        $posteService = $container->get(PosteService::class);
        $roleService = $container->get(RoleService::class);
        $specificiteService = $container->get(SpecificitePosteService::class);
        $structureService = $container->get(StructureService::class);
        $structureAgentForceService = $container->get(StructureAgentForceService::class);
        $userService = $container->get(UserService::class);
@@ -74,6 +77,7 @@ class StructureControllerFactory {
        $controller->setMissionSpecifiqueAffectationService($missionSpecifiqueAffectationService);
        $controller->setPosteService($posteService);
        $controller->setRoleService($roleService);
        $controller->setSpecificitePosteService($specificiteService);
        $controller->setStructureService($structureService);
        $controller->setStructureAgentForceService($structureAgentForceService);
        $controller->setUserService($userService);
Loading