Commit 77a8569c authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'php8_api' into dev

parents 800d99b5 a92efcb4
Loading
Loading
Loading
Loading
+1 −0
Changes for config/.gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
development.config.php
users.htpasswd

config/users.htpasswd

deleted100644 → 0
+0 −1
Changes for config/users.htpasswd: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
sygal-app:$apr1$Fekxnrdv$6Lvm1lj52B7b6Uyd8nFD2.
+1 −0
Changes for config/users.htpasswd.dist: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
user:password
+1 −3
Changes for docker-compose.yml: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@ services:
#    image: registre.unicaen.fr:5000/sygal-image-php8.0
    build:
      context: .
#      dockerfile: Dockerfile
      dockerfile: Dockerfile.full
      dockerfile: Dockerfile
      args:
        - PHP_VERSION=8.0
    container_name: sygal-container-new
@@ -38,7 +37,6 @@ services:
     - $HOME/.ssh:/root/.ssh
     - $HOME/.cache/composer:/root/.cache/composer
     - ../sygal-pegase-connect/vendor/unicaen/sygal-api:/sygal-api
     - ./tmp/sygal.inscription_resource_logger.log:/var/log/sygal.inscription_resource_logger.log
    working_dir: /app
    networks:
      - sygalnet
+128 −75
Changes for module/InscriptionAdministrative/data/tmp_tables.sql: 128 added lines, 75 removed lines.
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ create table tmp_inscription_administrative
    source_code varchar(64) not null, -- Id Pegase inscription (merge request en cours)

    doctorant_id varchar(64) not null,
    ecole_doctorale_id varchar(32),
    ecole_doct_id varchar(32),

    no_candidat varchar(32),
    date_inscription date,
@@ -55,6 +55,12 @@ create table tmp_inscription_administrative
    regime_inscription_libelle varchar(64),
    statut_inscription varchar(32),

    periode_code varchar(32) not null,
    periode_libelle varchar(32) not null,
    periode_date_debut date not null,
    periode_date_fin date,
    periode_annee_universitaire smallint,

    histo_creation timestamp(0) default ('now'::text)::timestamp(0) without time zone not null,
    histo_createur_id bigint not null,
    histo_modification timestamp(0),
@@ -71,86 +77,133 @@ create table tmp_inscription_administrative
     on tmp_inscription_administrative (source_id, source_code);



--drop table if exists tmp_inscription_administrative_periode;
create table tmp_inscription_administrative_periode
create table inscription_administrative
(
    id bigserial,
    insert_date timestamp(0) default ('now'::text)::timestamp without time zone,
    source_id bigint not null,
    id bigserial constraint inscription_administrative_pkey primary key,
    source_id bigint not null constraint inscription_administrative_source_fk references source,
    source_code varchar(64) not null,

    inscription_administrative_id varchar(64) not null,

    code varchar(32) not null,
    libelle varchar(32) not null,
    date_debut date not null,
    date_fin date,
    annee_universitaire smallint,

    doctorant_id bigint not null constraint inscription_administrative_doctorant_fk references doctorant,
    ecole_doct_id bigint constraint inscription_administrative_ecole_doct_fk references ecole_doct,
    no_candidat varchar(32),
    date_inscription date,
    date_annulation date,
    cesure varchar(32),
    chemin varchar(128),
    formation varchar(64),
    mobilite varchar(32),
    origine varchar(32),
    principale boolean,
    regime_inscription_libelle varchar(64),
    statut_inscription varchar(32),
    periode_code varchar(32) not null,
    periode_libelle varchar(32) not null,
    periode_date_debut date not null,
    periode_date_fin date,
    periode_annee_universitaire smallint,
    histo_creation timestamp(0) default ('now'::text)::timestamp(0) without time zone not null,
    histo_createur_id bigint not null,
    histo_modification timestamp(0),
    histo_modification timestamp(0) without time zone,
    histo_modificateur_id bigint,
    histo_destruction timestamp(0),
    histo_destruction timestamp(0) without time zone,
    histo_destructeur_id bigint
);

create index tmp_inscription_administrative_periode_source_code_index
    on tmp_inscription_administrative_periode (source_code);
create index tmp_inscription_administrative_periode_source_id_index
    on tmp_inscription_administrative_periode (source_id);
create unique index tmp_inscription_administrative_periode_unique_index
    on tmp_inscription_administrative_periode (source_id, source_code);



-- --drop table if exists tmp_inscrit;
-- create table tmp_inscrit
-- (
--     id bigserial,
--     insert_date timestamp(0) default ('now'::text)::timestamp,
--     source_id bigint not null,
--     source_code varchar(64) not null,
--
--     INE varchar(32),
--     nom_de_naissance varchar(64),
--     nom_usuel varchar(64),
--     prenom varchar(64),
--     prenom_usage varchar(64),
--     deuxieme_prenom varchar(64),
--     troisieme_prenom varchar(64),
--     genre varchar(128),
--     mail_personnel varchar(128),
--     mail_urgence varchar(128),
--     telephone_personnel varchar(32),
--     telephone_urgence varchar(32),
--     code varchar(64),
--
--     commune_de_naissance varchar(64),
--     commune_de_naissance_etranger varchar(64),
--     date_de_naissance varchar(32),
--     libelle_commune_de_naissance varchar(64),
--     pays_de_naissance varchar(64),
--     libelle_pays_de_naissance varchar(64),
--     libelle_nationalite varchar(64),
--     nationalite varchar(64),
--     deuxieme_nationalite varchar(64),
--     libelle_deuxieme_nationalite varchar(64),
--     date_d_obtention_de_la_deuxieme_nationalite varchar(32),
--
--     histo_creation timestamp(0) default ('now'::text)::timestamp(0) not null,
--     histo_createur_id bigint not null,
--     histo_modification timestamp(0),
--     histo_modificateur_id bigint,
--     histo_destruction timestamp(0),
--     histo_destructeur_id bigint
-- );
--
-- create index tmp_inscrit_source_code_index
--     on tmp_inscrit (source_code);
-- create index tmp_inscrit_source_id_index
--     on tmp_inscrit (source_id);
-- create unique index tmp_inscrit_unique_index
--     on tmp_inscrit (source_id, source_code);
create index inscription_administrative_source_code_index
    on inscription_administrative (source_code);
create index inscription_administrative_source_id_index
    on inscription_administrative (source_id);
create unique index inscription_administrative_unique_index
    on inscription_administrative (source_id, source_code);

create index inscription_administrative_doctorant_id_idx
    on inscription_administrative (doctorant_id);

create index inscription_administrative_ecole_doct_id_idx
    on inscription_administrative (ecole_doct_id);

create index inscription_administrative_hcfk_idx
    on inscription_administrative (histo_createur_id);

create index inscription_administrative_hdfk_idx
    on inscription_administrative (histo_destructeur_id);

create index inscription_administrative_hmfk_idx
    on inscription_administrative (histo_modificateur_id);


create or replace view src_inscription_administrative as
SELECT null::bigint as id,
    tmp.source_code,
    src.id as source_id,
    d.id as doctorant_id,
    ed.id as ecole_doct_id,
    tmp.no_candidat,
    tmp.date_inscription,
    tmp.date_annulation,
    tmp.cesure,
    tmp.chemin,
    tmp.formation,
    tmp.mobilite,
    tmp.origine,
    tmp.principale,
    tmp.regime_inscription_libelle,
    tmp.statut_inscription,
    tmp.periode_code,
    tmp.periode_libelle,
    tmp.periode_date_debut,
    tmp.periode_date_fin,
    tmp.periode_annee_universitaire
FROM tmp_inscription_administrative tmp
         JOIN source src ON src.id = tmp.source_id
         JOIN doctorant d ON d.source_code = tmp.doctorant_id
         LEFT JOIN ecole_doct ed ON ed.source_code = tmp.ecole_doct_id
;

alter table tmp_doctorant alter column ine set not null;



-- doctorant.ine en double
with tmp as (
    select source_id, ine, count(*) from doctorant
    --where histo_destruction is null
    group by source_id, ine having count(*) > 1
)
select i.nom_usuel, i.prenom1, d.* from doctorant d
join individu i on d.individu_id = i.id and i.histo_destruction is null
join tmp on tmp.ine = d.ine
--where d.histo_destruction is not null and not exists (select * from these where doctorant_id = d.id)
order by d.ine;





-- colonne de sauvegarde du source_code :
alter table doctorant add source_code_sav varchar(64);
update doctorant set source_code_sav = source_code;
-- update doctorant set source_code = source_code_sav;

drop index doctorant_source_code_uniq;
create unique index doctorant_source_code_uniq_1 on doctorant (source_id, source_code, histo_destruction) where (histo_destruction IS NOT NULL);
create unique index doctorant_source_code_uniq_2 on doctorant (source_id, source_code) where (histo_destruction IS NULL);
--create unique index doctorant_source_code_uniq on doctorant (source_code);

-- correction des source_code
update doctorant set source_code = substr(source_code, 0, strpos(source_code, '::')) || '::' || coalesce(trim(ine), gen_random_uuid()::text)
    where histo_destruction is null;

-- simulation de l'INE comme source_code dans src_doctorant
create or replace view src_doctorant(id, source_code, code_apprenant_in_source, ine, source_id, individu_id, etablissement_id) as
SELECT NULL::text AS id,
       --tmp.source_code,
       (substr(tmp.source_code, 0, strpos(tmp.source_code, '::')) || '::' || trim(ine)) ::varchar(64) as source_code,
       tmp.code_apprenant_in_source,
       tmp.ine,
       src.id     AS source_id,
       i.id       AS individu_id,
       e.id       AS etablissement_id
FROM tmp_doctorant tmp
         JOIN source src ON src.id = tmp.source_id
         JOIN etablissement e ON e.id = src.etablissement_id
         JOIN individu i ON i.source_code::text = tmp.individu_id::text;
Loading