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

Merge branch '2026-06-04-remove-chemin-decisionnel' into 'connor'

2026 06 04 remove chemin decisionnel

See merge request !50
parents ce342156 09cc5728
Loading
Loading
Loading
Loading
Loading
+0 −25
Changes for module/Oscar/config/module.config.php: 0 added lines, 25 removed lines.
Original line number Diff line number Diff line
@@ -586,17 +586,6 @@ return array(
                    'privileges' => [\Oscar\Provider\Privileges::DROIT_PRIVILEGE_EDITION],
                ],


                [
                    'controller' => 'CheminDecisionnel',
                    'action' => [
                        'demarrer',
                        'terminer',
                        'convention',
                    ],
                    'roles' => ['user']
                ],

                [
                    'controller' => 'ActivityFreeField',
                    'action' => [
@@ -604,16 +593,6 @@ return array(
                    ],
                    'roles' => ['user']
                ],

                [
                    'controller' => 'CheminDecisionnelAdministration',
                    'action' => [
                        'cheminsDecisionnels',
                        'cheminsDecisionnelsUpdate',
                        'formulaire'
                    ],
                    'roles' => ['user']
                ],
            ]
        ],
    ],
@@ -652,8 +631,6 @@ return array(
            \Oscar\Service\administration\AdminRolePrivilegeServiceAPIService::class => \Oscar\Service\administration\AdminRolePrivilegeServiceAPIServiceFactory::class,
            \Oscar\Service\BackupService::class => \Oscar\Service\BackupServiceFactory::class,
            \Oscar\Service\administration\CheckConfigService::class => \Oscar\Service\administration\CheckConfigServiceFactory::class,
            \Oscar\Service\CheminDecisionnelFormulaireService::class => \Oscar\Service\CheminDecisionnelFormulaireServiceFactory::class,
            \Oscar\Service\CheminDecisionnelService::class => \Oscar\Service\CheminDecisionnelServiceFactory::class,
            \Oscar\Service\ConnectorService::class => \Oscar\Service\ConnectorServiceFactory::class,
            \Oscar\Service\ContractDocumentService::class => \Oscar\Service\ContractDocumentServiceFactory::class,
            \Oscar\Service\DocumentFormatterService::class => \Oscar\Service\DocumentFormatterServiceFactory::class,
@@ -717,8 +694,6 @@ return array(
            'Administration' => \Oscar\Controller\AdministrationControllerFactory::class,
            'AdministrationCheckConfig' => \Oscar\Controller\AdministrationCheckConfigControllerFactory::class,
            'AdministrativeDocument' => \Oscar\Controller\AdministrativeDocumentControllerFactory::class,
            'CheminDecisionnel' => \Oscar\Controller\CheminDecisionnelControllerFactory::class,
            'CheminDecisionnelAdministration' => \Oscar\Controller\CheminDecisionnelAdministrationControllerFactory::class,
            'Codenaf' => \Oscar\Controller\CodenafControllerFactory::class,
            'Connector' => \Oscar\Controller\ConnectorControllerFactory::class,
            'DateType' => \Oscar\Controller\DateTypeControllerFactory::class,
+0 −55
Changes for module/Oscar/config/routes.yml: 0 added lines, 55 removed lines.
Original line number Diff line number Diff line
@@ -2054,31 +2054,6 @@ administration:
        defaults:
          action: configDump

    chemins-decisionnels:
      type: segment
      may_terminate: true
      options:
        route: /chemins-decisionnels
        defaults:
          controller: CheminDecisionnelAdministration
          action: cheminsDecisionnels
      child_routes:
        update:
          type: segment
          may_terminate: true
          options:
            route: /:id
            defaults:
              action: cheminsDecisionnelsUpdate
          child_routes:
            formulaire:
              type: segment
              may_terminate: true
              options:
                route: /formulaires/:formulaire-id
                defaults:
                  action: formulaire

    # Gestion et chargement du référenciel des pays
    logs:
      type: segment
@@ -2527,36 +2502,6 @@ siret:
        defaults:
          action: api

chemins-decisionnels:
  type: literal
  options:
    route: /chemins-decisionnels
    defaults:
      controller: CheminDecisionnel
  child_routes:
    demarrer:
      type: segment
      may_terminate: true
      options:
        route: /:id
        defaults:
          action: demarrer
      child_routes:
        terminer:
          type: segment
          may_terminate: true
          options:
            route: /terminer
            defaults:
              action: terminer
        convention:
          type: segment
          may_terminate: true
          options:
            route: /convention/:formulaire-id
            defaults:
              action: convention

contratspcru:
  type: literal
  options:
+0 −187
Changes for module/Oscar/src/Oscar/Controller/CheminDecisionnelAdministrationController.php: 0 added lines, 187 removed lines.
Original line number Diff line number Diff line
<?php

namespace Oscar\Controller;

use DateTime;
use BjyAuthorize\Exception\UnAuthorizedException;
use Laminas\Http\Response;
use Laminas\View\Model\JsonModel;
use Oscar\Entity\CheminDecisionnelFormulaire;
use Oscar\Provider\Privileges;
use Oscar\Traits\UseCheminDecisionnelFormulaireService;
use Oscar\Traits\UseCheminDecisionnelFormulaireServiceTrait;
use Oscar\Traits\UseCheminDecisionnelService;
use Oscar\Traits\UseCheminDecisionnelServiceTrait;
use Oscar\Traits\UseLoggerService;
use Oscar\Traits\UseLoggerServiceTrait;
use Oscar\Traits\UseOscarConfigurationService;
use Oscar\Traits\UseOscarConfigurationServiceTrait;
use Throwable;

class CheminDecisionnelAdministrationController extends AbstractOscarController implements UseLoggerService, UseCheminDecisionnelService, UseCheminDecisionnelFormulaireService, UseOscarConfigurationService
{
    use UseLoggerServiceTrait, UseCheminDecisionnelServiceTrait, UseCheminDecisionnelFormulaireServiceTrait, UseOscarConfigurationServiceTrait;

    public function cheminsDecisionnelsAction()
    {
        $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_PARAMETERS_MANAGE);
        if (!$this->getRequest()->isPost()) {
            /** @var \Oscar\Entity\CheminDecisionnelRepository $cheminDecisionnelRepository */
            $cheminDecisionnelRepository = $this->getEntityManager()->getRepository(\Oscar\Entity\CheminDecisionnel::class);
            return ["chemins_decisionnels" => $cheminDecisionnelRepository->getAll()];
        }
        if ($this->params()->fromPost('action') != "creer") {
            return $this->redirect()->toRoute('administration/chemins-decisionnels');
        }

        $this->getCheminDecisionnelService()->creerNouveau($this->params()->fromPost('nom'), $this->getCurrentPerson());

        return $this->redirect()->toRoute('administration/chemins-decisionnels');
    }

    public function cheminsDecisionnelsUpdateAction()
    {
        $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_PARAMETERS_MANAGE);

        /** @var \Oscar\Entity\CheminDecisionnelRepository $cheminDecisionnelRepository */
        $cheminDecisionnelRepository = $this->getEntityManager()->getRepository(\Oscar\Entity\CheminDecisionnel::class);
        /** @var \Oscar\Entity\CheminDecisionnel $cheminDecisionnel */
        $cheminDecisionnel = $cheminDecisionnelRepository->find($this->params('id'));
        if (!$cheminDecisionnel) {
            return $this->getResponseNotFound("Le chemin décisionnel n'a pas été trouvé.");
        }
        
        if (!$this->getRequest()->isPost()) {
            return ["chemin_decisionnel" => $cheminDecisionnel, "graph_svg" => $this->getCheminDecisionnelService()->générerGraphe($cheminDecisionnel, $this->url()->fromRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]), $this->url())];
        }

        if ($this->params()->fromPost('action') == "modifier") {
            $this->getCheminDecisionnelService()->modifier($cheminDecisionnel, $this->params()->fromPost('nom'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "supprimer") {
            $this->getCheminDecisionnelService()->supprimer($cheminDecisionnel, $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels');
        }

        if ($this->params()->fromPost('action') == "ajouter_question") {
            $this->getCheminDecisionnelService()->ajouterQuestion($cheminDecisionnel, $this->params()->fromPost('question'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "ajouter_question_reponse") {
            $this->getCheminDecisionnelService()->ajouterReponse($cheminDecisionnel, $this->params()->fromPost('question_id'), $this->params()->fromPost('reponse'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "supprimer_question") {
            $this->getCheminDecisionnelService()->supprimerQuestion($cheminDecisionnel, $this->params()->fromPost('question_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "definir_premiere_question") {
            $this->getCheminDecisionnelService()->definirPremiereQuestion($cheminDecisionnel, $this->params()->fromPost('question_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "supprimer_reponse") {
            $this->getCheminDecisionnelService()->supprimerReponse($cheminDecisionnel, $this->params()->fromPost('question_id'), $this->params()->fromPost('reponse_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "selectionner_suite") {
            $this->getCheminDecisionnelService()->definirSuite($cheminDecisionnel, $this->params()->fromPost('question_id'), $this->params()->fromPost('reponse_id'), $this->params()->fromPost('type_suite'), $this->params()->fromPost('question_suivante_id'), $this->params()->fromPost('message_suivant_id'), $this->params()->fromPost('formulaire_suivant_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "ajouter_message") {
            $this->getCheminDecisionnelService()->ajouterMessage($cheminDecisionnel, $this->params()->fromPost('message'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "supprimer_message") {
            $this->getCheminDecisionnelService()->supprimerMessage($cheminDecisionnel, $this->params()->fromPost('message_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "formulaire_creer") {
            $this->getCheminDecisionnelFormulaireService()->creer($cheminDecisionnel, $this->params()->fromPost('nom'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        if ($this->params()->fromPost('action') == "formulaire_supprimer") {
            $this->getCheminDecisionnelFormulaireService()->supprimer($cheminDecisionnel, $this->params()->fromPost('formulaire_id'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
        }

        return $this->redirect()->toRoute('administration/chemins-decisionnels/update', ['id' => $cheminDecisionnel->getId()]);
    }

    public function formulaireAction()
    {
        $this->getOscarUserContextService()->check(Privileges::MAINTENANCE_PARAMETERS_MANAGE);

        /** @var \Oscar\Entity\CheminDecisionnelRepository $cheminDecisionnelRepository */
        $cheminDecisionnelRepository = $this->getEntityManager()->getRepository(\Oscar\Entity\CheminDecisionnel::class);
        /** @var \Oscar\Entity\CheminDecisionnel $cheminDecisionnel */
        $cheminDecisionnel = $cheminDecisionnelRepository->find($this->params('id'));
        if (!$cheminDecisionnel) {
            return $this->getResponseNotFound("Le chemin décisionnel n'a pas été trouvé.");
        }

        /** @var \Oscar\Entity\CheminDecisionnelFormulaireRepository $cheminDecisionnelFormulaireRepository */
        $cheminDecisionnelFormulaireRepository = $this->getEntityManager()->getRepository(\Oscar\Entity\CheminDecisionnelFormulaire::class);
        /** @var \Oscar\Entity\CheminDecisionnelFormulaire $cheminDecisionnelFormulaire */
        $cheminDecisionnelFormulaire = $cheminDecisionnelFormulaireRepository->find($this->params('formulaire-id'));
        if (!$cheminDecisionnelFormulaire) {
            return $this->getResponseNotFound("Le formulaire n'a pas été trouvé.");
        }
        
        if (!$this->getRequest()->isPost()) {

            $dateStart = $this->params()->fromQuery('dateStart') ? $this->params()->fromQuery('dateStart') : NULL;
            $dateEnd = $this->params()->fromQuery('dateEnd') ? $this->params()->fromQuery('dateEnd') : NULL;
            $amount = $this->params()->fromQuery('amount') ? $this->params()->fromQuery('amount') : NULL;
            $partenaire = $this->params()->fromQuery('partenaire') ? $this->params()->fromQuery('partenaire') : NULL;

            $allActivityForm = $this->getOscarConfigurationService()->getActivityFormConfigKeying();

            $partenaireForm = [];
            $partenaireForm['name'] = 'partenaire';
            $partenaireForm['label'] = 'Partenaire';
            $allActivityForm['partenaire'] = $partenaireForm;

            $activityFormToShow = [];
            foreach (CheminDecisionnelFormulaire::CHAMPS_VALIDES as $v) {
                if (array_key_exists($v, $allActivityForm)) {
                    $activityFormToShow[$v] = $allActivityForm[$v];
                }
            }
            return ['chemin_decisionnel_id' => $cheminDecisionnel->getId(), 'formulaire' => $cheminDecisionnelFormulaire, 'activity_forms' => $activityFormToShow, 'date_start' => $dateStart, 'date_end' => $dateEnd, 'amount' => $amount, 'partenaire' => $partenaire];
        }

        if ($this->params()->fromPost('action') == "modifier") {
            $this->getCheminDecisionnelFormulaireService()->modifier($cheminDecisionnel, $cheminDecisionnelFormulaire, $this->params()->fromPost('nom'), $this->getCurrentPerson());
            return $this->redirect()->toRoute('administration/chemins-decisionnels/update/formulaire', ['id' => $cheminDecisionnel->getId(), 'formulaire-id' => $cheminDecisionnelFormulaire->getId()]);
        } else if ($this->params()->fromPost('action') == "selection_champs") {

            $champs = [];
            if ($this->params()->fromPost('champs')) {
                $champs = $this->params()->fromPost('champs');
            }
            $this->getCheminDecisionnelFormulaireService()->definirChamps($cheminDecisionnel, $cheminDecisionnelFormulaire, $champs, $this->getCurrentPerson());

            return $this->redirect()->toRoute('administration/chemins-decisionnels/update/formulaire', ['id' => $cheminDecisionnel->getId(), 'formulaire-id' => $cheminDecisionnelFormulaire->getId()]);

        } else if ($this->params()->fromPost('action') == "modifier_texte_convention") {

            $this->getCheminDecisionnelFormulaireService()->modifierTexteConvention($cheminDecisionnel, $cheminDecisionnelFormulaire, $this->params()->fromPost('texte_convention'), $this->getCurrentPerson());

            return $this->redirect()->toRoute('administration/chemins-decisionnels/update/formulaire', ['id' => $cheminDecisionnel->getId(), 'formulaire-id' => $cheminDecisionnelFormulaire->getId()]);
        }

        return $this->redirect()->toRoute('administration/chemins-decisionnels/update/formulaire', ['id' => $cheminDecisionnel->getId(), 'formulaire-id' => $cheminDecisionnelFormulaire->getId()]);
    }

}
+0 −24
Changes for module/Oscar/src/Oscar/Controller/CheminDecisionnelAdministrationControllerFactory.php: 0 added lines, 24 removed lines.
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\OscarConfigurationService;
use Oscar\Service\OscarUserContext;

class CheminDecisionnelAdministrationControllerFactory implements FactoryInterface
{
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $c = new CheminDecisionnelAdministrationController();
        $c->setEntityManager($container->get(EntityManager::class));
        $c->setOscarUserContextService($container->get(OscarUserContext::class));
        $c->setLoggerService($container->get('Logger'));
        $c->setOscarConfigurationService($container->get(OscarConfigurationService::class));
        $c->setCheminDecisionnelService($container->get(\Oscar\Service\CheminDecisionnelService::class));
        $c->setCheminDecisionnelFormulaireService($container->get(\Oscar\Service\CheminDecisionnelFormulaireService::class));
        return $c;
    }
}
+0 −352

File deleted.

Preview size limit exceeded, changes collapsed.

Loading