Commit bb004bed authored by Jean-Baptiste Oellers's avatar Jean-Baptiste Oellers
Browse files

Ajout réponse

parent 40efeb3a
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -633,6 +633,22 @@ return array(
                    ],
                    'roles' => ['user']
                ],

                [
                    'controller' => 'ConventionModele',
                    'action' => [
                        'instancier',
                    ],
                    'roles' => ['user']
                ],

                [
                    'controller' => 'ConventionModeleInstance',
                    'action' => [
                        'afficher',
                    ],
                    'roles' => ['user']
                ],
            ]
        ],
    ],
@@ -677,6 +693,7 @@ return array(
            \Oscar\Service\ContractDocumentService::class => \Oscar\Service\ContractDocumentServiceFactory::class,
            \Oscar\Service\ConventionModeleService::class => \Oscar\Service\ConventionModeleServiceFactory::class,
            \Oscar\Service\ConventionModeleEtapeService::class => \Oscar\Service\ConventionModeleEtapeServiceFactory::class,
            \Oscar\Service\ConventionModeleInstanceService::class => \Oscar\Service\ConventionModeleInstanceServiceFactory::class,
            \Oscar\Service\DocumentFormatterService::class => \Oscar\Service\DocumentFormatterServiceFactory::class,
            \Oscar\Service\Fixture\FixtureService::class => \Oscar\Service\Fixture\FixtureServiceFactory::class,
            \Oscar\Service\GearmanJobLauncherService::class => \Oscar\Service\GearmanJobLauncherServiceFactory::class,
@@ -742,8 +759,10 @@ return array(
            'CheminDecisionnelAdministration' => \Oscar\Controller\CheminDecisionnelAdministrationControllerFactory::class,
            'Codenaf' => \Oscar\Controller\CodenafControllerFactory::class,
            'Connector' => \Oscar\Controller\ConnectorControllerFactory::class,
            'ConventionModele' => \Oscar\Controller\ConventionModeleControllerFactory::class,
            'ConventionModeleAdministration' => \Oscar\Controller\ConventionModeleAdministrationControllerFactory::class,
            'ConventionModeleEtapeAdministration' => \Oscar\Controller\ConventionModeleEtapeAdministrationControllerFactory::class,
            'ConventionModeleInstance' => \Oscar\Controller\ConventionModeleInstanceControllerFactory::class,
            'DateType' => \Oscar\Controller\DateTypeControllerFactory::class,
            'Depense' => \Oscar\Controller\DepenseControllerFactory::class,
            \Oscar\Controller\EnrollController::class => \Oscar\Controller\EnrollControllerFactory::class,
+38 −0
Original line number Diff line number Diff line
@@ -2612,3 +2612,41 @@ contratspcru:
      controller: Pcru
      action: contratspcru
  may_terminate: true

conventionModeles:
  type: literal
  may_terminate: false
  options:
    route: /convention-modeles
    defaults:
      controller: ConventionModele
  child_routes:
    instance:
      type: segment
      may_terminate: false
      options:
        route: /:id
      child_routes:
        instancier:
          type: segment
          may_terminate: true
          options:
            route: /instancier
            defaults:
              action: instancier

conventionModeleInstances:
  type: literal
  may_terminate: false
  options:
    route: /convention-saisie
    defaults:
      controller: ConventionModeleInstance
  child_routes:
    afficher:
      type: segment
      may_terminate: true
      options:
        route: /:id
        defaults:
          action: afficher
+24 −0
Original line number Diff line number Diff line
<?php

namespace Oscar\Controller;

class ConventionModeleController extends AbstractOscarController
{

    /** @var \Oscar\Service\ConventionModeleInstanceService */
    public $conventionModeleInstanceService;

    public function instancierAction()
    {
        /** @var \Oscar\Entity\ConventionModele $conventionModele */
        $conventionModele = $this->getEntityManager()->find(\Oscar\Entity\ConventionModele::class, $this->params('id'));
        if (!$conventionModele) {
            return $this->getResponseNotFound("Le modèle de convention n'a pas été trouvé.");
        }

        $conventionModeleInstance = $this->conventionModeleInstanceService->créerNouvelle($conventionModele, $this->getCurrentPerson());

        return $this->redirect()->toRoute('conventionModeleInstances/afficher', ['id' => $conventionModeleInstance->id]);
    }

}
+20 −0
Original line number Diff line number Diff line
<?php

namespace Oscar\Controller;

use Doctrine\ORM\EntityManager;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Oscar\Service\OscarUserContext;

class ConventionModeleControllerFactory implements FactoryInterface
{
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $c = new ConventionModeleController();
        $c->setEntityManager($container->get(EntityManager::class));
        $c->setOscarUserContextService($container->get(OscarUserContext::class));
        $c->conventionModeleInstanceService = $container->get(\Oscar\Service\ConventionModeleInstanceService::class);
        return $c;
    }
}
+19 −1
Original line number Diff line number Diff line
@@ -45,10 +45,28 @@ class ConventionModeleEtapeAdministrationController extends AbstractOscarControl

        if ($this->params()->fromPost('action') == "modifier") {
            $this->conventionModeleEtapeService->modifier($conventionModeleEtape,
             $this->params()->fromPost('nom'), $this->params()->fromPost('titre'), $this->getCurrentPerson());
             $this->params()->fromPost('nom'), $this->params()->fromPost('titre'),
             $this->params()->fromPost('estpremiere') == 'on', $this->getCurrentPerson());
        } else if ($this->params()->fromPost('action') == "supprimer") {
            $this->conventionModeleEtapeService->supprimer($conventionModeleEtape, $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/conventionModeles/configurer', ['id' => $conventionModele->id]);
        } else if ($this->params()->fromPost('action') == "ajouter_information") {
            $this->conventionModeleEtapeService->ajouterInformation($conventionModeleEtape,
             $this->params()->fromPost('nom'), $this->getCurrentPerson());
        } else if ($this->params()->fromPost('action') == "supprimer_information") {
            /** @var \Oscar\Entity\ConventionModeleEtapeInformation $conventionModeleEtapeInformation */
            $conventionModeleEtapeInformation = $this->getEntityManager()->find(\Oscar\Entity\ConventionModeleEtapeInformation::class, $this->params()->fromPost('id'));
            if (!$conventionModeleEtapeInformation) {
                return $this->getResponseNotFound("L'information à saisir pour l'étape de saisie du modèle de convention n'a pas été trouvée.");
            }
            $this->conventionModeleEtapeService->supprimerInformation($conventionModeleEtapeInformation, $this->getCurrentPerson());
        } else if ($this->params()->fromPost('action') == "ajouter_information_reponse") {
            /** @var \Oscar\Entity\ConventionModeleEtapeInformation $conventionModeleEtapeInformation */
            $conventionModeleEtapeInformation = $this->getEntityManager()->find(\Oscar\Entity\ConventionModeleEtapeInformation::class, $this->params()->fromPost('id'));
            if (!$conventionModeleEtapeInformation) {
                return $this->getResponseNotFound("L'information à saisir pour l'étape de saisie du modèle de convention n'a pas été trouvée.");
            }
            $this->conventionModeleEtapeService->ajouterInformationReponse($conventionModeleEtapeInformation, $this->params()->fromPost('reponse'), $this->getCurrentPerson());
        }

        return $this->redirect()->toRoute('administration/conventionModeles/configurer/etapes/configurer', ['id' => $conventionModele->id, 'idEtape' => $conventionModeleEtape->id]);
Loading