Commit e592974d authored by Thomas Hamel's avatar Thomas Hamel
Browse files

Merge branch 'feature_formation_exterieure' into release_10.1.0

parents 6cfd435c 4e4a128b
Loading
Loading
Loading
Loading
+162 −0
Changes for doc/release-notes/v10/10.1.0/02_formation_externe_attestation.sql: 162 added lines, 0 removed lines.
Original line number Diff line number Diff line
-- Création de la table
CREATE TABLE formation_formation_externe
(
    id                    bigserial                                                    not null
        primary key,
    libelle               varchar(1024)                                                not null,
    type                  varchar(1)                                                   not null,
    duree                 int                                                          not null,
    date_debut            timestamp                                                    not null,
    date_fin              timestamp                                                    not null,
    attestation_id        bigint REFERENCES fichier (id)                               not null,
    doctorant_id          integer REFERENCES doctorant (id) on delete cascade          not null,
    histo_createur_id     bigint                                                       not null REFERENCES utilisateur (id),
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_modificateur_id bigint REFERENCES utilisateur (id),
    histo_modification    timestamp,
    histo_destructeur_id  bigint REFERENCES utilisateur (id),
    histo_destruction     timestamp,

    CONSTRAINT fk_formation_formation_externe_attestation
        FOREIGN KEY (attestation_id)
            REFERENCES fichier (id)
            ON DELETE CASCADE
);

-- Création de la nature du fichier associée à l'attestation
INSERT INTO nature_fichier (id, code, libelle) VALUES (nextval('nature_fichier_id_seq'::regclass), 'FORMATION_ATTESTATION_FORMATION_EXTERIEURE', 'Attestation de suivi d''une formation externe');


-- Création/attribution des privilèges
INSERT INTO unicaen_privilege_categorie (ID, CODE, LIBELLE, ORDRE)
SELECT nextval('categorie_privilege_id_seq'),
       'formation_formationexterne',
       'Formation Externe',
       5007 WHERE NOT EXISTS (SELECT 1
                               FROM unicaen_privilege_categorie
                               WHERE CODE = 'formation_formationexterne');

INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'ajouter', 'Ajouter une formation suivie à l''extérieur', 1);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'modifier', 'Modifier une formation suivie à l''extérieur', 2);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'historiser', 'Historiser une formation suivie à l''extérieur', 3);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'supprimer', 'Supprimer une formation suivie à l''extérieur', 4);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'telecharger-attestation', 'Télécharger une attestation de suivi d''une formation externe', 5);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'gerer-validation', 'Gérer les validations (valider/refuser/révoquer) d''une formation externe', 5);


--------------- Privilèges concernant le tableau de bord des formations pour Maison du doctorat
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation'), 'index_maison-doctorat', 'Accès à l''index maison du doctorat concernant un doctorant', 3);
----------------

INSERT INTO PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID)
with data(categ, priv) as (select 'formation_formationexterne', 'ajouter'
                            union
                               select 'formation_formationexterne', 'modifier'
                               union
                               select 'formation_formationexterne', 'historiser'
                               union
                               select 'formation_formationexterne', 'supprimer'
                               union
                               select 'formation_formationexterne', 'telecharger-attestation'
                            )
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
         join PROFIL on profil.ROLE_ID in (
                                           'ADMIN_TECH',
                                           'DOCTORANT'
    )
         join unicaen_privilege_categorie cp on cp.CODE = data.categ
         join unicaen_privilege_privilege p on p.CATEGORIE_ID = cp.id and p.code = data.priv
where not exists (select * from PROFIL_PRIVILEGE where PRIVILEGE_ID = p.id and PROFIL_ID = profil.id);

INSERT INTO PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID)
with data(categ, priv) as (select 'formation_formationexterne', 'telecharger-attestation')
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
         join PROFIL on profil.ROLE_ID in (
                                           'BDD'
    )
         join unicaen_privilege_categorie cp on cp.CODE = data.categ
         join unicaen_privilege_privilege p on p.CATEGORIE_ID = cp.id and p.code = data.priv
where not exists (select * from PROFIL_PRIVILEGE where PRIVILEGE_ID = p.id and PROFIL_ID = profil.id);

INSERT INTO PROFIL_PRIVILEGE (PRIVILEGE_ID, PROFIL_ID)
with data(categ, priv) as (select 'formation', 'index_maison-doctorat'
                           union
                           select 'formation_formationexterne', 'gerer-validation')
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
         join PROFIL on profil.ROLE_ID in (
    'BDD',
                                          'ADMIN_TECH'
    )
         join unicaen_privilege_categorie cp on cp.CODE = data.categ
         join unicaen_privilege_privilege p on p.CATEGORIE_ID = cp.id and p.code = data.priv
where not exists (select * from PROFIL_PRIVILEGE where PRIVILEGE_ID = p.id and PROFIL_ID = profil.id);

insert into ROLE_PRIVILEGE (ROLE_ID, PRIVILEGE_ID)
select p2r.ROLE_ID, pp.PRIVILEGE_ID
from PROFIL_TO_ROLE p2r
         join profil pr on pr.id = p2r.PROFIL_ID
         join PROFIL_PRIVILEGE pp on pp.PROFIL_ID = pr.id
where not exists (select * from role_privilege where role_id = p2r.role_id and privilege_id = pp.privilege_id)
;


-- Gestion des validations
create table validation_formation_externe
(
    id                    bigint                                                       not null
        constraint validation_formation_externe_pkey
            primary key,
    formation_externe_id              bigint                                                       not null
        constraint validation_formation_externe_fk
            references public.formation_formation_externe,
    individu_id           bigint
        constraint validation_formation_externe_individu_id_fk
            references public.individu,
    histo_creation        timestamp default ('now'::text)::timestamp without time zone not null,
    histo_createur_id     bigint    default 1                                          not null
        constraint validation_formation_externe_hcfk
            references public.utilisateur,
    histo_modification    timestamp default ('now'::text)::timestamp without time zone not null,
    histo_modificateur_id bigint    default 1                                          not null
        constraint validation_formation_externe_hmfk
            references public.utilisateur,
    histo_destruction     timestamp,
    histo_destructeur_id  bigint
        constraint validation_formation_externe_hdfk
            references public.utilisateur,
    validation_id         bigint                                                       not null
        constraint validation_formation_externe_validation_fk
            references public.validation
);

create index validation_formation_externe_hcfk_idx
    on public.validation_formation_externe (histo_createur_id);
create index validation_formation_externe_hdfk_idx
    on public.validation_formation_externe (histo_destructeur_id);
create index validation_formation_externe_hmfk_idx
    on public.validation_formation_externe (histo_modificateur_id);
create index validation_formation_externe_individu_idx
    on public.validation_formation_externe (individu_id);
create index validation_formation_externe_idx
    on public.validation_formation_externe (formation_externe_id);
create index validation_formation_externe_validation_idx
    on public.validation_formation_externe (validation_id);


create sequence validation_formation_externe_id_seq owned by validation_formation_externe.id;
alter table validation_formation_externe alter column id set default nextval('validation_formation_externe_id_seq');

-- ajout des validations
insert into type_validation (id, code, libelle) VALUES (nextval('type_validation_id_seq'), 'VALIDATION_FORMATION_EXTERNE', 'Validation de la formation suivi à l''extérieur par un doctorant');
insert into type_validation (id, code, libelle) VALUES (nextval('type_validation_id_seq'), 'REFUS_VALIDATION_FORMATION_EXTERNE', 'Refus de la formation suivi à l''extérieur par un doctorant');
+5 −2
Changes for module/Admission/view/admission/admission-recherche/index.phtml: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -159,12 +159,15 @@ echo $this->partial('admission/admission/partial/header', []); ?>
            foreach ($admissions as $admission): ?>
                <tr>
                    <td><?php echo $admission->getIndividu()->getNomComplet() ?></td>
                    <td><?php echo $this->etatHelper($admission->getEtat(), null, "") ?>
                    <td >
                        <div class="d-flex align-items-center">
                            <?php echo $this->etatHelper($admission->getEtat(), null, "") ?>
                            <a href="<?php echo $this->url('admission/generer-statut-dossier', ['action' => 'generer-statut-dossier','admission' => $admission->getId()], [], true) ?>"
                               title="Appuyer pour avoir plus de détails"
                           data-bs-toggle="tooltip" data-bs-html="true" data-event="acces-statut-dossier" class="info_statut_dossier action ajax-modal">
                               data-bs-toggle="tooltip" data-bs-html="true" data-event="acces-statut-dossier" class="action ajax-modal" style="margin-left: 5px">
                                <span class="icon icon-information"></span>
                            </a>
                        </div>
                    </td>
                    <td>
                        <span title="<?php echo $admission?->getInscription()->first() ? $admission->getInscription()->first()->getTitreThese() : null ?>">
+267 −0
Changes for module/Formation/config/others/formation-externe.config.php: 267 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Formation;

use Formation\Assertion\FormationExterne\FormationExterneAssertion;
use Formation\Assertion\FormationExterne\FormationExterneAssertionFactory;
use Formation\Controller\FormationExterneController;
use Formation\Controller\FormationExterneControllerFactory;
use Formation\Form\Formation\FormationExterne\FormationExterneForm;
use Formation\Form\Formation\FormationExterne\FormationExterneFormFactory;
use Formation\Provider\Privilege\FormationPrivileges;
use Formation\Service\Formation\FormationExterne\FormationExterneService;
use Formation\Service\Formation\FormationExterne\FormationExterneServiceFactory;
use Formation\Service\Validation\ValidationFormationExterne\ValidationFormationExterneService;
use Formation\Service\Validation\ValidationFormationExterne\ValidationFormationExterneServiceFactory;
use Laminas\Router\Http\Segment;
use UnicaenPrivilege\Guard\PrivilegeController;
use UnicaenPrivilege\Provider\Rule\PrivilegeRuleProvider;

return [
    'bjyauthorize' => [
        'resource_providers' => [
            'BjyAuthorize\Provider\Resource\Config' => [
                'FormationExterne' => []
            ],
        ],
        'rule_providers' => [
            PrivilegeRuleProvider::class => [
                'allow' => [
                    [
                        'privileges' => [
                            FormationPrivileges::FORMATION_FORMATIONEXTERNE_MODIFIER,
                            FormationPrivileges::FORMATION_FORMATIONEXTERNE_HISTORISER,
                            FormationPrivileges::FORMATION_FORMATIONEXTERNE_SUPPRIMER,
                            FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION,
                        ],
                        'resources' => ['FormationExterne'],
                        'assertion'  => FormationExterneAssertion::class,
                    ],
                ],
            ],
        ],
        'guards' => [
            PrivilegeController::class => [
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'ajouter',
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_AJOUTER,
                    ],
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'modifier',
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_MODIFIER,
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'historiser',
                        'restaurer',
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_HISTORISER,
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'supprimer',
                        'supprimer-attestation',
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_SUPPRIMER,
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'telecharger-attestation'
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_TELECHARGER_ATTESTATION,
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'refuser-formation-externe',
                        'valider-formation-externe',
                        'revoquer-formation-externe'
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION,
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
            ],
        ],
    ],

    'router'          => [
        'routes' => [
            'formation' => [
                'child_routes' => [
                    'formation' => [
                        'child_routes' => [
                            'ajouter-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/ajouter-formation-externe/:doctorant',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::ajouterAction() */
                                        'action'     => 'ajouter',
                                    ],
                                ],
                            ],
                            'modifier-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/modifier-formation-externe/:formationExterne',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::modifierAction() */
                                        'action'     => 'modifier',
                                    ],
                                ],
                            ],
                            'historiser-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/historiser-formation-externe/:formationExterne',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::historiserAction() */
                                        'action'     => 'historiser',
                                    ],
                                ],
                            ],
                            'restaurer-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/restaurer-formation-externe/:formationExterne',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::restaurerAction() */
                                        'action'     => 'restaurer',
                                    ],
                                ],
                            ],
                            'supprimer-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/supprimer-formation-externe/:formationExterne',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::supprimerAction() */
                                        'action'     => 'supprimer',
                                    ],
                                ],
                            ],
                            'supprimer-attestation-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/supprimer-attestation-formation-externe/:formationExterne/:fichier',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::supprimerAttestationAction() */
                                        'action'     => 'supprimer-attestation',
                                    ],
                                ],
                            ],
                            'telecharger-attestation-formation-externe' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/telecharger-attestation-formation-externe/:formationExterne',
                                    'defaults' => [
                                        'controller' => FormationExterneController::class,
                                        /** @see FormationExterneController::telechargerAttestationAction() */
                                        'action'     => 'telecharger-attestation',
                                    ],
                                ],
                            ],
                            'valider-formation-externe' => [
                                'type' => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route' => '/formation-externe/valider/:formationExterne',
                                    'defaults' => [
                                        /** @see FormationExterneController::validerFormationExterneAction() */
                                        'controller' => FormationExterneController::class,
                                        'action' => 'valider-formation-externe',
                                    ],
                                ],
                            ],
                            'refuser-formation-externe' => [
                                'type' => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route' => '/formation-externe/refuser/:formationExterne',
                                    'defaults' => [
                                        /** @see FormationExterneController::refuserFormationExterneAction() */
                                        'controller' => FormationExterneController::class,
                                        'action' => 'refuser-formation-externe',
                                    ],
                                ],
                            ],
                            'revoquer-formation-externe' => [
                                'type' => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route' => '/formation-externe/revoquer/:formationExterne',
                                    'defaults' => [
                                        /** @see FormationExterneController::revoquerFormationExterneAction() */
                                        'controller' => FormationExterneController::class,
                                        'action' => 'revoquer-formation-externe',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    'service_manager' => [
        'factories' => [
            FormationExterneService::class => FormationExterneServiceFactory::class,
            FormationExterneAssertion::class => FormationExterneAssertionFactory::class,

            ValidationFormationExterneService::class => ValidationFormationExterneServiceFactory::class
        ],
    ],
    'controllers'     => [
        'factories' => [
            FormationExterneController::class => FormationExterneControllerFactory::class
        ],
    ],
    'form_elements' => [
        'factories' => [
            FormationExterneForm::class => FormationExterneFormFactory::class
        ],
    ],
    'hydrators' => [
        'factories' => [
        ],
    ]
];
 No newline at end of file
+59 −1

File changed.

Preview size limit exceeded, changes collapsed.

+111 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading