Loading CHANGELOG.md +1 −0 Changes for CHANGELOG.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ Journal des modifications - [SOUTENANCE] Mise en place des templates associés aux mails - [DEPOT] Retouche du texte de mail concernant la page de couverture générée. - [FIX] Pour se voir attribuer par l'application le rôle Doctorant, il faut désormais avoir une thèse soit en cours soit soutenue. - Amélioration de la fonction de transfert de thèse en bdd. 6.0.6 ----- Loading doc/release-notes/v6.0.7.md +60 −0 Changes for doc/release-notes/v6.0.7.md: 60 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -235,4 +235,64 @@ select profil.id, role.id from profil join role on role.code = profil.role_id where profil.role_id = 'GEST_FORM'; -- -- Amélioration du transfert de thèse. -- create table transfert_these_log ( id bigserial primary key, table_name varchar(80) not null, column_name varchar(80) not null, from_id bigint not null, to_id bigint not null, created_on timestamp default current_timestamp not null ); drop function if exists transfert_these(bigint,bigint); create or replace function transfert_these(fromtheseid bigint, totheseid bigint, excepttables varchar[] = null) returns void language plpgsql as $$declare v_data record; v_id bigint; v_except_tables varchar[] = ARRAY['acteur', 'financement', 'these_annee_univ', 'titre_acces']; BEGIN if excepttables is not null then v_except_tables = excepttables; end if; raise info 'Transfert des infos liées à la thèse % vers la thèse %...', fromtheseid, totheseid; for v_data in select table_name, column_name from information_schema.columns where column_name ilike '%these_id%' and table_name not ilike 'v\_%' and table_name not ilike 'src_%' and table_name not ilike 'tmp_%' and table_name not ilike '%\_log' and lower(table_name) <> all(v_except_tables) order by table_name loop execute 'update '||v_data.table_name||' set '||v_data.column_name||' = $1 where '||v_data.column_name||' = $2 returning id' using totheseid, fromtheseid into v_id; if v_id is null then raise info ' - %.% : rien à faire', v_data.table_name, v_data.column_name; continue; end if; insert into transfert_these_log(table_name, column_name, from_id, to_id) values (v_data.table_name, v_data.column_name, fromtheseid, totheseid); raise info ' - %.% : OK', v_data.table_name, v_data.column_name; end loop; refresh materialized view mv_recherche_these; raise info 'Terminé.'; raise info '(Vue matérialisée ''%'' mise à jour.)', 'mv_recherche_these'; raise info '(Remplacements éventuels inscrits dans la table ''%''.)', 'transfert_these_log'; END $$; ``` No newline at end of file Loading
CHANGELOG.md +1 −0 Changes for CHANGELOG.md: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ Journal des modifications - [SOUTENANCE] Mise en place des templates associés aux mails - [DEPOT] Retouche du texte de mail concernant la page de couverture générée. - [FIX] Pour se voir attribuer par l'application le rôle Doctorant, il faut désormais avoir une thèse soit en cours soit soutenue. - Amélioration de la fonction de transfert de thèse en bdd. 6.0.6 ----- Loading
doc/release-notes/v6.0.7.md +60 −0 Changes for doc/release-notes/v6.0.7.md: 60 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -235,4 +235,64 @@ select profil.id, role.id from profil join role on role.code = profil.role_id where profil.role_id = 'GEST_FORM'; -- -- Amélioration du transfert de thèse. -- create table transfert_these_log ( id bigserial primary key, table_name varchar(80) not null, column_name varchar(80) not null, from_id bigint not null, to_id bigint not null, created_on timestamp default current_timestamp not null ); drop function if exists transfert_these(bigint,bigint); create or replace function transfert_these(fromtheseid bigint, totheseid bigint, excepttables varchar[] = null) returns void language plpgsql as $$declare v_data record; v_id bigint; v_except_tables varchar[] = ARRAY['acteur', 'financement', 'these_annee_univ', 'titre_acces']; BEGIN if excepttables is not null then v_except_tables = excepttables; end if; raise info 'Transfert des infos liées à la thèse % vers la thèse %...', fromtheseid, totheseid; for v_data in select table_name, column_name from information_schema.columns where column_name ilike '%these_id%' and table_name not ilike 'v\_%' and table_name not ilike 'src_%' and table_name not ilike 'tmp_%' and table_name not ilike '%\_log' and lower(table_name) <> all(v_except_tables) order by table_name loop execute 'update '||v_data.table_name||' set '||v_data.column_name||' = $1 where '||v_data.column_name||' = $2 returning id' using totheseid, fromtheseid into v_id; if v_id is null then raise info ' - %.% : rien à faire', v_data.table_name, v_data.column_name; continue; end if; insert into transfert_these_log(table_name, column_name, from_id, to_id) values (v_data.table_name, v_data.column_name, fromtheseid, totheseid); raise info ' - %.% : OK', v_data.table_name, v_data.column_name; end loop; refresh materialized view mv_recherche_these; raise info 'Terminé.'; raise info '(Vue matérialisée ''%'' mise à jour.)', 'mv_recherche_these'; raise info '(Remplacements éventuels inscrits dans la table ''%''.)', 'transfert_these_log'; END $$; ``` No newline at end of file