Commit 10508ab9 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Script SQL incomplet pour la 13.8.0

parent a7c02d49
Loading
Loading
Loading
Loading
+238
Changes for doc/release-notes/v13/13.8.0/03_correction.sql: 238 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -418,3 +418,241 @@ FROM (SELECT t_1.id AS these_id,
                     JOIN wf_etape e ON e.code::text = 'REMISE_EXEMPLAIRE_PAPIER_THESE_CORRIGEE'::text
                     LEFT JOIN tmp_last tl ON tl.these_id = t_1.id) alias26(these_id, etape_id, code, ordre, franchie, "?column?", "?column?_1")) t
         JOIN v_wf_etape_pertin v ON t.these_id::numeric = v.these_id AND t.etape_id::numeric = v.etape_id;





create or replace view v_wf_etape_pertin(these_id, etape_id, code, ordre, id) as
SELECT alias38.these_id::numeric                                                   AS these_id,
       alias38.etape_id::numeric                                                   AS etape_id,
       alias38.code,
       alias38.ordre,
       row_number() OVER (ORDER BY 1::integer, 2::integer, 3::integer, 4::integer) AS id
FROM (SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'VALIDATION_PAGE_DE_COUVERTURE'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_ORIGINALE'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'AUTORISATION_DIFFUSION_THESE'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ATTESTATIONS'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'SIGNALEMENT_THESE'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ARCHIVABILITE_VERSION_ORIGINALE'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_ARCHIVAGE'::text
               JOIN v_situ_archivab_vo situ ON situ.these_id = t.id AND situ.est_valide = false
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ARCHIVABILITE_VERSION_ARCHIVAGE'::text
               JOIN v_situ_archivab_vo situ ON situ.these_id = t.id AND situ.est_valide = false
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'VERIFICATION_VERSION_ARCHIVAGE'::text
               JOIN v_situ_archivab_va situ ON situ.these_id = t.id AND situ.est_valide = true
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'RDV_BU_SAISIE_DOCTORANT'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'RDV_BU_SAISIE_BU'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'RDV_BU_VALIDATION_BU'::text
      WHERE t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text])
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_ORIGINALE_CORRIGEE'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'AUTORISATION_DIFFUSION_THESE_VERSION_CORRIGEE'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ATTESTATIONS_VERSION_CORRIGEE'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ARCHIVABILITE_VERSION_ORIGINALE_CORRIGEE'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_ARCHIVAGE_CORRIGEE'::text
               JOIN v_situ_archivab_voc situ ON situ.these_id = t.id AND situ.est_valide = false
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'ARCHIVABILITE_VERSION_ARCHIVAGE_CORRIGEE'::text
               JOIN v_situ_archivab_voc situ ON situ.these_id = t.id AND situ.est_valide = false
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'VERIFICATION_VERSION_ARCHIVAGE_CORRIGEE'::text
               JOIN v_situ_archivab_vac situ ON situ.these_id = t.id AND situ.est_valide = true
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_CORRIGEE_VALIDATION_DOCTORANT'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'DEPOT_VERSION_CORRIGEE_VALIDATION_DIRECTEUR'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
      UNION ALL
      SELECT t.id AS these_id,
             e.id AS etape_id,
             e.code,
             e.ordre
      FROM these t
               JOIN wf_etape e ON e.code::text = 'REMISE_EXEMPLAIRE_PAPIER_THESE_CORRIGEE'::text
      WHERE (t.correc_autorisee IS NOT NULL AND t.correc_autorisee <> 'aucune'::text OR
             t.correc_autorisee_forcee IS NOT NULL AND t.correc_autorisee_forcee::text <> 'aucune'::text OR
             t.correc_effectuee::text = 'O'::text)
        AND (t.etat_these::text = ANY (ARRAY ['E'::character varying::text, 'S'::character varying::text]))
        AND (EXISTS (SELECT f.code,
                            f.libelle,
                            f.enabled_start_date,
                            f.enabled_end_date,
                            f.config,
                            f.ordre
                     FROM feature f
                     WHERE f.code::text = 'FournirExemplairePapierTheseFeature'::text
                       AND t.date_soutenance >= f.enabled_start_date
                       AND t.date_soutenance <=
                           COALESCE(f.enabled_end_date::timestamp with time zone, CURRENT_TIMESTAMP)))
        AND (EXISTS (SELECT d.id
                     FROM diffusion d
                     WHERE d.these_id = t.id
                       AND d.version_corrigee = true
                       AND (d.autoris_mel = ANY (ARRAY [0, 1]))))) alias38;