Commit 9c6a700f authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Debut refonte fiche metier

parent 278c9254
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ $modules = [
    'EntretienProfessionnel',
    'Carriere',
    'Metier',
    'FicheMetier',
    'Structure',
    'Formation',
    'Fichier',
+36 −25
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Application\Controller;

use Application\Entity\Db\Agent;
use Application\Entity\Db\FicheMetier;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\FicheMetier\FicheMetierServiceAwareTrait;
use Element\Entity\Db\ApplicationElement;
@@ -16,12 +15,14 @@ use Element\Service\ApplicationElement\ApplicationElementServiceAwareTrait;
use Element\Service\Competence\CompetenceServiceAwareTrait;
use Element\Service\CompetenceElement\CompetenceElementServiceAwareTrait;
use Element\Service\Niveau\NiveauServiceAwareTrait;
use FicheMetier\Entity\Db\FicheMetier;
use Formation\Service\FormationElement\FormationElementServiceAwareTrait;
use Laminas\Http\Request;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;

class ElementController extends AbstractActionController {
class ElementController extends AbstractActionController
{
    use AgentServiceAwareTrait;
    use ApplicationServiceAwareTrait;
    use ApplicationElementServiceAwareTrait;
@@ -70,7 +71,8 @@ class ElementController extends AbstractActionController {
        $elementType = $this->params()->fromRoute('type');
        $elementId = $this->params()->fromRoute('id');

        $element = null; $service = null;
        $element = null;
        $service = null;
        switch ($elementType) {
            case ElementController::TYPE_APPLICATION :
                $element = $this->getApplicationElementService()->getApplicationElement($elementId);
@@ -112,7 +114,8 @@ class ElementController extends AbstractActionController {
        $elementId = $this->params()->fromRoute('id');
        $clef = $this->params()->fromRoute('clef');

        $element = null; $service = null;
        $element = null;
        $service = null;
        switch ($elementType) {
            case ElementController::TYPE_APPLICATION :
                $element = $this->getApplicationElementService()->getApplicationElement($elementId);
@@ -155,9 +158,11 @@ class ElementController extends AbstractActionController {

        $hasApplicationElement = null;
        switch ($type) {
            case Agent::class : $hasApplicationElement = $this->getAgentService()->getRequestedAgent($this, 'id');
            case Agent::class :
                $hasApplicationElement = $this->getAgentService()->getRequestedAgent($this, 'id');
                break;
            case FicheMetier::class : $hasApplicationElement = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id');
            case FicheMetier::class :
                $hasApplicationElement = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id');
                break;
        }
        $clef = $this->params()->fromRoute('clef');
@@ -177,7 +182,9 @@ class ElementController extends AbstractActionController {
            }

            $element = new ApplicationElement();
            if ($application !== null) {$element->setApplication($application);}
            if ($application !== null) {
                $element->setApplication($application);
            }
            if ($clef === 'masquer') $form->masquerClef();

            $form->setAttribute('action', $this->url()->fromRoute('element_/ajouter-application-element',
@@ -205,10 +212,10 @@ class ElementController extends AbstractActionController {
                    }
                } else {
                    $niveau = $this->getNiveauService()->getMaitriseNiveau($data['niveau']);
                    $clef = (isset($data['clef']) AND $data['clef'] === "1");
                    $clef = (isset($data['clef']) and $data['clef'] === "1");
                    foreach ($data['application'] as $applicationId) {
                        $application = $this->getApplicationService()->getApplication($applicationId);
                        if ($application !== null AND !$hasApplicationElement->hasApplication($application)) {
                        if ($application !== null and !$hasApplicationElement->hasApplication($application)) {
                            $element = new ApplicationElement();
                            $element->setClef($clef);
                            $element->setApplication($application);
@@ -246,9 +253,11 @@ class ElementController extends AbstractActionController {

        $hasCompetenceElement = null;
        switch ($type) {
            case Agent::class : $hasCompetenceElement = $this->getAgentService()->getRequestedAgent($this, 'id');
            case Agent::class :
                $hasCompetenceElement = $this->getAgentService()->getRequestedAgent($this, 'id');
                break;
            case FicheMetier::class : $hasCompetenceElement = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id');
            case FicheMetier::class :
                $hasCompetenceElement = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id');
                break;
        }
        $clef = $this->params()->fromRoute('clef');
@@ -268,7 +277,9 @@ class ElementController extends AbstractActionController {
            }

            $element = new CompetenceElement();
            if ($competence !== null) {$element->setCompetence($competence);}
            if ($competence !== null) {
                $element->setCompetence($competence);
            }
            if ($clef === 'masquer') $form->masquerClef();

            $form->setAttribute('action', $this->url()->fromRoute('element_/ajouter-competence-element',
@@ -295,10 +306,10 @@ class ElementController extends AbstractActionController {
                    }
                } else {
                    $niveau = $this->getNiveauService()->getMaitriseNiveau($data['niveau']);
                    $clef = (isset($data['clef']) AND $data['clef'] === "1");
                    $clef = (isset($data['clef']) and $data['clef'] === "1");
                    foreach ($data['competence'] as $competenceId) {
                        $competence = $this->getCompetenceService()->getCompetence($competenceId);
                        if ($competence !== null AND !$hasCompetenceElement->hasCompetence($competence)) {
                        if ($competence !== null and !$hasCompetenceElement->hasCompetence($competence)) {
                            $element = new CompetenceElement();
                            $element->setClef($clef);
                            $element->setCompetence($competence);
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace Application\Controller;

use Application\Entity\Db\Activite;
use Application\Entity\Db\FicheMetier;
use FicheMetier\Entity\Db\FicheMetier;
use Application\Entity\Db\ParcoursDeFormation;
use Application\Form\Activite\ActiviteForm;
use Application\Form\Activite\ActiviteFormAwareTrait;
+7 −14
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ namespace Application\Controller;
use Application\Entity\Db\ActiviteDescription;
use Application\Entity\Db\Agent;
use Application\Entity\Db\Expertise;
use Application\Entity\Db\FicheMetier;
use Application\Entity\Db\FichePoste;
use Application\Entity\Db\FicheposteActiviteDescriptionRetiree;
use Application\Entity\Db\FicheTypeExterne;
@@ -35,6 +34,11 @@ use Application\Service\ParcoursDeFormation\ParcoursDeFormationServiceAwareTrait
use Application\Service\Poste\PosteServiceAwareTrait;
use Application\Service\SpecificitePoste\SpecificitePosteServiceAwareTrait;
use DateTime;
use Laminas\Http\Request;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\ViewModel;
use Mpdf\MpdfException;
use Structure\Service\Structure\StructureServiceAwareTrait;
use UnicaenApp\Exception\RuntimeException;
@@ -43,11 +47,6 @@ use UnicaenEtat\Service\Etat\EtatServiceAwareTrait;
use UnicaenPdf\Exporter\PdfExporter;
use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait;
use UnicaenValidation\Service\ValidationInstance\ValidationInstanceServiceAwareTrait;
use Laminas\Http\Request;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\ViewModel;

/** @method FlashMessenger flashMessenger() */

@@ -215,8 +214,7 @@ class FichePosteController extends AbstractActionController {
        $structureId = $this->params()->fromQuery('structure');
        $structure = $this->getStructureService()->getStructure($structureId);

        /** @var FichePoste $fiche */
        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste', false);
        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this);
        if ($fiche === null) $fiche = $this->getFichePosteService()->getLastFichePoste();

        if ($fiche->getEtat()->getCode() === FichePosteEtats::ETAT_CODE_SIGNEE) return $this->redirect()->toRoute('fiche-poste/afficher', ['structure' => $structure, 'fiche-poste' => $fiche->getId()], [] ,true);
@@ -501,7 +499,6 @@ class FichePosteController extends AbstractActionController {
                }

                //comportement par defaut (ajout de toutes les activités)
                /** @var FicheMetier */
                $activites = $ficheTypeExterne->getFicheType()->getActivites();
                $tab = [];
                foreach ($activites as $activite) {
@@ -603,11 +600,7 @@ class FichePosteController extends AbstractActionController {
        ]);
    }

    /**
     * @param FichePoste $fiche
     * @param array $data
     */
    private function checkValidite(FichePoste $fiche, $data)
    private function checkValidite(FichePoste $fiche, array $data)
    {
        $cut = false;
        if ($data['est_principale'] === "1"  && ((int) $data['quotite']) < 50) {
+3 −2
Original line number Diff line number Diff line
@@ -2,12 +2,13 @@

namespace Application\Entity\Db;

use FicheMetier\Entity\Db\FicheMetier;

class FicheMetierActivite {

    /** @var int */
    private $id;
    /** @var FicheMetier */
    private $fiche;
    private ?FicheMetier $fiche = null;
    /** @var Activite */
    private $activite;
    /** @var int */
Loading