Commit 794af37f authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Merge remote-tracking branch 'origin/b20' into b20

parents f078779a 359b2e77
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -36,6 +36,19 @@ return [
                        ],
                        'may_terminate' => true,
                    ],
                    'ajout'           => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/ajout/:groupeTypeFormation',
                            'constraints' => [
                                'typeFormation' => '[0-9]*',
                            ],
                            'defaults'    => [
                                'action' => 'ajout',
                            ],
                        ],
                        'may_terminate' => true,
                    ],
                    'supprimer'        => [
                        'type'          => 'Segment',
                        'options'       => [
@@ -126,7 +139,7 @@ return [
                ],
                [
                    'controller' => 'Application\Controller\TypeFormation',
                    'action'     => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier"],
                    'action'     => ['saisie', 'supprimer', 'saisieGroupe', 'supprimerGroupe', "trier", 'ajout'],
                    'privileges' => [Privileges::ODF_TYPE_FORMATION_EDITION],
                ],
            ],
@@ -135,7 +148,6 @@ return [
    'controllers'   => [
        'factories' => [
            'Application\Controller\TypeFormation'       => Controller\Factory\TypeFormationControllerFactory::class,
            'Application\Controller\GroupeTypeFormation' => Controller\Factory\GroupeTypeFormationControllerFactory::class,
        ],
    ],
    'form_elements' => [
+30 −3
Original line number Diff line number Diff line
@@ -81,6 +81,33 @@ class TypeFormationController extends AbstractController



    public function ajoutAction()
    {
        $this->em()->getFilters()->enable('historique')->init([
            GroupeTypeFormation::class,
        ]);


        $form  = $this->getFormTypeFormationTypeFormationSaisie();
        $title = "Création d'un nouveau type de formation";
        /** @var TypeFormation $typeFormation */
        $typeFormation       = $this->getServiceTypeFormation()->newEntity();
        $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation');
        $typeFormation->setGroupe($groupeTypeFormation);

        $form->bindRequestSave($typeFormation, $this->getRequest(), function () use ($typeFormation, $form) {

            $this->getServiceTypeFormation()->save($typeFormation);
            $this->flashMessenger()->addSuccessMessage(
                "Ajout réussi"
            );
        });

        return compact('form', 'title');
    }



    public function saisieGroupeAction()
    {
        $groupeTypeFormation = $this->getEvent()->getParam('groupeTypeFormation');
+62 −39
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'intervenant en fonction des paramètres de route transmis :
     * - soit code:<i>CODE</i>
@@ -87,6 +88,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'intervenant de l'année précédente
     *
@@ -108,6 +110,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getByCode(string $code): ?Intervenant
    {
        $anneeId     = $this->getServiceContext()->getAnnee()->getId();
@@ -121,6 +124,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getByCodeRh(string $codeRh): ?Intervenant
    {
        $anneeId     = $this->getServiceContext()->getAnnee()->getId();
@@ -134,6 +138,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     *
     * @param string $sourceCode
@@ -161,6 +166,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function getBones(array $params): array
    {
        $psql = '';
@@ -186,6 +192,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function bestIntervenantByBones(array $bones, ?string $code, ?int $anneeId, ?int $statutId, ?int $structureId): ?Intervenant
    {
        $count = count($bones);
@@ -223,6 +230,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function isImportable(Intervenant $intervenant): bool
    {
        $connection = $this->getEntityManager()->getConnection();
@@ -238,6 +246,7 @@ class IntervenantService extends AbstractEntityService
    }



    private function getIntervenantIdParDefaut(string $code, int $anneeId): ?int
    {
        if (!$code || !$anneeId) return null;
@@ -252,6 +261,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Permet de définit une fiche intervenant comme celle étant à consulter par défaut
     *
@@ -284,6 +294,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Permet de savoir si oui ou non cette fiche intervenant est définie comme étant celle par défaut.
     *
@@ -297,6 +308,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne les identifiants des données concernés
     *
@@ -326,6 +338,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @param $intervenant Intervenant
     *
@@ -342,6 +355,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Retourne l'alias d'entité courante
     *
@@ -353,6 +367,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function finderByMiseEnPaiement(Structure $structure = null, Periode $periode = null, QueryBuilder $qb = null, $alias = null)
    {
        $serviceMIS = $this->getServiceMiseEnPaiementIntervenantStructure();
@@ -373,6 +388,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @return Intervenant
     */
@@ -390,6 +406,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Sauvegarde une entité
     *
@@ -411,6 +428,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     *
     * @param QueryBuilder|null $qb
@@ -426,6 +444,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Filtre par le type d'intervenant
     *
@@ -447,6 +466,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * Supprime (historise par défaut) le service spécifié.
     *
@@ -510,6 +530,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function getSystemeInformationUrl(Intervenant $intervenant): ?string
    {
        if (!$intervenant->getSource()->getImportable()) return null;
@@ -529,6 +550,7 @@ class IntervenantService extends AbstractEntityService
    }



    /**
     * @param string    $nom
     * @param string    $prenom
@@ -580,6 +602,7 @@ class IntervenantService extends AbstractEntityService
    }



    public function updateExportDate(Intervenant $intervenant): Intervenant
    {
        $date = new \DateTime();
@@ -590,17 +613,17 @@ class IntervenantService extends AbstractEntityService
        return $intervenant;
    }



    public function updateCode(Intervenant $intervenant, $code): Intervenant
    {
        if (!empty($code)) {
            if (empty($intervenant->getExportDate())) {
            $intervenant->setCode($code);
            $this->getEntityManager()->persist($intervenant);
            $this->getEntityManager()->flush();
            //On recalcul les tablaeux de bords de l'intervenant
            $this->getServiceWorkflow()->calculerTableauxBord([], $intervenant);
        }
        }

        return $intervenant;
    }
+7 −0
Original line number Diff line number Diff line
<?php
/**
 * @var $this  \Application\View\Renderer\PhpRenderer
 */

echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
echo $this->form($form);
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
                </table>
                <?php if ($canEdit): ?>
                    <tr class="champ-triable">
                        <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/saisie', ['typeFormation' => '','groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i
                        <a class="btn btn-primary ajax-modal " data-event="type-formation-edition" href="<?= $this->url('type-formation/ajout', ['groupeTypeFormation' => $groupeTypeFormation->getId()]); ?>"><i
                                    class="fas fa-plus"></i>
                            Ajout d'un nouveau type de formation</a>
                    </tr>
Loading