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

[Mes Formations] Possibilité de vider un plan de formation

parent 1c95339f
Loading
Loading
Loading
Loading
+2 −2
Changes for config/autoload/unicaen-app.global.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -34,8 +34,8 @@ return [
        'app_infos' => [
            'nom'     => "EMC2",
            'desc'    => "Emploi Mobilité Carrière Compétences",
            'version' => "4.1.1",
            'date'    => "16/11/2023",
            'version' => "4.2.0 (beta)",
            'date'    => "23/11/2023",

//            'liens' => [
//                'COMUE' => [
+7 −4
Changes for documentation/release/4.2.0.md: 7 added lines, 4 removed lines.
Original line number Diff line number Diff line
Version 4.X.X (XX/11/2023)
Version 4.2.0 (XX/11/2023)
====

Évolution
---
- Mes Formations : Axe comme élément de chapeau des groupes
- Mes Formations : Domaine de formation
- Importation/Complétion d'un plan de formation depuis un CSV
- [Mes Formations] Axe comme élément de chapeau des groupes
- [Mes Formations] Domaine de formation
- [Mes Formations] Importation/Complétion d'un plan de formation depuis un CSV
- [Mes Formations] Possibilité de vider un plan de formation
- [EMC2] Déclaration de type de mobilité
- 

Modification en BD
---
+13 −3
Changes for module/Formation/config/merged/plan-de-formation.config.php: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ return [
                        'reprendre',
                        'supprimer',
                        'importer-depuis-csv',
                        'vider',
                    ],
                    'privileges' => [
                        PlanformationPrivileges::PLANFORMATION_SUPPRIMER
@@ -216,17 +217,26 @@ return [
                        ],
                    ],
                    'importer' => [
                        'type'  => Literal::class,
                        'type'  => Segment::class,
                        'options' => [
                            /** @see PlanDeFormationController::importerDepuisCscAction() */
                            'route'    => '/importer-depuis-csv',
                            'route'    => '/importer-depuis-csv[/:plan-de-formation]',
                            'defaults' => [
                                'controller' => PlanDeFormationController::class,
                                'action'     => 'importer-depuis-csv',
                            ],
                        ],
                    ],

                    'vider' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/vider/:plan-de-formation',
                            'defaults' => [
                                /** @see PlanDeFormationController::viderAction() */
                                'action'     => 'vider',
                            ],
                        ],
                    ],
                ],
            ],
        ],
+26 −1
Changes for module/Formation/src/Formation/Controller/PlanDeFormationController.php: 26 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -264,11 +264,36 @@ class PlanDeFormationController extends AbstractActionController
        return $vm;
    }

    public function viderAction() : ViewModel
    {
        $plan = $this->getPlanDeFormationService()->getRequestedPlanDeFormation($this);

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost();
            if ($data["reponse"] === "oui") $this->getPlanDeFormationService()->vider($plan);
            exit();
        }

        $vm = new ViewModel();
        if ($plan !== null) {
            $vm->setTemplate('default/confirmation');
            $vm->setVariables([
                'title' => "Retrait des formations du plan de formation " . $plan->getAnnee(),
                'text' => "Cette opération est sans retour en arrière. Êtes-vous sûr·e de vouloir continuer ?",
                'action' => $this->url()->fromRoute('plan-de-formation/vider', ["plan-de-formation" => $plan->getId()], [], true),
            ]);
        }
        return $vm;
    }

    public function importerDepuisCsvAction(): ViewModel
    {
        $plan = $this->getPlanDeFormationService()->getRequestedPlanDeFormation($this);

        $form = $this->getPlanDeFormationImportationForm();
        $form->setAttribute('action', $this->url()->fromRoute('plan-de-formation/importer', ['mode' => 'preview', 'path' => null], [], true));

        $form->bind($plan);

        $request = $this->getRequest();
        if ($request->isPost()) {
+5 −1
Changes for module/Formation/src/Formation/Form/PlanDeFormationImportation/PlanDeFormationImportationHydrator.php: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,13 +2,17 @@

namespace Formation\Form\PlanDeFormationImportation;

use Formation\Entity\Db\PlanDeFormation;
use Laminas\Hydrator\HydratorInterface;

class PlanDeFormationImportationHydrator implements HydratorInterface
{
    public function extract(object $object): array
    {
        return [];
        /** @var PlanDeFormation $object */
        return [
            'plan-de-formation' => ($object)?$object->getId():null,
        ];
    }

    public function hydrate(array $data, object $object) : object
Loading