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

Correctif des redirect pour toujours avoit un return

parent 8b683364
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ return [
                                'icon' => 'fas fa-angle-right'
                            ],
                            [
                                'label' => 'Les fiches types',
                                'label' => 'Les fiches métiers',
                                'route' => 'fiche-metier-type',
                                'privileges' => FicheMetierPrivileges::AFFICHER,
                                'dropdown-header' => true,
+3 −4
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ class ActiviteController extends AbstractActionController {

            if ($form->isValid()) {
                $this->getActiviteService()->create($activite);
//                $this->redirect()->toRoute('activite');
            }
        }

@@ -93,7 +92,7 @@ class ActiviteController extends AbstractActionController {
        $activite = $this->getActiviteService()->getRequestedActivite($this, 'activite');

        $this->getActiviteService()->historise($activite);
        $this->redirect()->toRoute('activite');
        return $this->redirect()->toRoute('activite');
    }

    public function restaurerAction()
@@ -102,7 +101,7 @@ class ActiviteController extends AbstractActionController {
        $activite = $this->getActiviteService()->getRequestedActivite($this, 'activite');

        $this->getActiviteService()->restore($activite);
        $this->redirect()->toRoute('activite');
        return $this->redirect()->toRoute('activite');
    }


@@ -112,7 +111,7 @@ class ActiviteController extends AbstractActionController {
        $activite = $this->getActiviteService()->getRequestedActivite($this, 'activite');

        $this->getActiviteService()->delete($activite);
        $this->redirect()->toRoute('activite');
        return $this->redirect()->toRoute('activite');
    }

    public function afficherAction()
+5 −12
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@ class AgentController extends AbstractActionController
    use AgentFormAwareTrait;
    use AgentImportFormAwareTrait;

    public function indexAction()
    {
    public function indexAction() {
        $agents = $this->getAgentService()->getAgents();
        return  new ViewModel([
            'agents' => $agents,
@@ -33,8 +32,7 @@ class AgentController extends AbstractActionController

    public function afficherAction() {

        $agentId = $this->params()->fromRoute('id');
        $agent = $this->getAgentService()->getAgent($agentId);
        $agent = $this->getAgentService()->getRequestedAgent($this, 'id');

        return new ViewModel([
            'title' => 'Afficher l\'agent',
@@ -73,9 +71,7 @@ class AgentController extends AbstractActionController

    public function modifierAction() {

        /** @var Agent $agent */
        $agentId = $this->params()->fromRoute('id');
        $agent = $this->getAgentService()->getAgent($agentId);
        $agent = $this->getAgentService()->getRequestedAgent($this, 'id');

        /** @var AgentForm $form */
        $form = $this->getAgentForm();
@@ -103,13 +99,11 @@ class AgentController extends AbstractActionController

    public function supprimerAction() {

        /** @var Agent $agent */
        $agentId = $this->params()->fromRoute('id');
        $agent = $this->getAgentService()->getAgent($agentId);
        $agent = $this->getAgentService()->getRequestedAgent($this, 'id');

        $this->getAgentService()->delete($agent);

        $this->redirect()->toRoute('agent', [], [], true);
        return $this->redirect()->toRoute('agent', [], [], true);
    }

    public function importerAction()
@@ -133,7 +127,6 @@ class AgentController extends AbstractActionController
                    if ($affectation->getDateFin()) var_dump($affectation->getDateFin()->format('d/m/Y'));
                }
            }
            //$this->redirect()->toRoute('agent/importer');
        }

        return new ViewModel([
+2 −2
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class AgentFichierController extends AbstractActionController {
            $agent = $this->getAgentService()->getAgentByUser($user);

            if ($agent !== null) {
                $this->redirect()->toRoute('agent/fichiers', ['agent' => $agent->getId()], [], true);
                return $this->redirect()->toRoute('agent/fichiers', ['agent' => $agent->getId()], [], true);
            } else {
                throw new RuntimeException("L'utilisateur connecté n'est pas associté à un agent !");
            }
@@ -83,7 +83,7 @@ class AgentFichierController extends AbstractActionController {
                $agent->addFichier($fichier);
                $this->getAgentService()->update($agent);

                $this->redirect()->toRoute('agent/fichiers', ['agent' => $agent->getId()], [], true);
                return $this->redirect()->toRoute('agent/fichiers', ['agent' => $agent->getId()], [], true);
            }
        }

+6 −14
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ class ApplicationController extends AbstractActionController {
    public function indexAction()
    {
        /** @var Application[] $activites */
        $applications = $this->getApplicationService()->getApplications('id');
        $applications = $this->getApplicationService()->getApplications('libelle');

        return new ViewModel([
            'applications' => $applications,
@@ -44,7 +44,6 @@ class ApplicationController extends AbstractActionController {

            if ($form->isValid()) {
                $this->getApplicationService()->create($application);
                //$this->redirect()->toRoute('application');
            }
        }

@@ -76,7 +75,6 @@ class ApplicationController extends AbstractActionController {

            if ($form->isValid()) {
                $this->getApplicationService()->update($application);
                //$this->redirect()->toRoute('application');
            }
        }

@@ -91,31 +89,25 @@ class ApplicationController extends AbstractActionController {

    public function effacerAction()
    {
        /** @var Application $application */
        $applicationId = $this->params()->fromRoute('id');
        $application = $this->getApplicationService()->getApplication($applicationId);
        $application = $this->getApplicationService()->getRequestedApplication($this, 'id');

        $this->getApplicationService()->delete($application);
        $this->redirect()->toRoute('application');
        return $this->redirect()->toRoute('application');
    }

    public function changerStatusAction()
    {
        /** @var Application $application */
        $applicationId = $this->params()->fromRoute('id');
        $application = $this->getApplicationService()->getApplication($applicationId);
        $application = $this->getApplicationService()->getRequestedApplication($this, 'id');

        $application->setActif( !$application->isActif() );

        $this->getApplicationService()->update($application);
        $this->redirect()->toRoute('application');
        return $this->redirect()->toRoute('application');
    }

    public function afficherAction()
    {
        /** @var Application $application */
        $applicationId = $this->params()->fromRoute('id');
        $application = $this->getApplicationService()->getApplication($applicationId);
        $application = $this->getApplicationService()->getRequestedApplication($this, 'id');

        return new ViewModel([
            'title' => "Description de l'application",
Loading