Commit 2618843c authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'release_10.0.2'

parents e0c60064 f3b62728
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

10.0.2
-----
- [FIX] Vue v_extract_theses erronée (ERREUR : la colonne code_sise_disc n'existe pas).
- [FIX] Module Soutenance : dépôt impossible des documents liés à la soutenance
- [FIX] Impossibilité d'ajouter un co-encadrant à une thèse
- [FIX] Plantage de la validation des corrections par le président du jury (vue v_situ_depot_vc_valid_pres erronée).  

10.0.1
-----
- Possibilité d'ajouter les formulaires nécessaires pour la soutenance HDR depuis la fiche d'un établissement
+263 −0
Original line number Diff line number Diff line
--
-- 10.0.2
--

drop view v_extract_theses;

create view v_extract_theses
            (date_extraction, id, civilite, nom_usuel, nom_patronymique, prenom1, date_naissance, nationalite,
             email_pro, email_contact, ine, num_etudiant, num_these, titre, code_sise_disc, lib_disc, dirs, codirs,
             coencs, etab_lib, ed_code, ed_lib, ur_code, ur_lib, lib_etab_cotut, lib_pays_cotut, libelle_titre_acces,
             libelle_etb_titre_acces, financ_origs_visibles, financ_annees, financ_origs, financ_compls, financ_types,
             domaines, date_prem_insc, date_abandon, date_transfert, date_soutenance, date_fin_confid, duree_these_mois,
             date_depot_vo, date_depot_voc, etat_these, soutenance_autoris, confidentielle, resultat, correc_autorisee,
             depot_pdf, depot_annexe, autoris_mel, autoris_embargo_duree, autoris_motif, dernier_rapport_activite,
             dernier_rapport_csi)
as
WITH mails_contacts AS (SELECT DISTINCT mail_confirmation.individu_id,
                                        first_value(mail_confirmation.email)
                                        OVER (PARTITION BY mail_confirmation.individu_id ORDER BY mail_confirmation.id DESC) AS email
                        FROM mail_confirmation
                        WHERE mail_confirmation.etat::text = 'C'::text),
     directeurs AS (SELECT a.these_id,
                           string_agg(concat(i.nom_usuel, ' ', i.prenom1), ' ; '::text) AS identites
                    FROM acteur_these a
                             JOIN role r ON a.role_id = r.id AND r.code::text = 'D'::text
                             JOIN individu i ON a.individu_id = i.id
                    WHERE a.histo_destruction IS NULL
                    GROUP BY a.these_id),
     codirecteurs AS (SELECT a.these_id,
                             string_agg(concat(i.nom_usuel, ' ', i.prenom1), ' ; '::text) AS identites
                      FROM acteur_these a
                               JOIN role r ON a.role_id = r.id AND (r.code::text = ANY
                                                                    (ARRAY ['C'::character varying::text, 'K'::character varying::text]))
                               JOIN individu i ON a.individu_id = i.id
                      WHERE a.histo_destruction IS NULL
                      GROUP BY a.these_id),
     coencadrants AS (SELECT a.these_id,
                             string_agg(concat(i.nom_usuel, ' ', i.prenom1), ' ; '::text) AS identites
                      FROM acteur_these a
                               JOIN role r ON a.role_id = r.id AND (r.code::text = ANY
                                                                    (ARRAY ['B'::character varying::text, 'N'::character varying::text]))
                               JOIN individu i ON a.individu_id = i.id
                      WHERE a.histo_destruction IS NULL
                      GROUP BY a.these_id),
     financements AS (SELECT f_1.these_id,
                             string_agg(
                                     CASE o.visible
                                         WHEN true THEN 'O'::text
                                         ELSE 'N'::text
                                         END, ' ; '::text)                               AS financ_origs_visibles,
                             string_agg(f_1.annee::character varying::text, ' ; '::text) AS financ_annees,
                             string_agg(o.libelle_long::text, ' ; '::text)               AS financ_origs,
                             string_agg(f_1.complement_financement::text, ' ; '::text)   AS financ_compls,
                             string_agg(f_1.libelle_type_financement::text, ' ; '::text) AS financ_types
                      FROM financement f_1
                               JOIN origine_financement o ON f_1.origine_financement_id = o.id
                      WHERE f_1.histo_destruction IS NULL
                      GROUP BY f_1.these_id),
     domaines AS (SELECT udl.unite_id,
                         string_agg(d_1.libelle::text, ' ; '::text) AS libelles
                  FROM unite_domaine_linker udl
                           JOIN domaine_scientifique d_1 ON d_1.id = udl.domaine_id
                  GROUP BY udl.unite_id),
     depots_vo_pdf AS (SELECT DISTINCT ft.these_id,
                                       first_value(vf.code)
                                       OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS version_code,
                                       first_value(f_1.histo_creation)
                                       OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS histo_creation
                       FROM fichier_these ft
                                JOIN fichier f_1 ON ft.fichier_id = f_1.id AND f_1.histo_destruction IS NULL
                                JOIN nature_fichier nf ON f_1.nature_id = nf.id AND nf.code::text = 'THESE_PDF'::text
                                JOIN version_fichier vf
                                     ON f_1.version_fichier_id = vf.id AND vf.code::text = 'VO'::text),
     depots_voc_pdf AS (SELECT DISTINCT ft.these_id,
                                        first_value(vf.code)
                                        OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS version_code,
                                        first_value(f_1.histo_creation)
                                        OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS histo_creation
                        FROM fichier_these ft
                                 JOIN fichier f_1 ON ft.fichier_id = f_1.id AND f_1.histo_destruction IS NULL
                                 JOIN nature_fichier nf ON f_1.nature_id = nf.id AND nf.code::text = 'THESE_PDF'::text
                                 JOIN version_fichier vf
                                      ON f_1.version_fichier_id = vf.id AND vf.code::text = 'VOC'::text),
     depots_non_pdf AS (SELECT DISTINCT ft.these_id,
                                        first_value(vf.code)
                                        OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS version_code,
                                        first_value(f_1.histo_creation)
                                        OVER (PARTITION BY ft.these_id ORDER BY ft.id DESC) AS histo_creation
                        FROM fichier_these ft
                                 JOIN fichier f_1 ON ft.fichier_id = f_1.id AND f_1.histo_destruction IS NULL
                                 JOIN nature_fichier nf ON f_1.nature_id = nf.id AND nf.code::text = 'FICHIER_NON_PDF'::text
                                 JOIN version_fichier vf ON f_1.version_fichier_id = vf.id AND (vf.code::text = ANY
                                                                                                (ARRAY ['VO'::character varying::text, 'VOC'::character varying::text]))),
     diffusion AS (SELECT DISTINCT d_1.these_id,
                                   first_value(d_1.autoris_mel)
                                   OVER (PARTITION BY d_1.these_id ORDER BY d_1.version_corrigee DESC, d_1.id DESC) AS autoris_mel,
                                   first_value(d_1.autoris_embargo_duree)
                                   OVER (PARTITION BY d_1.these_id ORDER BY d_1.version_corrigee DESC, d_1.id DESC) AS autoris_embargo_duree,
                                   first_value(d_1.autoris_motif)
                                   OVER (PARTITION BY d_1.these_id ORDER BY d_1.version_corrigee DESC, d_1.id DESC) AS autoris_motif
                   FROM public.diffusion d_1
                   WHERE d_1.histo_destruction IS NULL),
     dernier_rapport_activite AS (SELECT DISTINCT ra.these_id,
                                                  first_value(ra.annee_univ)
                                                  OVER (PARTITION BY ra.these_id ORDER BY ra.annee_univ DESC) AS annee
                                  FROM rapport_activite ra
                                  WHERE ra.histo_destruction IS NULL),
     dernier_rapport_csi AS (SELECT DISTINCT r.these_id,
                                             first_value(r.annee_univ)
                                             OVER (PARTITION BY r.these_id ORDER BY r.annee_univ DESC) AS annee
                             FROM rapport r
                                      JOIN type_rapport tr
                                           ON r.type_rapport_id = tr.id AND tr.code::text = 'RAPPORT_CSI'::text
                             WHERE r.histo_destruction IS NULL)
SELECT to_char(now(), 'DD/MM/YYYY HH24:MI:SS'::text)                                  AS date_extraction,
       th.id,
       di.civilite,
       di.nom_usuel,
       di.nom_patronymique,
       di.prenom1,
       to_char(di.date_naissance, 'DD/MM/YYYY'::text)                                 AS date_naissance,
       di.nationalite,
       COALESCE(dic.email, di.email)                                                  AS email_pro,
       mc.email                                                                       AS email_contact,
       d.ine,
       substr(d.source_code::text, strpos(d.source_code::text, '::'::text) + 2)       AS num_etudiant,
       th.source_code                                                                 AS num_these,
       th.titre,
       disc.code                                                                      AS code_sise_disc,
       disc.libelle                                                                   AS lib_disc,
       dirs.identites                                                                 AS dirs,
       codirs.identites                                                               AS codirs,
       coencs.identites                                                               AS coencs,
       se.libelle                                                                     AS etab_lib,
       sed.code                                                                       AS ed_code,
       sed.libelle                                                                    AS ed_lib,
       sur.code                                                                       AS ur_code,
       sur.libelle                                                                    AS ur_lib,
       th.lib_etab_cotut,
       th.lib_pays_cotut,
       ta.libelle_titre_acces,
       ta.libelle_etb_titre_acces,
       f.financ_origs_visibles,
       f.financ_annees,
       f.financ_origs,
       f.financ_compls,
       f.financ_types,
       dom.libelles                                                                   AS domaines,
       to_char(th.date_prem_insc, 'DD/MM/YYYY'::text)                                 AS date_prem_insc,
       to_char(th.date_abandon, 'DD/MM/YYYY'::text)                                   AS date_abandon,
       to_char(th.date_transfert, 'DD/MM/YYYY'::text)                                 AS date_transfert,
       to_char(th.date_soutenance, 'DD/MM/YYYY'::text)                                AS date_soutenance,
       to_char(th.date_fin_confid, 'DD/MM/YYYY'::text)                                AS date_fin_confid,
       round((th.date_soutenance::date - th.date_prem_insc::date)::numeric / 30.5, 2) AS duree_these_mois,
       to_char(depots_vo_pdf.histo_creation, 'DD/MM/YYYY'::text)                      AS date_depot_vo,
       to_char(depots_voc_pdf.histo_creation, 'DD/MM/YYYY'::text)                     AS date_depot_voc,
       CASE th.etat_these
           WHEN 'E'::text THEN 'En cours'::text
           WHEN 'A'::text THEN 'Abandonnée'::text
           WHEN 'S'::text THEN 'Soutenue'::text
           WHEN 'U'::text THEN 'Transférée'::text
           ELSE NULL::text
           END                                                                        AS etat_these,
       th.soutenance_autoris,
       CASE
           WHEN th.date_fin_confid IS NULL OR th.date_fin_confid < now() THEN 'N'::text
           ELSE 'O'::text
           END                                                                        AS confidentielle,
       th.resultat,
       CASE
           WHEN th.correc_autorisee_forcee::text = 'aucune'::text THEN 'N'::character varying
           ELSE COALESCE(th.correc_autorisee_forcee, th.correc_autorisee)
           END                                                                        AS correc_autorisee,
       CASE
           WHEN depots_vo_pdf.these_id IS NULL AND depots_voc_pdf.these_id IS NULL THEN 'N'::text
           ELSE 'O'::text
           END                                                                        AS depot_pdf,
       CASE
           WHEN depots_non_pdf.these_id IS NULL THEN 'N'::text
           ELSE 'O'::text
           END                                                                        AS depot_annexe,
       CASE diff.autoris_mel
           WHEN 0 THEN 'Non'::text
           WHEN 1 THEN 'Oui, avec embargo'::text
           WHEN 2 THEN 'Oui, immédiatement'::text
           ELSE NULL::text
           END                                                                        AS autoris_mel,
       diff.autoris_embargo_duree,
       diff.autoris_motif,
       CASE
           WHEN ract.annee IS NOT NULL THEN concat(ract.annee, '/', ract.annee + 1)
           ELSE NULL::text
           END                                                                        AS dernier_rapport_activite,
       CASE
           WHEN rcsi.annee IS NOT NULL THEN concat(rcsi.annee, '/', rcsi.annee + 1)
           ELSE NULL::text
           END                                                                        AS dernier_rapport_csi
FROM these th
         JOIN doctorant d ON th.doctorant_id = d.id
         JOIN individu di ON d.individu_id = di.id
         LEFT JOIN individu_compl dic ON di.id = dic.individu_id AND dic.histo_destruction IS NULL
         LEFT JOIN mails_contacts mc ON mc.individu_id = di.id
         JOIN etablissement e ON d.etablissement_id = e.id
         JOIN structure se ON e.structure_id = se.id
         LEFT JOIN discipline_sise disc ON disc.id = th.discipline_sise_id
         LEFT JOIN ecole_doct ed ON th.ecole_doct_id = ed.id
         LEFT JOIN structure sed ON ed.structure_id = sed.id
         LEFT JOIN unite_rech ur ON th.unite_rech_id = ur.id
         LEFT JOIN structure sur ON ur.structure_id = sur.id
         LEFT JOIN domaines dom ON dom.unite_id = ur.id
         LEFT JOIN titre_acces ta ON th.id = ta.these_id AND ta.histo_destruction IS NULL
         LEFT JOIN financements f ON th.id = f.these_id
         LEFT JOIN directeurs dirs ON dirs.these_id = th.id
         LEFT JOIN codirecteurs codirs ON codirs.these_id = th.id
         LEFT JOIN coencadrants coencs ON coencs.these_id = th.id
         LEFT JOIN depots_vo_pdf ON depots_vo_pdf.these_id = th.id
         LEFT JOIN depots_voc_pdf ON depots_voc_pdf.these_id = th.id
         LEFT JOIN depots_non_pdf ON depots_non_pdf.these_id = th.id
         LEFT JOIN diffusion diff ON diff.these_id = th.id
         LEFT JOIN dernier_rapport_activite ract ON ract.these_id = th.id
         LEFT JOIN dernier_rapport_csi rcsi ON rcsi.these_id = th.id
WHERE th.histo_destruction IS NULL;


create or replace view v_situ_depot_vc_valid_pres(id, these_id, individu_id, valide) as
WITH validations_attendues AS (
    SELECT a.these_id,
           a.individu_id,
           tv.id AS type_validation_id
    FROM acteur_these a
             JOIN role r ON a.role_id = r.id AND r.code::text = 'P'::text
             JOIN type_validation tv ON tv.code::text = 'CORRECTION_THESE'::text
    WHERE a.histo_destruction IS NULL AND NOT (EXISTS (
        SELECT vt.id,
               v.type_validation_id,
               vt.these_id,
               vt.individu_id,
               vt.histo_creation,
               vt.histo_createur_id,
               vt.histo_modification,
               vt.histo_modificateur_id,
               vt.histo_destruction,
               vt.histo_destructeur_id,
               tv.id,
               tv.code,
               tv.libelle
        FROM validation_these vt
                 join validation v on v.id = vt.validation_id
                 JOIN type_validation tv ON v.type_validation_id = tv.id AND tv.code::text = 'CORRECTION_THESE'::text
        WHERE vt.these_id = a.these_id AND v.type_validation_id = tv.id AND vt.histo_destruction IS NULL))
)
SELECT (va.these_id || '_'::text) || va.individu_id AS id,
       va.these_id,
       va.individu_id,
       CASE
           WHEN v.id IS NOT NULL THEN 1
           ELSE 0
           END AS valide
FROM validations_attendues va
         LEFT JOIN validation_these vt ON vt.these_id = va.these_id AND vt.individu_id = va.individu_id AND vt.histo_destructeur_id IS NULL
         left join validation v on v.id = vt.validation_id AND v.type_validation_id = va.type_validation_id;

drop view if exists v_situ_depot_vc_valid_pres_new;
+14 −0
Original line number Diff line number Diff line
# Version 10.0.2

## 1. Sur le serveur d'application

- Placez-vous dans le répertoire de l'application puis lancez la commande suivante
  pour installer la nouvelle version :

  ```bash
  git fetch --tags && git checkout --force 10.0.2 && bash ./install.sh
  ```

## 2. Dans la base de données

Exécutez dans l'ordre les scripts SQL présents dans le sous-répertoire portant le nom de la version.
+2 −2
Original line number Diff line number Diff line
@@ -10,15 +10,15 @@

use Depot\Controller\Plugin\UrlFichierHDR;
use Depot\Controller\Plugin\UrlFichierThese;
use Depot\Provider\Privilege\DepotPrivileges;
use Soutenance\Entity\Etat;
use Soutenance\Entity\Proposition;
use Soutenance\Provider\Privilege\PropositionPrivileges;
use Soutenance\Service\Horodatage\HorodatageService;
use These\Entity\Db\These;

$object = $proposition->getObject();
$apprenant = $object instanceof These ? "doctorant" : "candidat";
$canGererDocument = $this->isAllowed($object, PropositionPrivileges::PROPOSITION_MODIFIER_GESTION);
$canGererDocument = $this->isAllowed($object, DepotPrivileges::THESE_FICHIER_DIVERS_TELEVERSER);
?>

<div class="box card">
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ return [
                        'privileges' => [
                            CoEncadrantPrivileges::COENCADRANT_GERER,
                        ],
                        'resources' => ['Acteur'],
                        'resources' => ['ActeurThese'],
                        'assertion'  => ActeurTheseAssertion::class,
                    ],
                ],