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

AssocierAgent réactiver

parent 15a20de4
Loading
Loading
Loading
Loading
+8
Changes for module/Application/src/Application/Controller/FichePosteController.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -336,10 +336,18 @@ class FichePosteController extends AbstractActionController {
        if ($request->isPost()) {
            $data = $request->getPost();
            $form->setData($data);

            $agentId = $form->get('agent')->getValue();
            $agent = $this->getAgentService()->getAgent($agentId);
            $fiche_old = $this->getFichePosteService()->getFichePosteByAgent($agent);
            if ($fiche_old !== null) {
                $this->flashMessenger()->addErrorMessage("Cet agent est déjà associé à une fiche de poste active.");
            } else {
                if ($form->isValid()) {
                    $this->getFichePosteService()->update($fiche);
                }
            }
        }

        $vm = new ViewModel();
        $vm->setTemplate('application/default/default-form');
+3 −2
Changes for module/Application/view/application/fiche-poste/editer.phtml: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -17,12 +17,13 @@ use Application\Entity\Db\Structure;
use Application\Provider\Privilege\FichePostePrivileges;


$canAssocierMetierType = true;

$canEditerSpecificte = $this->isAllowed(FichePostePrivileges::getResourceId(FichePostePrivileges::FICHEPOSTE_MODIFIER));
$canEditer = $this->isAllowed(FichePostePrivileges::getResourceId(FichePostePrivileges::FICHEPOSTE_MODIFIER));
$canEditerExpertise = true || $this->isAllowed(FichePostePrivileges::getResourceId(FichePostePrivileges::FICHEPOSTE_MODIFIER));

$canAssocierAgent = $canEditer;
$canAssocierMetierType = $canEditer;

$mode = 'edition';
$date = new DateTime();