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

ajout d'une notification aux personnes habilitées à valider les formations...

ajout d'une notification aux personnes habilitées à valider les formations externes, impossibilité de modifier pour le doctorant une fois validée
parent 72880211
Loading
Loading
Loading
Loading
+2 −1
Changes for CHANGELOG.md: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ Journal des modifications
- Module Formation : Ajout de la fiche de formation sur le détail d'une session pour un doctorant
- Module Formation : Ajout d'une colonne dans l'export des inscriptions du nombre d'heures effectif de suivi du doctorant (pour une session)
- Module Formation : Possibilité de renseigner par le doctorant (depuis son tableau de bord), une formation externe avec attestation :
  - avec une validation par la Maison du doctorat
  - avec une validation par la Maison du doctorat / Gestionnaire/Responsable de l'ED
  - notification à l'initiative du doctorant, aux personnes habilitées à valider les formations 
  - formations externes validées récupérées automatiquement dans le rapport d'activité
- Module Formation : Dépôt de justificatifs d'absence à une formation
  - Lors du passage à l'état clôturé d'une session de formation : envoi d'un mail aux doctorants qui ont été entièrement/partiellement absent aux séances.
+11 −0
Changes for doc/release-notes/v10/10.1.0/02_formation_externe_attestation.sql: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ord
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);
INSERT INTO public.unicaen_privilege_privilege (categorie_id, code, libelle, ordre)
VALUES ((SELECT id FROM unicaen_privilege_categorie WHERE code = 'formation_formationexterne'), 'notifier-formation-ajoutee', 'Notifier les personnes ayant le droit de valider les formations externes, que des nouvelles ont été ajoutées', 5);


--------------- Privilèges concernant le tableau de bord de gestion des formations
@@ -65,6 +67,8 @@ with data(categ, priv) as (select 'formation_formationexterne', 'ajouter'
                               select 'formation_formationexterne', 'supprimer'
                               union
                               select 'formation_formationexterne', 'telecharger-attestation'
                               union
                               select 'formation_formationexterne', 'notifier-formation-ajoutee'
                            )
select p.id as PRIVILEGE_ID, profil.id as PROFIL_ID
from data
@@ -166,3 +170,10 @@ alter table validation_formation_externe alter column id set default nextval('va
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');

-- Templates/Macro Renderer
INSERT INTO public.unicaen_renderer_macro (id, code, description, variable_name, methode_name) VALUES (160, 'Url#IndexGestionFormation', '<p>Retourne l''URL de l''index de gestion des formations d''un doctorant</p>', 'Url', 'getUrlIndexGestionFormation');
INSERT INTO public.unicaen_renderer_template (id, code, description, document_type, document_sujet, document_corps, document_css, namespace, engine) VALUES (118, 'FORMATION_EXTERNE_AJOUTEE', '<p>Mail envoyé aux personnes ayant le droit de valider des formations externes déposées par le doctorant</p>', 'mail', 'Des formations externes déposées par VAR[Doctorant#Denomination] ont été soumises à validation', e'<p>Bonjour,</p>
<p>De nouvelles déclarations de formations externes ont été enregistrées par <strong>VAR[Doctorant#Denomination]</strong>.</p>
<p>Vous êtes invité·e à vous connecter à l\'application pour les examiner et, si nécessaire, les valider : VAR[Url#IndexGestionFormation]</p>
<p>Cordialement, </p>
                                                                                                                                                                <p><em>L’équipe SyGAL</em></p>', null, 'Formation\Provider\Template', 'default');
 No newline at end of file
+21 −0
Changes for module/Formation/config/others/formation-externe.config.php: 21 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -105,6 +105,15 @@ return [
                    ],
                    'assertion' => FormationExterneAssertion::class,
                ],
                [
                    'controller' => FormationExterneController::class,
                    'action' => [
                        'notifier-formation-externe-ajoutee'
                    ],
                    'privileges' => [
                        FormationPrivileges::FORMATION_FORMATIONEXTERNE_NOTIFIER_FORMATION_AJOUTEE,
                    ],
                ],
            ],
        ],
    ],
@@ -235,6 +244,18 @@ return [
                                    ],
                                ],
                            ],
                            'notifier-formation-externe-ajoutee' => [
                                'type' => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route' => '/formation-externe/notifier-ajout/:these',
                                    'defaults' => [
                                        /** @see FormationExterneController::notifierFormationExterneAjouteeAction() */
                                        'controller' => FormationExterneController::class,
                                        'action' => 'notifier-formation-externe-ajoutee',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
+10 −1
Changes for module/Formation/src/Formation/Assertion/FormationExterne/FormationExterneAssertion.php: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ use Application\Service\UserContextServiceAwareInterface;
use Doctorant\Service\DoctorantServiceAwareTrait;
use Formation\Entity\Db\FormationExterne;
use Formation\Provider\Privilege\FormationPrivileges;
use Formation\Provider\Validation\TypeValidation;
use Formation\Service\Formation\FormationExterne\FormationExterneServiceAwareTrait;
use JetBrains\PhpStorm\Pure;
use Laminas\Permissions\Acl\Assertion\AssertionInterface;
@@ -56,9 +57,13 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI

        switch($action) {
            case 'modifier' :
            case 'supprimer' :
            case 'historiser' :
                if(!$this->scopeValide($formationExterne)) return false;
                        $role = $this->userContextService->getSelectedIdentityRole();
                        if($role->isDoctorant() &&
                            $formationExterne->getValidation(TypeValidation::CODE_VALIDATION_FORMATION_EXTERNE)) return false;
            case 'restaurer' :
            case 'supprimer' :
            case 'supprimer-attestation' :
            case 'telecharger-attestation' :
            case 'valider-formation-externe' :
@@ -84,6 +89,10 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI
            case FormationPrivileges::FORMATION_FORMATIONEXTERNE_MODIFIER :
            case FormationPrivileges::FORMATION_FORMATIONEXTERNE_SUPPRIMER :
            case FormationPrivileges::FORMATION_FORMATIONEXTERNE_HISTORISER :
                if(!$this->scopeValide($formationExterne)) return false;
                        $role = $this->userContextService->getSelectedIdentityRole();
                        if($role->isDoctorant() &&
                            $formationExterne->getValidation(TypeValidation::CODE_VALIDATION_FORMATION_EXTERNE)) return false;
            case FormationPrivileges::FORMATION_FORMATIONEXTERNE_TELECHARGER_ATTESTATION :
            case FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION :
                return $this->scopeValide($formationExterne);
+26 −0
Changes for module/Formation/src/Formation/Controller/FormationExterneController.php: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,11 +13,14 @@ use Fichier\Service\NatureFichier\NatureFichierServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Formation\Entity\Db\FormationExterne;
use Formation\Form\Formation\FormationExterne\FormationExterneFormAwareTrait;
use Formation\Provider\Template\MailTemplates;
use Formation\Provider\Validation\TypeValidation;
use Formation\Service\Formation\FormationExterne\FormationExterneServiceAwareTrait;
use Formation\Service\Notification\FormationNotificationFactoryAwareTrait;
use Formation\Service\Validation\ValidationFormationExterne\ValidationFormationExterneServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\View\Model\ViewModel;
use Notification\Service\NotifierServiceAwareTrait;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareTrait;

@@ -31,6 +34,8 @@ class FormationExterneController extends AbstractController
    use DoctorantServiceAwareTrait;
    use FormationExterneServiceAwareTrait;
    use ValidationFormationExterneServiceAwareTrait;
    use FormationNotificationFactoryAwareTrait;
    use NotifierServiceAwareTrait;

    public function ajouterAction() : ViewModel
    {
@@ -255,4 +260,25 @@ class FormationExterneController extends AbstractController
            return $this->redirect()->toUrl($redirectUrl);
        }
    }

    public function notifierFormationExterneAjouteeAction(): Response
    {
        $these = $this->requestedThese();
        try {
            $notif = $this->formationNotificationFactory->createNotificationFormationExterneAjoutee($these);
            if (empty($notif->getTo())) {
                throw new RuntimeException(
                    "Aucun mail pour la notification [" . MailTemplates::FORMATION_EXTERNE_AJOUTEE . "]");
            }
            $this->notifierService->trigger($notif);
        } catch (\Notification\Exception\RuntimeException $e) {
            // aucun destinataire , todo : cas à gérer !
        }

        $this->flashMessenger()->addSuccessMessage("Notification envoyée au gestionnaire");

        if($redirectUrl = $this->params()->fromQuery('redirect')){
            return $this->redirect()->toUrl($redirectUrl);
        }
    }
}
 No newline at end of file
Loading