Commit d52fedc2 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Finalisation V_INTERVENANT_HISTORIQUE.sql

parent 3a35081a
Loading
Loading
Loading
Loading
+128 −83
Changes for data/ddl/view/V_INTERVENANT_HISTORIQUE.sql: 128 added lines, 83 removed lines.
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@ CREATE
OR REPLACE FORCE VIEW V_INTERVENANT_HISTORIQUE AS
WITH historique AS (
--Initialisation des données personnelles
SELECT
  d.intervenant_id   intervenant_id,
    SELECT d.intervenant_id                              intervenant_id,
           '1 - Données personnelles'                    categorie,
           'Début de la saisie des données personnelles' label,
           d.histo_creation                              histo_date,
@@ -11,15 +10,13 @@ SELECT
           u.display_name                                histo_user,
           'glyphicon glyphicon-ok'                      icon,
           1                                             ordre
FROM
  intervenant_dossier d
    FROM intervenant_dossier d
             JOIN utilisateur u ON u.id = d.histo_createur_id
    WHERE d.histo_destruction IS NULL

    UNION ALL
--Dernière modification des données personnelles
  SELECT
  d.intervenant_id   intervenant_id,
    SELECT d.intervenant_id                                 intervenant_id,
           '1 - Données personnelles'                       categorie,
           'Dernière modification des données personnelles' label,
           d.histo_modification                             histo_date,
@@ -27,16 +24,15 @@ FROM
           u.display_name                                   histo_user,
           'glyphicon glyphicon-ok'                         icon,
           1                                                ordre
FROM
  intervenant_dossier d
    FROM intervenant_dossier d
             JOIN utilisateur u ON u.id = d.histo_modificateur_id
  WHERE d.histo_destruction IS NULL AND d.histo_modification != d.histo_creation
    WHERE d.histo_destruction IS NULL
      AND d.histo_modification != d.histo_creation

UNION ALL

--Validation des données personnelles
SELECT
  d.intervenant_id   intervenant_id,
SELECT d.intervenant_id                      intervenant_id,
       '1 - Données personnelles'            categorie,
       'Validation des données personnelles' label,
       v.histo_creation                      histo_date,
@@ -44,8 +40,7 @@ SELECT
       u.display_name                        histo_user,
       'glyphicon glyphicon-ok'              icon,
       1                                     ordre
FROM
  validation v
FROM validation v
         JOIN utilisateur u ON u.id = v.histo_createur_id
         JOIN type_validation tv ON tv.id = v.type_validation_id AND tv.code = 'DONNEES_PERSO_PAR_COMP'
         JOIN intervenant_dossier d ON d.histo_destruction IS NULL AND d.intervenant_id = v.intervenant_id
@@ -67,8 +62,7 @@ WHERE pj.histo_destruction IS NULL

UNION ALL
--Validation des pièces justificatives
 SELECT
  pj.intervenant_id   intervenant_id,
SELECT pj.intervenant_id                                  intervenant_id,
       '2 - Pièces justificatives'                        categorie,
       'Validation pièce justificative : ' || tpj.libelle label,
       v.histo_creation                                   histo_date,
@@ -76,8 +70,7 @@ WHERE pj.histo_destruction IS NULL
       u.display_name                                     histo_user,
       'glyphicon glyphicon-ok'                           icon,
       2                                                  ordre
FROM
  validation v
FROM validation v
         JOIN utilisateur u ON u.id = v.histo_createur_id
         JOIN piece_jointe pj ON pj.validation_id = v.id
         JOIN type_piece_jointe tpj ON pj.type_piece_jointe_id = tpj.id
@@ -85,14 +78,11 @@ FROM
UNION ALL
--Dernière modification du service prévisionnel par composante
SELECT s.intervenant_id                                                                          intervenant_id,
	   '3 - Services prévisionnels'		                                     categorie,
       '3 - Service prévisionnel et/ou service référentiel'                                                              categorie,
       'Modification/Ajout du service prévisionnel pour la composante ' || MAX(st.libelle_court) label,
       MAX(vh.histo_modification)                                                                histo_date,
       MAX(vh.histo_modificateur_id) KEEP (DENSE_RANK FIRST ORDER BY vh.histo_modification DESC)   histo_createur_id,
       MAX(u.display_name) KEEP (DENSE_RANK FIRST ORDER BY vh.histo_modification DESC)    histo_user,
--       FIRST_VALUE(vh.histo_modificateur_id) OVER (partition by s.intervenant_id order by vh.histo_modification desc) histo_createur_id,
       --FIRST_VALUE(u.display_name) OVER (partition by s.intervenant_id order by vh.histo_modification desc) histo_user,
       'glyphicon glyphicon-calendar'                                    icon,
       MAX(vh.histo_modificateur_id)                                                             KEEP (dense_rank FIRST ORDER BY vh.histo_modification DESC)   histo_createur_id, MAX(u.display_name) KEEP (dense_rank FIRST ORDER BY vh.histo_modification DESC)    histo_user,
       'glyphicon glyphicon-ok'                           icon,
       3                                                                                         ordre
FROM volume_horaire vh
         JOIN service s ON s.id = vh.service_id
@@ -106,115 +96,148 @@ FROM volume_horaire vh
GROUP BY s.intervenant_id, ep.structure_id

UNION ALL
--Création du contrat par composante
--Service référentiel uniquement pour les permanents
SELECT  s.intervenant_id                                                                     intervenant_id,
       '3 - Service prévisionnel et/ou service référentiel'                                 categorie,
        'Service référentiel : ' || fr.libelle_court || ' pour la composante ' || str.libelle_court                      label,
       s.histo_modification                                                                histo_date,
       s.histo_modificateur_id                                                             histo_createur_id,
       u.display_name                                     								   histo_user,
       'glyphicon glyphicon-ok'                           								   icon,
       3            										ordre
FROM
  service_referentiel s
  JOIN fonction_referentiel fr ON fr.id = s.fonction_id
  JOIN utilisateur u ON u.id = s.histo_modificateur_id
  LEFT JOIN structure str ON str.id = s.structure_id
WHERE
 s.histo_destruction IS NULL

 UNION ALL
 --Modification de service dû
  SELECT
  C.intervenant_id              intervenant_id,
   '4 - Contractualisation'		                                     categorie,
       'Création ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id || ' pour la composante ' || s.libelle_court                             label,
	   msd.intervenant_id                                                                     intervenant_id,
       '3 - Service prévisionnel et/ou service référentiel'                                 categorie,
        'Modification de service dû : ' || mss.libelle                              label,
       msd.histo_modification                                                                histo_date,
       msd.histo_modificateur_id                                                             histo_createur_id,
       u.display_name                                     								   histo_user,
       'glyphicon glyphicon-ok'                           								   icon,
       3            										ordre
FROM
  modification_service_du msd
  JOIN motif_modification_service mss ON mss.id = msd.motif_id
  JOIN utilisateur u ON u.id = msd.histo_modificateur_id
WHERE
	msd.histo_destruction IS NULL


UNION ALL
--Agrément conseil restreint et conseil académique
SELECT tbla.intervenant_id         intervenant_id,
       '4 - Agréments'          categorie,
       ta.libelle || CASE
                         WHEN s.id IS NULL THEN ''
                         ELSE ' ' ||
                              s.libelle_court END ||
       CASE
           WHEN a.date_decision IS NULL THEN ''
           ELSE ' (décision du ' ||
                to_char(a.date_decision, 'dd/mm/YYYY')
               || ')' END       label,
       a.histo_modification     histo_date,
       a.histo_modificateur_id  histo_createur_id,
       u.display_name           histo_user,
       'glyphicon glyphicon-ok' icon,
       4                        ordre
FROM tbl_agrement tbla
JOIN agrement a ON tbla.agrement_id = a.id
JOIN type_agrement ta ON ta.id = a.type_agrement_id
         JOIN utilisateur u ON u.id = a.histo_modificateur_id
         LEFT JOIN structure s ON s.id = a.structure_id
WHERE a.histo_destruction IS NULL

UNION ALL
--Création du contrat par composante
SELECT C.intervenant_id                          intervenant_id,
       '5 - Contractualisation'                  categorie,
       'Création ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id ||
       ' pour la composante ' || s.libelle_court label,
       C.histo_creation                          histo_date,
       C.histo_createur_id                       histo_createur_id,
       u.display_name                            histo_user,
       'fas fa-book'                             icon,
       4																 ordre
FROM
  contrat C
       5                                         ordre
FROM contrat C
         JOIN type_contrat tc ON tc.id = C.type_contrat_id
         JOIN structure s ON s.id = C.structure_id
         JOIN utilisateur u ON u.id = C.histo_createur_id
WHERE
	C.histo_destruction IS NULL
WHERE C.histo_destruction IS NULL

UNION ALL
--Validation du contrat par composante
SELECT
 C.intervenant_id              intervenant_id,
   '4 - Contractualisation'		                                     categorie,
       'Validation ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id || ' pour la composante ' || s.libelle_court                             label,
SELECT C.intervenant_id                          intervenant_id,
       '5 - Contractualisation'                  categorie,
       'Validation ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id ||
       ' pour la composante ' || s.libelle_court label,
       v.histo_creation                          histo_date,
       v.histo_createur_id                       histo_createur_id,
       u.display_name                            histo_user,
       'fas fa-book'                             icon,
       4																 ordre
FROM
  validation v
       5                                         ordre
FROM validation v
         JOIN utilisateur u ON u.id = v.histo_createur_id
         JOIN contrat C ON C.validation_id = v.id AND C.histo_destruction IS NULL
         JOIN type_contrat tc ON tc.id = C.type_contrat_id
         JOIN structure s ON s.id = C.structure_id
WHERE
  v.histo_destruction IS NULL
WHERE v.histo_destruction IS NULL

UNION ALL
--Dépôt du contrat signé par composante
SELECT
 C.intervenant_id              intervenant_id,
   '4 - Contractualisation'		                                     categorie,
       'Dépôt ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id || ' signé pour la composante ' || s.libelle_court                             label,
SELECT C.intervenant_id                                intervenant_id,
       '5 - Contractualisation'                        categorie,
       'Dépôt ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id ||
       ' signé pour la composante ' || s.libelle_court || ' (' || f.nom ||  ')' label,
       f.histo_creation                                histo_date,
       f.histo_createur_id                             histo_createur_id,
       u.display_name                                  histo_user,
       'fas fa-book'                                   icon,
       4																 ordre
FROM
  fichier f
       5                                               ordre
FROM fichier f
         JOIN contrat_fichier cf ON cf.fichier_id = f.id AND histo_destruction IS NULL
         JOIN fichier f ON f.id = cf.fichier_id AND f.histo_destruction IS NULL
         JOIN contrat C ON C.id = cf.contrat_id
         JOIN type_contrat tc ON tc.id = C.type_contrat_id
         JOIN structure s ON s.id = C.structure_id
         JOIN utilisateur u ON u.id = f.histo_createur_id
WHERE
  f.histo_destruction IS NULL
WHERE f.histo_destruction IS NULL

UNION ALL
--Date de retour signé du contrat par composante
SELECT
 C.intervenant_id              intervenant_id,
   '4 - Contractualisation'		                                     categorie,
       'Date de retour signée ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id || ' pour la composante ' || s.libelle_court                             label,
       C.histo_modification                                           histo_date,
       C.histo_modificateur_id                                            histo_createur_id,
       u.display_name											       histo_user,
       'fas fa-book' 				                                   icon,
       4																 ordre
FROM
  contrat C
  JOIN type_contrat tc ON tc.id = C.type_contrat_id
  JOIN structure s ON s.id = C.structure_id
  JOIN utilisateur u ON u.id = C.histo_modificateur_id
WHERE
  C.histo_destruction IS NULL AND C.date_retour_signe IS NOT NULL

  UNION ALL
-- Envoi du contrat par email par composante
SELECT
 C.intervenant_id              intervenant_id,
   '4 - Contractualisation'		                                     categorie,
       'Envoi par mail ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' || C.id || ' pour la composante ' || s.libelle_court                             label,
SELECT C.intervenant_id                                  intervenant_id,
       '5 - Contractualisation'                          categorie,
       'Date de retour signée ' || CASE WHEN tc.code = 'CONTRAT' THEN 'du contrat' ELSE 'de l''avenant' END || ' N° ' ||
       C.id || ' pour la composante ' || s.libelle_court label,
       C.histo_modification                              histo_date,
       C.histo_modificateur_id                           histo_createur_id,
       u.display_name                                    histo_user,
       'fas fa-book'                                     icon,
       4																 ordre
FROM
  contrat C
       5                                                 ordre
FROM contrat C
         JOIN type_contrat tc ON tc.id = C.type_contrat_id
         JOIN structure s ON s.id = C.structure_id
         JOIN utilisateur u ON u.id = C.histo_modificateur_id
WHERE
  C.histo_destruction IS NULL AND C.date_envoi_email IS NOT NULL

WHERE C.histo_destruction IS NULL
  AND C.date_retour_signe IS NOT NULL

UNION ALL


--Dernière modification du service réalisé par composante
SELECT s.intervenant_id                                                                     intervenant_id,
       '5 - Services réalisés'                                                              categorie,
       'Modification/Ajout du service réalisé pour la composante ' || MAX(st.libelle_court) label,
       MAX(vh.histo_modification)                                                           histo_date,
       MAX(vh.histo_modificateur_id) KEEP (DENSE_RANK FIRST ORDER BY vh.histo_modification DESC)   histo_createur_id,
       MAX(u.display_name) KEEP (DENSE_RANK FIRST ORDER BY vh.histo_modification DESC)    histo_user,
       'glyphicon glyphicon-calendar'                                    icon,
       MAX(vh.histo_modificateur_id)                                                        KEEP (dense_rank FIRST ORDER BY vh.histo_modification DESC)   histo_createur_id, MAX(u.display_name) KEEP (dense_rank FIRST ORDER BY vh.histo_modification DESC)    histo_user, 'glyphicon glyphicon-calendar' icon,
       5                                                                                    ordre
FROM volume_horaire vh
         JOIN service s ON s.id = vh.service_id
@@ -227,6 +250,28 @@ FROM volume_horaire vh
         LEFT JOIN motif_non_paiement mnp ON mnp.id = vh.motif_non_paiement_id
GROUP BY s.intervenant_id, ep.structure_id

UNION ALL
--Mise en paiement
SELECT
	 s.intervenant_id                                                                     intervenant_id,
       '6 - Mise en paiement'                                 categorie,
       mep.heures || 'h ' || th.libelle_court || CASE WHEN p.id IS NULL THEN '' ELSE ' (paiement en ' || p.libelle_court || ')' END                      label,
       mep.histo_modification                                                                histo_date,
       mep.histo_modificateur_id                                                             histo_createur_id,
       u.display_name                                     								   histo_user,
       'glyphicon glyphicon-ok'                           								   icon,
       6            										ordre
FROM
  mise_en_paiement mep
  JOIN formule_resultat_service frs ON frs.id = mep.formule_res_service_id
  JOIN service s ON s.id = frs.service_id
  JOIN type_heures th ON th.id = mep.type_heures_id
  JOIN utilisateur u ON u.id = mep.histo_modificateur_id
  LEFT JOIN periode p ON p.id = mep.periode_paiement_id
  WHERE
  mep.histo_destruction IS NULL



)
SELECT rownum id,
+1 −1
Changes for module/Application/src/Controller/IntervenantController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ class IntervenantController extends AbstractController
        $notificationNote = $this->getServiceNote()->countNote($intervenant);
        $this->addIntervenantRecent($intervenant);

        return compact('intervenant', 'tab');
        return compact('intervenant', 'tab', 'notificationNote');
    }


+4 −5
Changes for module/Application/src/Provider/Privilege/Privileges.php: 4 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -9,8 +9,7 @@ namespace Application\Provider\Privilege;
 *
 * @author UnicaenCode
 */
class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
{
class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges {

    const AGREMENT_CONSEIL_ACADEMIQUE_EDITION                 = 'agrement-conseil-academique-edition';
    const AGREMENT_CONSEIL_ACADEMIQUE_SUPPRESSION             = 'agrement-conseil-academique-suppression';
@@ -140,10 +139,10 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
    const INTERVENANT_EXPORTER                                = 'intervenant-exporter';
    const INTERVENANT_FICHE                                   = 'intervenant-fiche';
    const INTERVENANT_LIEN_SYSTEME_INFORMATION                = 'intervenant-lien-systeme-information';
    const INTERVENANT_NOTE_EDITION                            = 'intervenant-note-edition';
    const INTERVENANT_NOTE_SUPPRESSION                        = 'intervenant-note-suppression';
    const INTERVENANT_NOTE_VISUALISATION                      = 'intervenant-note-visualisation';
    const INTERVENANT_NOTE_ADMINISTRATION                     = 'intervenant-note-administration';
    const INTERVENANT_NOTE_AJOUT                              = 'intervenant-note-ajout';
    const INTERVENANT_NOTE_EMAIL                              = 'intervenant-note-email';
    const INTERVENANT_NOTE_VISUALISATION                      = 'intervenant-note-visualisation';
    const INTERVENANT_RECHERCHE                               = 'intervenant-recherche';
    const INTERVENANT_STATUT_EDITION                          = 'intervenant-statut-edition';
    const INTERVENANT_STATUT_VISUALISATION                    = 'intervenant-statut-visualisation';