Commit b5ce377b authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Prise en compte du témoin 'corrections effectuées' de chaque thèse.

parent 0f460c81
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

1.3.5
-----

- Prise en compte du témoin "corrections effectuées" de chaque thèse.
- Mise à jour de la vue Apogée `V_SYGAL_INDIVIDU` : inclusion des co-encadrants (i.e. individus rattachés à une composante fictive 'COE').
- Mise à jour de la vue Apogée `V_SYGAL_THESE` : renommage du témoin "corrections effectuées".

1.3.4 (06/07/2020)
------------------

+1 −0
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ create table SYGAL_THESE
    COD_NEG_TRE VARCHAR2(1),
    ETA_RPD_THS VARCHAR2(1),
    CORRECTION_POSSIBLE VARCHAR2(11),
    CORRECTION_EFFECTUEE VARCHAR2(11),
    COD_ANU_PRM_IAE VARCHAR2(20),
    DAT_ABANDON DATE,
    DAT_TRANSFERT_DEP DATE,
+97 −84
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ select distinct
  and ind.cod_etu is not null         -- oui, oui, ça arrive
union
-- acteurs
  select "SOURCE_ID","TYPE","ID","SUPANN_ID","CIV","LIB_NOM_PAT_IND","LIB_NOM_USU_IND","LIB_PR1_IND","LIB_PR2_IND","LIB_PR3_IND","EMAIL","DATE_NAI_IND","COD_PAY_NAT","LIB_NAT" from (
select "SOURCE_ID","TYPE","ID","SUPANN_ID","CIV","LIB_NOM_PAT_IND","LIB_NOM_USU_IND","LIB_PR1_IND","LIB_PR2_IND","LIB_PR3_IND","EMAIL","DATE_NAI_IND","COD_PAY_NAT","LIB_NAT"
from (
         with acteur as (
             select
                 ths.cod_ths,
@@ -151,6 +152,17 @@ select distinct
                 null             as tem_rap_recu,
                 case when tjp.cod_roj in ( 'P', 'B', 'A' ) then tjp.cod_roj else null end as cod_roj_compl
             from ths_jur_per tjp
             union
             select
                 null             as cod_ths,
                 'B'              as cod_roj,
                 pic.cod_per,
                 null             as cod_etb,
                 null             as cod_cps,
                 null             as tem_rap_recu,
                 null             as cod_roj_compl
             from per_intervenir_cmp pic
             where pic.cod_cmp = 'COE' -- composante fictive associee aux co-encadrants
         )
         select distinct
             'apogee'                                                                                                as source_id,
@@ -276,7 +288,8 @@ select
    decode(ths.eta_rpd_ths,
           'N', 'obligatoire',
           'C', 'facultative',
           null) as correction_possible                    -- Témoin de corrections attendues
           null) as correction_possible,              -- Témoin de corrections attendues
    ths.tem_cor_ths as correction_effectuee           -- Témoin de corrections effectuees

from inscription_administrative iae
         join individu                   ind on ind.cod_ind = iae.cod_ind
+2 −0
Original line number Diff line number Diff line
@@ -620,6 +620,7 @@ WHERE A_COT.ASS_CODE = 'D_LAB_THESE'
        ecole_doct_id,
        COD_NEG_TRE,
        CORRECTION_POSSIBLE,
        CORRECTION_EFFECTUEE,
        DAT_AUT_SOU_THS,
        LIB_ETB_COT,
        LIB_PAY,
@@ -662,6 +663,7 @@ FROM
        etab_cot1.c_structure AS ecole_doct_id,
        '' AS COD_NEG_TRE,
     null AS CORRECTION_POSSIBLE,
     null AS CORRECTION_EFFECTUEE,
        th.DATE_PREV_SOUTENANCE AS DAT_AUT_SOU_THS,
        cot.NOM_ETABLISSEMENT_COTUTELLE as LIB_ETB_COT,
        cot.PAYS_COTUTELLE AS LIB_PAY,
+258 −0
Original line number Diff line number Diff line
# Version 1.3.5

## Sources PHP

Sur le serveur, placez-vous dans le répertoire du web service (sans doute `/var/www/sygal-import-ws`) 
puis lancez les commandes suivantes pour installer la nouvelle version :
```bash
git fetch && git fetch --tags && git checkout --force 1.3.5 && bash install.sh
```

Selon le moteur PHP que vous avez installé, rechargez le service, exemple :
  - php7.0-fpm         : `service php7.0-fpm reload`
  - apache2-mod-php7.0 : `service apache2 reload`


## Base de données

### Apogée

Passez le script ci-après pour appliquer les changements suivants :
- inclure les co-encadrants (saisis dans Apogée sous la forme d'individus rattachés à une composante fictive 'COE') ;
- prendre en compte le témoin "corrections effectuées" de chaque thèse.

```sql
create view V_SYGAL_INDIVIDU as
select distinct
    'apogee'                                            as source_id,       -- Id de la source
    'doctorant'                                         as type,
    to_char(ind.cod_etu)                                as id,              -- Numero etudiant
    to_char(ind.cod_etu)                                as supann_id,
    decode(ind.cod_civ, 1, 'M.', 'Mme')                 as civ,             -- Civilite etudiant
    ind.lib_nom_pat_ind                                 as lib_nom_pat_ind, -- Nom de famille etudiant
    coalesce(ind.lib_nom_usu_ind, ind.lib_nom_pat_ind)  as lib_nom_usu_ind, -- Nom usage etudiant
    initcap(coalesce(ind.lib_pr1_ind,'Aucun'))          as lib_pr1_ind,     -- Prenom 1 etudiant
    initcap(ind.lib_pr2_ind)                            as lib_pr2_ind,     -- Prenom 2 etudiant
    initcap(ind.lib_pr3_ind)                            as lib_pr3_ind,     -- Prenom 3 etudiant
    emails.email                                        as email,           -- Mail etudiant
    ind.date_nai_ind                                    as date_nai_ind,    -- Date naissance etudiant
    ind.cod_pay_nat                                     as cod_pay_nat,     -- Code nationalite
    pay.lib_nat                                         as lib_nat          -- Libelle nationalite
from these_hdr_sout ths
         join diplome        dip on dip.cod_dip     = ths.cod_dip
         join typ_diplome    tpd on tpd.cod_tpd_etb = dip.cod_tpd_etb
         join individu       ind on ind.cod_ind     = ths.cod_ind --and ind.cod_etu != 21009539 -- Exclusion du compte de test Aaron AAABA
         join pays           pay on pay.cod_pay     = ind.cod_pay_nat
         left join SYGAL_MV_EMAIL emails on emails.id = ind.cod_etu
where ths.cod_ths_trv     =  '1'  --  Exclusion des travaux
  and dip.cod_tpd_etb     in ( '39', '40' )
  and tpd.eta_ths_hdr_drt =  'T'  -- Inscription en these
  and tpd.tem_sante       =  'N'  -- Exclusion des theses d exercice
  and ind.cod_etu is not null         -- oui, oui, ça arrive
union
-- acteurs
select "SOURCE_ID","TYPE","ID","SUPANN_ID","CIV","LIB_NOM_PAT_IND","LIB_NOM_USU_IND","LIB_PR1_IND","LIB_PR2_IND","LIB_PR3_IND","EMAIL","DATE_NAI_IND","COD_PAY_NAT","LIB_NAT"
from (
         with acteur as (
             select
                 ths.cod_ths,
                 'D'              as cod_roj,
                 ths.cod_per_dir  as cod_per,
                 ths.cod_etb_dir  as cod_etb,
                 ths.cod_cps_dir  as cod_cps,
                 null             as tem_rap_recu,
                 null             as cod_roj_compl
             from these_hdr_sout ths
             where ths.cod_ths_trv = '1' and ths.cod_per_dir is not null
             union
             select
                 ths.cod_ths,
                 'D'              as cod_roj,
                 ths.cod_per_cdr  as cod_per,
                 ths.cod_etb_cdr  as cod_etb,
                 ths.cod_cps_cdr  as cod_cps,
                 null             as tem_rap_recu,
                 null             as cod_roj_compl
             from these_hdr_sout ths
             where ths.cod_ths_trv = '1' and ths.cod_per_cdr is not null
             union
             select
                 ths.cod_ths,
                 'D'              as cod_roj,
                 ths.cod_per_cdr2 as cod_per,
                 ths.cod_etb_cdr2 as cod_etb,
                 ths.cod_cps_cdr2 as cod_cps,
                 null             as tem_rap_recu,
                 null             as cod_roj_compl
             from these_hdr_sout ths
             where ths.cod_ths_trv = '1' and ths.cod_per_cdr2 is not null
             union
             select
                 trs.cod_ths,
                 'R'              as cod_roj,
                 trs.cod_per,
                 null             as cod_etb,
                 null             as cod_cps,
                 trs.tem_rap_recu,
                 null             as cod_roj_compl
             from ths_rap_sou trs
             union
             select
                 tjp.cod_ths,
                 'M'              as cod_roj,
                 tjp.cod_per,
                 tjp.cod_etb,
                 tjp.cod_cps,
                 null             as tem_rap_recu,
                 case when tjp.cod_roj in ( 'P', 'B', 'A' ) then tjp.cod_roj else null end as cod_roj_compl
             from ths_jur_per tjp
             union
             select
                 null             as cod_ths,
                 'B'              as cod_roj,
                 pic.cod_per,
                 null             as cod_etb,
                 null             as cod_cps,
                 null             as tem_rap_recu,
                 null             as cod_roj_compl
             from per_intervenir_cmp pic
             where pic.cod_cmp = 'COE' -- composante fictive associee aux co-encadrants
         )
         select distinct
             'apogee'                                                                                                as source_id,
             'acteur'                                                                                                as type,
             coalesce(regexp_replace(per.num_dos_har_per,'[^0-9]',''), 'COD_PER_'||act.cod_per)                      as id,     -- Code Harpege ou Apogee de l acteur
             regexp_replace(per.num_dos_har_per,'[^0-9]','')                                                         as supann_id, -- Code Harpege de l acteur
             initcap(per.cod_civ_per)                                                                                as civ,             -- Civilite acteur
             per.LIB_NOM_PAT_PER                                                                                     as lib_nom_pat_ind, -- Nom de famille acteur
             per.lib_nom_usu_per                                                                                     as lib_nom_usu_ind, -- Nom d'usage acteur
             per.lib_pr1_per                                                                                         as lib_pr1_ind,     -- Prenom 1 acteur
             null                                                                                                    as lib_pr2_ind,     -- Prenom 2 acteur
             null                                                                                                    as lib_pr3_ind,     -- Prenom 3 acteur
             emails.email                                                                                            as email,           -- Mail acteur
             per.dat_nai_per                                                                                         as date_nai_ind,    -- Date naissance acteur
             null                                                                                                    as cod_pay_nat,     -- Code nationalite
             null                                                                                                    as lib_nat          -- Libelle nationalite
         from acteur               act
                  join role_jury            roj on roj.cod_roj = act.cod_roj
                  join personnel            per on per.cod_per = act.cod_per
                  left join SYGAL_MV_EMAIL emails on emails.id = per.num_dos_har_per
     )
;

create or replace view V_SYGAL_THESE as
with inscription_administrative as (
    select distinct
        ths.cod_ind,
        iae.cod_dip,
        iae.cod_vrs_vdi
    from these_hdr_sout ths
             join ins_adm_etp    iae on iae.cod_ind = ths.cod_ind and ( iae.cod_dip, iae.cod_vrs_vdi ) in ( ( ths.cod_dip, ths.cod_vrs_vdi ), ( ths.cod_dip_anc, ths.cod_vrs_vdi_anc ) )
             join diplome        dip on dip.cod_dip = iae.cod_dip
             join typ_diplome    tpd on tpd.cod_tpd_etb = dip.cod_tpd_etb
    where ths.cod_ths_trv     =  '1'  -- Exclusion des travaux
      and iae.eta_iae         =  'E'  -- Inscription administrative non annulee
      and iae.eta_pmt_iae     =  'P'  -- Inscription administrative payee
      and dip.cod_tpd_etb     in ( '39', '40' )
      and tpd.eta_ths_hdr_drt =  'T'  -- Inscription en these
      and tpd.tem_sante       =  'N'  -- Exclusion des theses d exercice
),
     hierarchie_structures as (
         select
             cod_cmp_inf,
             cod_cmp_sup
         from cmp_cmp
         where connect_by_isleaf = 1
         connect by prior cod_cmp_sup = cod_cmp_inf
     ),
     ancienne_these as (
         select distinct
             cod_ind,
             cod_dip_anc,
             cod_vrs_vdi_anc,
             'A' eta_ths
         from these_hdr_sout
         where cod_ths_trv = '1'
           and cod_dip_anc is not null
     )

select
    'apogee' as source_id,                            -- Id de la source

    ---------- Enregistrement de la these --------
    ths.cod_ths as id,                                -- Identifiant de la these
    case when ths.eta_ths = 'S' and nvl ( ths.dat_sou_ths, sysdate + 1 ) > sysdate
             then 'E' else ths.eta_ths end eta_ths,     -- Etat de la these (E=En cours, A=Abandonnee, S=Soutenue, U=Transferee)
    ind.cod_etu as doctorant_id,                      -- Identifiant du doctorant
    ths.cod_dis,                                      -- Code discipline
    dis.lib_int1_dis,                                 -- Libellé discipline
    ths.lib_ths,                                      -- Titre de la these
    ths.cod_lng,                                      -- Code langue etrangere du titre
    ths.dat_deb_ths,                                  -- Date de 1ere inscription
    ths.dat_abandon,                                  -- Date d'abandon
    ths.dat_transfert_dep,                            -- Date de transfert

    edo.cod_nat_edo as ecole_doct_id,                 -- Identifiant de l'ecole doctorale
    ths.cod_eqr as unite_rech_id,                     -- Identifiant de l'unité de recherche principale

    ----------- Cotutelle ----------
    pay.lib_pay,                                      -- Denomination pays de cotutelle
    nvl ( etb.lib_web_etb, etb.lib_etb ) lib_etb_cot, -- Denomination etablissement de cotutelle
    ths.tem_avenant,                                  -- Avenant a la convention de cotutelle (O/N)

    ------- Organisation de la soutenance ------
    ths.dat_prev_sou,                                 -- Date previsionnelle de soutenance
    ths.tem_sou_aut_ths,                              -- Soutenance autorisee (O/N/null)
    ths.dat_aut_sou_ths,                              -- Date d autorisation de soutenance
    ths.dat_sou_ths,                                  -- Date de soutenance de la these

    ---------- Confidentialite --------
    ths.dat_fin_cfd_ths,                              -- Date de fin de confidentialite de la these

    ---------- Jury et resultats --------
    tre.cod_neg_tre,                                  -- Resultat positif (1) ou non (0)
    ths.eta_rpd_ths,                                  -- Reproduction de la these ( O=Oui / C=Oui avec corrections / N=Non )
    decode(ths.eta_rpd_ths,
           'N', 'obligatoire',
           'C', 'facultative',
           null) as correction_possible,              -- Témoin de corrections attendues
    ths.tem_cor_ths as correction_effectuee           -- Témoin de corrections effectuees

from inscription_administrative iae
         join individu                   ind on ind.cod_ind = iae.cod_ind
         join version_diplome            vdi on vdi.cod_dip = iae.cod_dip and vdi.cod_vrs_vdi = iae.cod_vrs_vdi
         join these_hdr_sout             ths on ths.cod_ind = iae.cod_ind and ths.cod_dip = iae.cod_dip and ths.cod_vrs_vdi = iae.cod_vrs_vdi
         left join ancienne_these        anc on anc.cod_ind = ths.cod_ind and anc.cod_dip_anc = ths.cod_dip and anc.cod_vrs_vdi_anc = ths.cod_vrs_vdi and anc.eta_ths = ths.eta_ths
         left join annee_uni             ans on ans.cod_anu = ths.daa_fin_ths
         left join ecole_doctorale       edo on edo.cod_edo = ths.cod_edo
         left join secteur_rch           ser on ser.cod_ser = ths.cod_ser
         left join equipe_rch            eqr on eqr.cod_eqr = ths.cod_eqr
         left join resultat_vdi          rvi on rvi.cod_ind = iae.cod_ind and rvi.cod_dip = iae.cod_dip and rvi.cod_vrs_vdi = iae.cod_vrs_vdi and rvi.cod_ses = '0' and rvi.cod_adm = '1' and rvi.cod_tre is not null
         left join annee_uni             anr on anr.cod_anu = rvi.cod_anu
         left join typ_resultat          tre on tre.cod_tre = rvi.cod_tre
         left join mention               men on men.cod_men = rvi.cod_men
         left join hierarchie_structures ccm on ccm.cod_cmp_inf = ths.cod_cmp
         left join composante            cmp on cmp.cod_cmp = nvl ( ccm.cod_cmp_sup, ths.cod_cmp )
         left join diplome_sise          dis on dis.cod_dis = ths.cod_dis
         left join etablissement         etb on etb.cod_etb = ths.cod_etb
         left join pays                  pay on pay.cod_pay = ths.cod_pay
         left join etablissement         sou on sou.cod_etb = ths.cod_etb_sou
         left join etablissement         ori on ori.cod_etb = ths.cod_etb_origine
         left join langue                lng on lng.cod_lng = ths.cod_lng
where
        ths.cod_ths_trv = '1' and --  Exclusion des travaux
        anc.cod_dip_anc is null
;

alter table SYGAL_THESE add CORRECTION_EFFECTUEE VARCHAR2(11);
```

### Physalis

La vue `V_SYGAL_INDIVIDU` ne nécessite aucune retouche puisqu'elle inclue déjà les co-encadrants.

La vue `V_SYGAL_THESE` doit avoir une nouvelle colonne `CORRECTION_EFFECTUEE`. 
Cette colonne doit valoir :
- 'N' lorsqu'aucune correction du manuscrit de thèse (second dépôt) n'est attendue ou lorsque les corrections attendues
  ne sont pas faites ;
- 'O' lorsque les corrections attendues sont faites.
Loading