Commit 561f720c authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Ajout suppression referentiel et suppression pièce jointe dans l'historique de...

Ajout suppression referentiel et suppression pièce jointe dans l'historique de l'intervenant (#44677)
parent 5fcb2a80
Loading
Loading
Loading
Loading
+36 −1
Changes for data/ddl/view/V_INTERVENANT_HISTORIQUE.sql: 36 added lines, 1 removed line.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INTERVENANT_HISTORIQUE AS
CREATE
OR REPLACE FORCE VIEW V_INTERVENANT_HISTORIQUE AS
WITH historique AS (
--Initialisation des données personnelles
    SELECT d.intervenant_id                              intervenant_id,
@@ -59,6 +60,22 @@ FROM piece_jointe pj
         JOIN utilisateur u ON u.id = pj.histo_createur_id
WHERE pj.histo_destruction IS NULL

UNION ALL

--Suppression pièces justificatives
SELECT pj.intervenant_id                             intervenant_id,
       '2 - Pièces justificatives'                   categorie,
       'Suppression pièce justificative : ' || tpj.libelle label,
       pj.histo_destruction                             histo_date,
       pj.histo_destructeur_id                          histo_createur_id,
       u.display_name                                histo_user,
       'glyphicon glyphicon-ok'                      icon,
       2                                             ordre
FROM piece_jointe pj
         JOIN type_piece_jointe tpj ON pj.type_piece_jointe_id = tpj.id
         JOIN utilisateur u ON u.id = pj.histo_destructeur_id
WHERE pj.histo_destruction IS NOT NULL

UNION ALL
--Validation des pièces justificatives
SELECT pj.intervenant_id                                  intervenant_id,
@@ -112,6 +129,24 @@ FROM
WHERE
 s.histo_destruction IS NULL

 UNION ALL
--Suppression 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_destruction                                                                histo_date,
       s.histo_destructeur_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_destructeur_id
  LEFT JOIN STRUCTURE str ON str.id = s.structure_id
WHERE
 s.histo_destruction IS NOT NULL

 UNION ALL
--Validation du service prévisionnel
SELECT s.intervenant_id                                                                          intervenant_id,