Loading CHANGELOG.md +7 −0 Original line number Diff line number Diff line Journal des modifications ========================= 1.4.5 (08/04/2020) ------------------ - Correction du dysfonctionnement des notifications envoyées lors de certains événements sur les données importées (résultat d'une thèse passant à admis, corrections facultatives ou obligatoires attendues). 1.4.4 (03/04/2020) ------------------ Loading composer.json +6 −0 Original line number Diff line number Diff line Loading @@ -47,5 +47,11 @@ "RetraitementTest\\": "module/Retraitement/test/RetraitementTest", "ImportTest\\": "module/Import/tests/ImportTest" } }, "scripts": { "post-install-cmd": [ "mkdir -p cache/DoctrineORMModule/Proxy ; chmod -R 777 cache/DoctrineORMModule/Proxy", "mkdir -p upload ; chmod -R 777 upload" ] } } config/autoload/unicaen-app.global.php +22 −0 Original line number Diff line number Diff line Loading @@ -48,5 +48,27 @@ return [ 'FILTER_STRUCTURE_CODE_ENTITE_PARENT' => '(supannCodeEntiteParent=%s)', ], ], ], 'navigation' => [ // The DefaultNavigationFactory we configured uses 'default' as the sitemap key 'default' => [ // And finally, here is where we define our page hierarchy 'home' => [ 'pages' => [ 'contact' => [ 'label' => _("Assistance"), 'title' => _("Assistance concernant l'application"), 'route' => 'contact', 'class' => 'contact', 'visible' => false, 'footer' => true, // propriété maison pour inclure cette page dans le menu de pied de page 'sitemap' => true, // propriété maison pour inclure cette page dans le plan 'resource' => 'controller/UnicaenApp\Controller\Application:contact', 'order' => 1002, ], ], ], ], ] ]; data/SQL/notification.sql +170 −124 Original line number Diff line number Diff line Loading @@ -5,16 +5,17 @@ -- ------------------------------------------------------------------------------------------------ -- -- 0/ Désactiver la synchro CRONée. -- 1/ Désactiver l'import et l'observation des résultats d'import CRONés. -- -- Ex: ssh root@host.domain.fr 'chmod -x /etc/cron.d/sygal' -- -- 0/ Recherche des SOURCE_CODE des thèses. -- 2/ Recherche d'une thèse dont le RESULTAT est à NULL. -- select SOURCE_CODE from these where id in (25948); select SOURCE_CODE from these where RESULTAT is null order by id desc; -- 1/ Modif Vue src_these. -- 3/ Modif Vue src_these. -- -- Simule qu'une thèse a son résultat qui passe à 1 à l'issu de la synchro : -- Loading @@ -23,155 +24,200 @@ select SOURCE_CODE from these where id in (25948); -- select text from all_views where view_name = 'SRC_THESE'; -- create or replace view src_these as with v as ( with t as ( select 'UCN::16635' these_source_code from dual ), v as ( -- script initial de la vue src_these A VERIFIER ! SELECT NULL AS id, tmp.SOURCE_CODE AS SOURCE_CODE, src.ID AS source_id, e.id AS etablissement_id, d.id AS doctorant_id, coalesce(ed_substit.id, ed.id) AS ecole_doct_id, coalesce(ur_substit.id, ur.id) AS unite_rech_id, -- ed.id AS ecole_doct_id, -- ur.id AS unite_rech_id, ed.id AS ecole_doct_id_orig, ur.id AS unite_rech_id_orig, tmp.lib_ths AS titre, tmp.eta_ths AS etat_these, to_number(tmp.cod_neg_tre) AS resultat, tmp.lib_int1_dis AS lib_disc, tmp.dat_deb_ths AS date_prem_insc, tmp.dat_prev_sou AS date_prev_soutenance, tmp.dat_sou_ths AS date_soutenance, tmp.dat_fin_cfd_ths AS date_fin_confid, tmp.lib_etab_cotut AS lib_etab_cotut, tmp.lib_pays_cotut AS lib_pays_cotut, tmp.correction_possible AS CORREC_AUTORISEE, tem_sou_aut_ths AS soutenance_autoris, dat_aut_sou_ths AS date_autoris_soutenance, tem_avenant_cotut AS tem_avenant_cotut FROM TMP_THESE tmp JOIN STRUCTURE s ON s.CODE = tmp.ETABLISSEMENT_ID JOIN ETABLISSEMENT e ON e.STRUCTURE_ID = s.ID JOIN SOURCE src ON src.CODE = 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 LEFT JOIN UNITE_RECH ur ON ur.SOURCE_CODE = tmp.UNITE_RECH_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ed on ss_ed.FROM_STRUCTURE_ID = ed.STRUCTURE_ID LEFT JOIN ECOLE_DOCT ed_substit on ed_substit.STRUCTURE_ID = ss_ed.TO_STRUCTURE_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ur on ss_ur.FROM_STRUCTURE_ID = ur.STRUCTURE_ID LEFT JOIN UNITE_RECH ur_substit on ur_substit.STRUCTURE_ID = ss_ur.TO_STRUCTURE_ID --create or replace view SRC_THESE as select null as id, tmp.source_code as source_code, src.id as source_id, e.id as etablissement_id, d.id as doctorant_id, coalesce(ed_substit.id, ed.id) as ecole_doct_id, coalesce(ur_substit.id, ur.id) as unite_rech_id, ed.id as ecole_doct_id_orig, ur.id as unite_rech_id_orig, tmp.lib_ths as titre, tmp.eta_ths as etat_these, to_number(tmp.cod_neg_tre) as resultat, tmp.lib_int1_dis as lib_disc, tmp.dat_deb_ths as date_prem_insc, tmp.ANNEE_UNIV_1ERE_INSC as annee_univ_1ere_insc, -- deprecated tmp.dat_prev_sou as date_prev_soutenance, tmp.dat_sou_ths as date_soutenance, tmp.dat_fin_cfd_ths as date_fin_confid, tmp.lib_etab_cotut as lib_etab_cotut, tmp.lib_pays_cotut as lib_pays_cotut, tmp.correction_possible as correc_autorisee, tem_sou_aut_ths as soutenance_autoris, dat_aut_sou_ths as date_autoris_soutenance, tem_avenant_cotut as tem_avenant_cotut, dat_abandon as date_abandon, dat_transfert_dep as date_transfert from tmp_these tmp JOIN STRUCTURE s ON s.SOURCE_CODE = tmp.ETABLISSEMENT_ID join etablissement e on e.structure_id = s.id join source src on src.code = 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 left join unite_rech ur on ur.source_code = tmp.unite_rech_id left join structure_substit ss_ed on ss_ed.from_structure_id = ed.structure_id left join ecole_doct ed_substit on ed_substit.structure_id = ss_ed.to_structure_id left join structure_substit ss_ur on ss_ur.from_structure_id = ur.structure_id left join unite_rech ur_substit on ur_substit.structure_id = ss_ur.to_structure_id ) select * from v where SOURCE_CODE not in ('UCN::4783') select id, source_code, source_id, etablissement_id, doctorant_id, ecole_doct_id, unite_rech_id, ecole_doct_id_orig, unite_rech_id_orig, titre, etat_these, lib_disc, date_prem_insc, annee_univ_1ere_insc, date_prev_soutenance, date_soutenance, date_fin_confid, lib_etab_cotut, lib_pays_cotut, correc_autorisee, soutenance_autoris, date_autoris_soutenance, tem_avenant_cotut, date_abandon, date_transfert, 1 as resultat from t, v where source_code in (these_source_code) union select ID, SOURCE_CODE, SOURCE_ID, ETABLISSEMENT_ID, DOCTORANT_ID, ECOLE_DOCT_ID, UNITE_RECH_ID, ECOLE_DOCT_ID_ORIG, UNITE_RECH_ID_ORIG, TITRE, ETAT_THESE, 1 as RESULTAT, LIB_DISC, DATE_PREM_INSC, DATE_PREV_SOUTENANCE, DATE_SOUTENANCE, DATE_FIN_CONFID, LIB_ETAB_COTUT, LIB_PAYS_COTUT, CORREC_AUTORISEE, SOUTENANCE_AUTORIS, DATE_AUTORIS_SOUTENANCE, TEM_AVENANT_COTUT FROM v where SOURCE_CODE in ('UCN::4783') id, source_code, source_id, etablissement_id, doctorant_id, ecole_doct_id, unite_rech_id, ecole_doct_id_orig, unite_rech_id_orig, titre, etat_these, lib_disc, date_prem_insc, annee_univ_1ere_insc, date_prev_soutenance, date_soutenance, date_fin_confid, lib_etab_cotut, lib_pays_cotut, correc_autorisee, soutenance_autoris, date_autoris_soutenance, tem_avenant_cotut, date_abandon, date_transfert, resultat from t, v where source_code not in (these_source_code) ; -- -- 2/ Vérification que les thèses apparaissent bien dans la vue diff. -- 4/ Vérification que les thèses apparaissent bien dans la vue diff. -- select id, SOURCE_CODE, IMPORT_ACTION, CORREC_AUTORISEE, RESULTAT, U_CORREC_AUTORISEE, U_RESULTAT from v_diff_these where source_code in ('UCN::4783'); where source_code in ('UCN::16635'); -- -- 3/ Lancement procédure. -- 5/ Lancement procédure. -- begin app_import.STORE_OBSERV_RESULTS; end; commit; / -- -- 4/ Vérification présence d'un résultat d'observation. -- 6/ Vérification présence d'un résultat d'observation. -- select ior.id, io.CODE, ior.DATE_CREATION, ior.SOURCE_CODE, ior.RESULTAT, ior.DATE_NOTIF from IMPORT_OBSERV_RESULT ior join IMPORT_OBSERV io on ior.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::4783' select ioer.id, io.CODE, ioer.DATE_CREATION, ioer.SOURCE_CODE, ioer.RESULTAT, ioer.DATE_NOTIF, ioer.TOO_OLD from IMPORT_OBSERV_ETAB_RESULT ioer join IMPORT_OBSERV_ETAB ioe on ioer.IMPORT_OBSERV_ETAB_ID = ioe.ID join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::16635' order by DATE_CREATION desc ; -- -- 5/ Lancer le script PHP de traitement des résultats d'observation : -- 7/ Lancer le script PHP de traitement des résultats d'observation : -- un mail devrait être envoyé... -- -- $ php public/index.php process-observed-import-results -- $ php public/index.php process-observed-import-results --etablissement=UCN --import-observ=RESULTAT_PASSE_A_ADMIS --source-code=UCN::16635 -- -- 6/ Restauration Vue src_these initiale. -- 8/ Vérification date de notif enregistrée. -- create or replace view src_these as SELECT NULL AS id, tmp.SOURCE_CODE AS SOURCE_CODE, src.ID AS source_id, e.id AS etablissement_id, d.id AS doctorant_id, coalesce(ed_substit.id, ed.id) AS ecole_doct_id, coalesce(ur_substit.id, ur.id) AS unite_rech_id, -- ed.id AS ecole_doct_id, -- ur.id AS unite_rech_id, ed.id AS ecole_doct_id_orig, ur.id AS unite_rech_id_orig, tmp.lib_ths AS titre, tmp.eta_ths AS etat_these, to_number(tmp.cod_neg_tre) AS resultat, tmp.lib_int1_dis AS lib_disc, tmp.dat_deb_ths AS date_prem_insc, tmp.dat_prev_sou AS date_prev_soutenance, tmp.dat_sou_ths AS date_soutenance, tmp.dat_fin_cfd_ths AS date_fin_confid, tmp.lib_etab_cotut AS lib_etab_cotut, tmp.lib_pays_cotut AS lib_pays_cotut, tmp.correction_possible AS CORREC_AUTORISEE, tem_sou_aut_ths AS soutenance_autoris, dat_aut_sou_ths AS date_autoris_soutenance, tem_avenant_cotut AS tem_avenant_cotut FROM TMP_THESE tmp JOIN STRUCTURE s ON s.CODE = tmp.ETABLISSEMENT_ID JOIN ETABLISSEMENT e ON e.STRUCTURE_ID = s.ID JOIN SOURCE src ON src.CODE = 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 LEFT JOIN UNITE_RECH ur ON ur.SOURCE_CODE = tmp.UNITE_RECH_ID select ioer.id, io.CODE, ioer.DATE_CREATION, ioer.SOURCE_CODE, ioer.RESULTAT, ioer.DATE_NOTIF, ioer.TOO_OLD from IMPORT_OBSERV_ETAB_RESULT ioer join IMPORT_OBSERV_ETAB ioe on ioer.IMPORT_OBSERV_ETAB_ID = ioe.ID join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::16635' order by DATE_CREATION desc ; LEFT JOIN STRUCTURE_SUBSTIT ss_ed on ss_ed.FROM_STRUCTURE_ID = ed.STRUCTURE_ID LEFT JOIN ECOLE_DOCT ed_substit on ed_substit.STRUCTURE_ID = ss_ed.TO_STRUCTURE_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ur on ss_ur.FROM_STRUCTURE_ID = ur.STRUCTURE_ID LEFT JOIN UNITE_RECH ur_substit on ur_substit.STRUCTURE_ID = ss_ur.TO_STRUCTURE_ID -- -- 9/ Restauration Vue src_these initiale. -- create or replace view SRC_THESE as select null as id, tmp.source_code as source_code, src.id as source_id, e.id as etablissement_id, d.id as doctorant_id, coalesce(ed_substit.id, ed.id) as ecole_doct_id, coalesce(ur_substit.id, ur.id) as unite_rech_id, ed.id as ecole_doct_id_orig, ur.id as unite_rech_id_orig, tmp.lib_ths as titre, tmp.eta_ths as etat_these, to_number(tmp.cod_neg_tre) as resultat, tmp.lib_int1_dis as lib_disc, tmp.dat_deb_ths as date_prem_insc, tmp.ANNEE_UNIV_1ERE_INSC as annee_univ_1ere_insc, -- deprecated tmp.dat_prev_sou as date_prev_soutenance, tmp.dat_sou_ths as date_soutenance, tmp.dat_fin_cfd_ths as date_fin_confid, tmp.lib_etab_cotut as lib_etab_cotut, tmp.lib_pays_cotut as lib_pays_cotut, tmp.correction_possible as correc_autorisee, tem_sou_aut_ths as soutenance_autoris, dat_aut_sou_ths as date_autoris_soutenance, tem_avenant_cotut as tem_avenant_cotut, dat_abandon as date_abandon, dat_transfert_dep as date_transfert from tmp_these tmp JOIN STRUCTURE s ON s.SOURCE_CODE = tmp.ETABLISSEMENT_ID join etablissement e on e.structure_id = s.id join source src on src.code = 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 left join unite_rech ur on ur.source_code = tmp.unite_rech_id left join structure_substit ss_ed on ss_ed.from_structure_id = ed.structure_id left join ecole_doct ed_substit on ed_substit.structure_id = ss_ed.to_structure_id left join structure_substit ss_ur on ss_ur.from_structure_id = ur.structure_id left join unite_rech ur_substit on ur_substit.structure_id = ss_ur.to_structure_id ; -- -- 7/ Réactiver la synchro CRONée. -- 10/ Réactiver la synchro CRONée. -- -- Ex: ssh root@host.domain.fr 'chmod +x /etc/cron.d/sygal' doc/release-notes/1.4.5/01_migrate_import_observ.sql 0 → 100644 +156 −0 Original line number Diff line number Diff line -------------------------------------------------------------------------------------- -- Migration des tables impliquées dans l'observation de l'import. -------------------------------------------------------------------------------------- -- -- IMPORT_OBSERV_ETAB -- create table IMPORT_OBSERV_ETAB ( ID NUMBER not null constraint IMPORT_OBSERV_ETAB_PK primary key, IMPORT_OBSERV_ID NUMBER not null constraint IMPORT_OBSERV_ETAB_OBSERV_FK references IMPORT_OBSERV on delete cascade, ETABLISSEMENT_ID NUMBER not null constraint IMPORT_OBSERV_ETAB_ETAB_FK references IMPORT_OBSERV_ETAB on delete cascade, ENABLED NUMBER(1) default 0 not null, constraint IMPORT_OBSERV_ETAB_UN unique (IMPORT_OBSERV_ID, ETABLISSEMENT_ID) ); INSERT INTO IMPORT_OBSERV_ETAB (ID, IMPORT_OBSERV_ID, ETABLISSEMENT_ID, ENABLED) select IMPORT_OBSERV_ETAB_ID_SEQ.nextval, io.id, e.id, io.ENABLED from IMPORT_OBSERV io, ETABLISSEMENT e where e.EST_MEMBRE = 1; -- -- IMPORT_OBSERV -- alter table IMPORT_OBSERV drop column ENABLED; -- -- IMPORT_OBSERV_RESULT -- alter table IMPORT_OBSERV_RESULT add IMPORT_OBSERV_ETAB_ID NUMBER /*not null ajouté plus bas*/; update IMPORT_OBSERV_RESULT ioer set IMPORT_OBSERV_ETAB_ID = ( select ioe.id from IMPORT_OBSERV_ETAB ioe, ETABLISSEMENT e where e.SOURCE_CODE = substr(ioer.SOURCE_CODE, 1, instr(ioer.SOURCE_CODE, '::') - 1) and ioe.ETABLISSEMENT_ID = e.id and ioe.IMPORT_OBSERV_ID = ioer.IMPORT_OBSERV_ID ); alter table IMPORT_OBSERV_RESULT add TOO_OLD NUMBER(1) default 0 not null; alter table IMPORT_OBSERV_RESULT modify IMPORT_OBSERV_ETAB_ID not null; alter table IMPORT_OBSERV_RESULT drop column IMPORT_OBSERV_ID; rename IMPORT_OBSERV_RESULT to IMPORT_OBSERV_ETAB_RESULT ; alter table IMPORT_OBSERV_ETAB_RESULT add constraint IMPORT_OBSERV_ETAB_RESULT_IOE_FK foreign key (IMPORT_OBSERV_ETAB_ID) references IMPORT_OBSERV_ETAB (ID) on delete cascade; create index IMPORT_OBSERV_ETAB_RES_IOE_IDX on IMPORT_OBSERV_ETAB_RESULT (IMPORT_OBSERV_ETAB_ID); -- -- -- create or replace PACKAGE "APP_IMPORT" IS PROCEDURE REFRESH_MV( mview_name VARCHAR2 ); PROCEDURE SYNC_TABLES; PROCEDURE SYNCHRONISATION; PROCEDURE STORE_OBSERV_RESULTS; END APP_IMPORT; create or replace PACKAGE BODY "APP_IMPORT" IS PROCEDURE REFRESH_MV( mview_name VARCHAR2 ) IS BEGIN DBMS_MVIEW.REFRESH(mview_name, 'C'); EXCEPTION WHEN OTHERS THEN UNICAEN_IMPORT.SYNC_LOG( SQLERRM, mview_name ); END; PROCEDURE SYNC_TABLES IS BEGIN -- mise à jour des tables à partir des vues sources -- NB: l'ordre importe ! UNICAEN_IMPORT.MAJ_STRUCTURE(); UNICAEN_IMPORT.MAJ_ETABLISSEMENT(); UNICAEN_IMPORT.MAJ_ECOLE_DOCT(); UNICAEN_IMPORT.MAJ_UNITE_RECH(); UNICAEN_IMPORT.MAJ_INDIVIDU(); UNICAEN_IMPORT.MAJ_DOCTORANT(); UNICAEN_IMPORT.MAJ_THESE(); UNICAEN_IMPORT.MAJ_THESE_ANNEE_UNIV(); UNICAEN_IMPORT.MAJ_ROLE(); UNICAEN_IMPORT.MAJ_ACTEUR(); UNICAEN_IMPORT.MAJ_VARIABLE(); UNICAEN_IMPORT.MAJ_FINANCEMENT(); UNICAEN_IMPORT.MAJ_TITRE_ACCES(); REFRESH_MV('MV_RECHERCHE_THESE'); -- NB: à faire en dernier END; -- -- Recherche des changements de type UPDATE concernant la colonne de table observée et -- enregistrement de ces changements dans une table. -- PROCEDURE STORE_UPDATE_OBSERV_RESULT(observEtab IMPORT_OBSERV_ETAB%ROWTYPE) IS u_col_name VARCHAR2(50); where_to_value CLOB; i_query CLOB; observ IMPORT_OBSERV%ROWTYPE; TYPE r_cursor is REF CURSOR; rc r_cursor; l_id CLOB; l_detail CLOB; BEGIN select * into observ from IMPORT_OBSERV where id = observEtab.IMPORT_OBSERV_ID; -- Construction du nom de la colonne de la vue V_DIFF_X indiquant un changement de valeur dans la table X. -- Ex: 'U_RESULTAT' (dans la vue V_DIFF_THESE, indiquant que la colonne THESE.RESULTAT a changé). u_col_name := 'U_' || observ.COLUMN_NAME; -- Construction de la clause permettant de ne prendre en compte que la prise de valeur qui nous intéresse. -- Ex: "v.COLONNE = 'VALEUR'" ou "v.COLONNE IS NULL". where_to_value := 'v.' || observ.COLUMN_NAME || case when observ.TO_VALUE is null then ' is null' else ' = ''' || observ.TO_VALUE || '''' end; -- Construction de la requête recherchant dans la vue V_DIFF_X les lignes correspondant à : -- une prise de valeur particulière spécifiée par IMPORT_OBSERV.TO_VALUE, -- de la colonne spécifiée par IMPORT_OBSERV.COLUMN_NAME, -- dans la table spécifiée par IMPORT_OBSERV.TABLE_NAME. i_query := 'select v.source_code, t.' || observ.COLUMN_NAME || ' || ''>'' || v.' || observ.COLUMN_NAME || ' detail ' || 'from V_DIFF_' || observ.TABLE_NAME || ' v ' || 'join ' || observ.TABLE_NAME || ' t on t.source_code = v.source_code ' || 'where ' || u_col_name || ' = 1 and ' || where_to_value || ' ' || 'order by v.source_code'; --DBMS_OUTPUT.PUT_LINE(i_query); OPEN rc FOR i_query; LOOP FETCH rc INTO l_id, l_detail; EXIT WHEN rc%NOTFOUND; --DBMS_OUTPUT.PUT_LINE(l_id); DBMS_OUTPUT.PUT_LINE(l_detail); insert into IMPORT_OBSERV_ETAB_RESULT(ID, IMPORT_OBSERV_ETAB_ID, DATE_CREATION, SOURCE_CODE, RESULTAT, TOO_OLD) values (IMPORT_OBSERV_RESULT_ID_SEQ.nextval, observEtab.ID, sysdate, l_id, l_detail, 0); END LOOP; END; PROCEDURE STORE_OBSERV_RESULTS IS BEGIN -- Parcours des IMPORT_OBSERV_ETAB de type UPDATE et non désactivés. for observEtab in ( select ioe.* from IMPORT_OBSERV_ETAB ioe join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID and io.OPERATION = 'UPDATE' where ioe.ENABLED = 1 ) loop STORE_UPDATE_OBSERV_RESULT(observEtab); end loop; END; PROCEDURE SYNCHRONISATION IS BEGIN STORE_OBSERV_RESULTS; SYNC_TABLES; END; END APP_IMPORT; Loading
CHANGELOG.md +7 −0 Original line number Diff line number Diff line Journal des modifications ========================= 1.4.5 (08/04/2020) ------------------ - Correction du dysfonctionnement des notifications envoyées lors de certains événements sur les données importées (résultat d'une thèse passant à admis, corrections facultatives ou obligatoires attendues). 1.4.4 (03/04/2020) ------------------ Loading
composer.json +6 −0 Original line number Diff line number Diff line Loading @@ -47,5 +47,11 @@ "RetraitementTest\\": "module/Retraitement/test/RetraitementTest", "ImportTest\\": "module/Import/tests/ImportTest" } }, "scripts": { "post-install-cmd": [ "mkdir -p cache/DoctrineORMModule/Proxy ; chmod -R 777 cache/DoctrineORMModule/Proxy", "mkdir -p upload ; chmod -R 777 upload" ] } }
config/autoload/unicaen-app.global.php +22 −0 Original line number Diff line number Diff line Loading @@ -48,5 +48,27 @@ return [ 'FILTER_STRUCTURE_CODE_ENTITE_PARENT' => '(supannCodeEntiteParent=%s)', ], ], ], 'navigation' => [ // The DefaultNavigationFactory we configured uses 'default' as the sitemap key 'default' => [ // And finally, here is where we define our page hierarchy 'home' => [ 'pages' => [ 'contact' => [ 'label' => _("Assistance"), 'title' => _("Assistance concernant l'application"), 'route' => 'contact', 'class' => 'contact', 'visible' => false, 'footer' => true, // propriété maison pour inclure cette page dans le menu de pied de page 'sitemap' => true, // propriété maison pour inclure cette page dans le plan 'resource' => 'controller/UnicaenApp\Controller\Application:contact', 'order' => 1002, ], ], ], ], ] ];
data/SQL/notification.sql +170 −124 Original line number Diff line number Diff line Loading @@ -5,16 +5,17 @@ -- ------------------------------------------------------------------------------------------------ -- -- 0/ Désactiver la synchro CRONée. -- 1/ Désactiver l'import et l'observation des résultats d'import CRONés. -- -- Ex: ssh root@host.domain.fr 'chmod -x /etc/cron.d/sygal' -- -- 0/ Recherche des SOURCE_CODE des thèses. -- 2/ Recherche d'une thèse dont le RESULTAT est à NULL. -- select SOURCE_CODE from these where id in (25948); select SOURCE_CODE from these where RESULTAT is null order by id desc; -- 1/ Modif Vue src_these. -- 3/ Modif Vue src_these. -- -- Simule qu'une thèse a son résultat qui passe à 1 à l'issu de la synchro : -- Loading @@ -23,155 +24,200 @@ select SOURCE_CODE from these where id in (25948); -- select text from all_views where view_name = 'SRC_THESE'; -- create or replace view src_these as with v as ( with t as ( select 'UCN::16635' these_source_code from dual ), v as ( -- script initial de la vue src_these A VERIFIER ! SELECT NULL AS id, tmp.SOURCE_CODE AS SOURCE_CODE, src.ID AS source_id, e.id AS etablissement_id, d.id AS doctorant_id, coalesce(ed_substit.id, ed.id) AS ecole_doct_id, coalesce(ur_substit.id, ur.id) AS unite_rech_id, -- ed.id AS ecole_doct_id, -- ur.id AS unite_rech_id, ed.id AS ecole_doct_id_orig, ur.id AS unite_rech_id_orig, tmp.lib_ths AS titre, tmp.eta_ths AS etat_these, to_number(tmp.cod_neg_tre) AS resultat, tmp.lib_int1_dis AS lib_disc, tmp.dat_deb_ths AS date_prem_insc, tmp.dat_prev_sou AS date_prev_soutenance, tmp.dat_sou_ths AS date_soutenance, tmp.dat_fin_cfd_ths AS date_fin_confid, tmp.lib_etab_cotut AS lib_etab_cotut, tmp.lib_pays_cotut AS lib_pays_cotut, tmp.correction_possible AS CORREC_AUTORISEE, tem_sou_aut_ths AS soutenance_autoris, dat_aut_sou_ths AS date_autoris_soutenance, tem_avenant_cotut AS tem_avenant_cotut FROM TMP_THESE tmp JOIN STRUCTURE s ON s.CODE = tmp.ETABLISSEMENT_ID JOIN ETABLISSEMENT e ON e.STRUCTURE_ID = s.ID JOIN SOURCE src ON src.CODE = 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 LEFT JOIN UNITE_RECH ur ON ur.SOURCE_CODE = tmp.UNITE_RECH_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ed on ss_ed.FROM_STRUCTURE_ID = ed.STRUCTURE_ID LEFT JOIN ECOLE_DOCT ed_substit on ed_substit.STRUCTURE_ID = ss_ed.TO_STRUCTURE_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ur on ss_ur.FROM_STRUCTURE_ID = ur.STRUCTURE_ID LEFT JOIN UNITE_RECH ur_substit on ur_substit.STRUCTURE_ID = ss_ur.TO_STRUCTURE_ID --create or replace view SRC_THESE as select null as id, tmp.source_code as source_code, src.id as source_id, e.id as etablissement_id, d.id as doctorant_id, coalesce(ed_substit.id, ed.id) as ecole_doct_id, coalesce(ur_substit.id, ur.id) as unite_rech_id, ed.id as ecole_doct_id_orig, ur.id as unite_rech_id_orig, tmp.lib_ths as titre, tmp.eta_ths as etat_these, to_number(tmp.cod_neg_tre) as resultat, tmp.lib_int1_dis as lib_disc, tmp.dat_deb_ths as date_prem_insc, tmp.ANNEE_UNIV_1ERE_INSC as annee_univ_1ere_insc, -- deprecated tmp.dat_prev_sou as date_prev_soutenance, tmp.dat_sou_ths as date_soutenance, tmp.dat_fin_cfd_ths as date_fin_confid, tmp.lib_etab_cotut as lib_etab_cotut, tmp.lib_pays_cotut as lib_pays_cotut, tmp.correction_possible as correc_autorisee, tem_sou_aut_ths as soutenance_autoris, dat_aut_sou_ths as date_autoris_soutenance, tem_avenant_cotut as tem_avenant_cotut, dat_abandon as date_abandon, dat_transfert_dep as date_transfert from tmp_these tmp JOIN STRUCTURE s ON s.SOURCE_CODE = tmp.ETABLISSEMENT_ID join etablissement e on e.structure_id = s.id join source src on src.code = 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 left join unite_rech ur on ur.source_code = tmp.unite_rech_id left join structure_substit ss_ed on ss_ed.from_structure_id = ed.structure_id left join ecole_doct ed_substit on ed_substit.structure_id = ss_ed.to_structure_id left join structure_substit ss_ur on ss_ur.from_structure_id = ur.structure_id left join unite_rech ur_substit on ur_substit.structure_id = ss_ur.to_structure_id ) select * from v where SOURCE_CODE not in ('UCN::4783') select id, source_code, source_id, etablissement_id, doctorant_id, ecole_doct_id, unite_rech_id, ecole_doct_id_orig, unite_rech_id_orig, titre, etat_these, lib_disc, date_prem_insc, annee_univ_1ere_insc, date_prev_soutenance, date_soutenance, date_fin_confid, lib_etab_cotut, lib_pays_cotut, correc_autorisee, soutenance_autoris, date_autoris_soutenance, tem_avenant_cotut, date_abandon, date_transfert, 1 as resultat from t, v where source_code in (these_source_code) union select ID, SOURCE_CODE, SOURCE_ID, ETABLISSEMENT_ID, DOCTORANT_ID, ECOLE_DOCT_ID, UNITE_RECH_ID, ECOLE_DOCT_ID_ORIG, UNITE_RECH_ID_ORIG, TITRE, ETAT_THESE, 1 as RESULTAT, LIB_DISC, DATE_PREM_INSC, DATE_PREV_SOUTENANCE, DATE_SOUTENANCE, DATE_FIN_CONFID, LIB_ETAB_COTUT, LIB_PAYS_COTUT, CORREC_AUTORISEE, SOUTENANCE_AUTORIS, DATE_AUTORIS_SOUTENANCE, TEM_AVENANT_COTUT FROM v where SOURCE_CODE in ('UCN::4783') id, source_code, source_id, etablissement_id, doctorant_id, ecole_doct_id, unite_rech_id, ecole_doct_id_orig, unite_rech_id_orig, titre, etat_these, lib_disc, date_prem_insc, annee_univ_1ere_insc, date_prev_soutenance, date_soutenance, date_fin_confid, lib_etab_cotut, lib_pays_cotut, correc_autorisee, soutenance_autoris, date_autoris_soutenance, tem_avenant_cotut, date_abandon, date_transfert, resultat from t, v where source_code not in (these_source_code) ; -- -- 2/ Vérification que les thèses apparaissent bien dans la vue diff. -- 4/ Vérification que les thèses apparaissent bien dans la vue diff. -- select id, SOURCE_CODE, IMPORT_ACTION, CORREC_AUTORISEE, RESULTAT, U_CORREC_AUTORISEE, U_RESULTAT from v_diff_these where source_code in ('UCN::4783'); where source_code in ('UCN::16635'); -- -- 3/ Lancement procédure. -- 5/ Lancement procédure. -- begin app_import.STORE_OBSERV_RESULTS; end; commit; / -- -- 4/ Vérification présence d'un résultat d'observation. -- 6/ Vérification présence d'un résultat d'observation. -- select ior.id, io.CODE, ior.DATE_CREATION, ior.SOURCE_CODE, ior.RESULTAT, ior.DATE_NOTIF from IMPORT_OBSERV_RESULT ior join IMPORT_OBSERV io on ior.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::4783' select ioer.id, io.CODE, ioer.DATE_CREATION, ioer.SOURCE_CODE, ioer.RESULTAT, ioer.DATE_NOTIF, ioer.TOO_OLD from IMPORT_OBSERV_ETAB_RESULT ioer join IMPORT_OBSERV_ETAB ioe on ioer.IMPORT_OBSERV_ETAB_ID = ioe.ID join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::16635' order by DATE_CREATION desc ; -- -- 5/ Lancer le script PHP de traitement des résultats d'observation : -- 7/ Lancer le script PHP de traitement des résultats d'observation : -- un mail devrait être envoyé... -- -- $ php public/index.php process-observed-import-results -- $ php public/index.php process-observed-import-results --etablissement=UCN --import-observ=RESULTAT_PASSE_A_ADMIS --source-code=UCN::16635 -- -- 6/ Restauration Vue src_these initiale. -- 8/ Vérification date de notif enregistrée. -- create or replace view src_these as SELECT NULL AS id, tmp.SOURCE_CODE AS SOURCE_CODE, src.ID AS source_id, e.id AS etablissement_id, d.id AS doctorant_id, coalesce(ed_substit.id, ed.id) AS ecole_doct_id, coalesce(ur_substit.id, ur.id) AS unite_rech_id, -- ed.id AS ecole_doct_id, -- ur.id AS unite_rech_id, ed.id AS ecole_doct_id_orig, ur.id AS unite_rech_id_orig, tmp.lib_ths AS titre, tmp.eta_ths AS etat_these, to_number(tmp.cod_neg_tre) AS resultat, tmp.lib_int1_dis AS lib_disc, tmp.dat_deb_ths AS date_prem_insc, tmp.dat_prev_sou AS date_prev_soutenance, tmp.dat_sou_ths AS date_soutenance, tmp.dat_fin_cfd_ths AS date_fin_confid, tmp.lib_etab_cotut AS lib_etab_cotut, tmp.lib_pays_cotut AS lib_pays_cotut, tmp.correction_possible AS CORREC_AUTORISEE, tem_sou_aut_ths AS soutenance_autoris, dat_aut_sou_ths AS date_autoris_soutenance, tem_avenant_cotut AS tem_avenant_cotut FROM TMP_THESE tmp JOIN STRUCTURE s ON s.CODE = tmp.ETABLISSEMENT_ID JOIN ETABLISSEMENT e ON e.STRUCTURE_ID = s.ID JOIN SOURCE src ON src.CODE = 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 LEFT JOIN UNITE_RECH ur ON ur.SOURCE_CODE = tmp.UNITE_RECH_ID select ioer.id, io.CODE, ioer.DATE_CREATION, ioer.SOURCE_CODE, ioer.RESULTAT, ioer.DATE_NOTIF, ioer.TOO_OLD from IMPORT_OBSERV_ETAB_RESULT ioer join IMPORT_OBSERV_ETAB ioe on ioer.IMPORT_OBSERV_ETAB_ID = ioe.ID join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID where SOURCE_CODE = 'UCN::16635' order by DATE_CREATION desc ; LEFT JOIN STRUCTURE_SUBSTIT ss_ed on ss_ed.FROM_STRUCTURE_ID = ed.STRUCTURE_ID LEFT JOIN ECOLE_DOCT ed_substit on ed_substit.STRUCTURE_ID = ss_ed.TO_STRUCTURE_ID LEFT JOIN STRUCTURE_SUBSTIT ss_ur on ss_ur.FROM_STRUCTURE_ID = ur.STRUCTURE_ID LEFT JOIN UNITE_RECH ur_substit on ur_substit.STRUCTURE_ID = ss_ur.TO_STRUCTURE_ID -- -- 9/ Restauration Vue src_these initiale. -- create or replace view SRC_THESE as select null as id, tmp.source_code as source_code, src.id as source_id, e.id as etablissement_id, d.id as doctorant_id, coalesce(ed_substit.id, ed.id) as ecole_doct_id, coalesce(ur_substit.id, ur.id) as unite_rech_id, ed.id as ecole_doct_id_orig, ur.id as unite_rech_id_orig, tmp.lib_ths as titre, tmp.eta_ths as etat_these, to_number(tmp.cod_neg_tre) as resultat, tmp.lib_int1_dis as lib_disc, tmp.dat_deb_ths as date_prem_insc, tmp.ANNEE_UNIV_1ERE_INSC as annee_univ_1ere_insc, -- deprecated tmp.dat_prev_sou as date_prev_soutenance, tmp.dat_sou_ths as date_soutenance, tmp.dat_fin_cfd_ths as date_fin_confid, tmp.lib_etab_cotut as lib_etab_cotut, tmp.lib_pays_cotut as lib_pays_cotut, tmp.correction_possible as correc_autorisee, tem_sou_aut_ths as soutenance_autoris, dat_aut_sou_ths as date_autoris_soutenance, tem_avenant_cotut as tem_avenant_cotut, dat_abandon as date_abandon, dat_transfert_dep as date_transfert from tmp_these tmp JOIN STRUCTURE s ON s.SOURCE_CODE = tmp.ETABLISSEMENT_ID join etablissement e on e.structure_id = s.id join source src on src.code = 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 left join unite_rech ur on ur.source_code = tmp.unite_rech_id left join structure_substit ss_ed on ss_ed.from_structure_id = ed.structure_id left join ecole_doct ed_substit on ed_substit.structure_id = ss_ed.to_structure_id left join structure_substit ss_ur on ss_ur.from_structure_id = ur.structure_id left join unite_rech ur_substit on ur_substit.structure_id = ss_ur.to_structure_id ; -- -- 7/ Réactiver la synchro CRONée. -- 10/ Réactiver la synchro CRONée. -- -- Ex: ssh root@host.domain.fr 'chmod +x /etc/cron.d/sygal'
doc/release-notes/1.4.5/01_migrate_import_observ.sql 0 → 100644 +156 −0 Original line number Diff line number Diff line -------------------------------------------------------------------------------------- -- Migration des tables impliquées dans l'observation de l'import. -------------------------------------------------------------------------------------- -- -- IMPORT_OBSERV_ETAB -- create table IMPORT_OBSERV_ETAB ( ID NUMBER not null constraint IMPORT_OBSERV_ETAB_PK primary key, IMPORT_OBSERV_ID NUMBER not null constraint IMPORT_OBSERV_ETAB_OBSERV_FK references IMPORT_OBSERV on delete cascade, ETABLISSEMENT_ID NUMBER not null constraint IMPORT_OBSERV_ETAB_ETAB_FK references IMPORT_OBSERV_ETAB on delete cascade, ENABLED NUMBER(1) default 0 not null, constraint IMPORT_OBSERV_ETAB_UN unique (IMPORT_OBSERV_ID, ETABLISSEMENT_ID) ); INSERT INTO IMPORT_OBSERV_ETAB (ID, IMPORT_OBSERV_ID, ETABLISSEMENT_ID, ENABLED) select IMPORT_OBSERV_ETAB_ID_SEQ.nextval, io.id, e.id, io.ENABLED from IMPORT_OBSERV io, ETABLISSEMENT e where e.EST_MEMBRE = 1; -- -- IMPORT_OBSERV -- alter table IMPORT_OBSERV drop column ENABLED; -- -- IMPORT_OBSERV_RESULT -- alter table IMPORT_OBSERV_RESULT add IMPORT_OBSERV_ETAB_ID NUMBER /*not null ajouté plus bas*/; update IMPORT_OBSERV_RESULT ioer set IMPORT_OBSERV_ETAB_ID = ( select ioe.id from IMPORT_OBSERV_ETAB ioe, ETABLISSEMENT e where e.SOURCE_CODE = substr(ioer.SOURCE_CODE, 1, instr(ioer.SOURCE_CODE, '::') - 1) and ioe.ETABLISSEMENT_ID = e.id and ioe.IMPORT_OBSERV_ID = ioer.IMPORT_OBSERV_ID ); alter table IMPORT_OBSERV_RESULT add TOO_OLD NUMBER(1) default 0 not null; alter table IMPORT_OBSERV_RESULT modify IMPORT_OBSERV_ETAB_ID not null; alter table IMPORT_OBSERV_RESULT drop column IMPORT_OBSERV_ID; rename IMPORT_OBSERV_RESULT to IMPORT_OBSERV_ETAB_RESULT ; alter table IMPORT_OBSERV_ETAB_RESULT add constraint IMPORT_OBSERV_ETAB_RESULT_IOE_FK foreign key (IMPORT_OBSERV_ETAB_ID) references IMPORT_OBSERV_ETAB (ID) on delete cascade; create index IMPORT_OBSERV_ETAB_RES_IOE_IDX on IMPORT_OBSERV_ETAB_RESULT (IMPORT_OBSERV_ETAB_ID); -- -- -- create or replace PACKAGE "APP_IMPORT" IS PROCEDURE REFRESH_MV( mview_name VARCHAR2 ); PROCEDURE SYNC_TABLES; PROCEDURE SYNCHRONISATION; PROCEDURE STORE_OBSERV_RESULTS; END APP_IMPORT; create or replace PACKAGE BODY "APP_IMPORT" IS PROCEDURE REFRESH_MV( mview_name VARCHAR2 ) IS BEGIN DBMS_MVIEW.REFRESH(mview_name, 'C'); EXCEPTION WHEN OTHERS THEN UNICAEN_IMPORT.SYNC_LOG( SQLERRM, mview_name ); END; PROCEDURE SYNC_TABLES IS BEGIN -- mise à jour des tables à partir des vues sources -- NB: l'ordre importe ! UNICAEN_IMPORT.MAJ_STRUCTURE(); UNICAEN_IMPORT.MAJ_ETABLISSEMENT(); UNICAEN_IMPORT.MAJ_ECOLE_DOCT(); UNICAEN_IMPORT.MAJ_UNITE_RECH(); UNICAEN_IMPORT.MAJ_INDIVIDU(); UNICAEN_IMPORT.MAJ_DOCTORANT(); UNICAEN_IMPORT.MAJ_THESE(); UNICAEN_IMPORT.MAJ_THESE_ANNEE_UNIV(); UNICAEN_IMPORT.MAJ_ROLE(); UNICAEN_IMPORT.MAJ_ACTEUR(); UNICAEN_IMPORT.MAJ_VARIABLE(); UNICAEN_IMPORT.MAJ_FINANCEMENT(); UNICAEN_IMPORT.MAJ_TITRE_ACCES(); REFRESH_MV('MV_RECHERCHE_THESE'); -- NB: à faire en dernier END; -- -- Recherche des changements de type UPDATE concernant la colonne de table observée et -- enregistrement de ces changements dans une table. -- PROCEDURE STORE_UPDATE_OBSERV_RESULT(observEtab IMPORT_OBSERV_ETAB%ROWTYPE) IS u_col_name VARCHAR2(50); where_to_value CLOB; i_query CLOB; observ IMPORT_OBSERV%ROWTYPE; TYPE r_cursor is REF CURSOR; rc r_cursor; l_id CLOB; l_detail CLOB; BEGIN select * into observ from IMPORT_OBSERV where id = observEtab.IMPORT_OBSERV_ID; -- Construction du nom de la colonne de la vue V_DIFF_X indiquant un changement de valeur dans la table X. -- Ex: 'U_RESULTAT' (dans la vue V_DIFF_THESE, indiquant que la colonne THESE.RESULTAT a changé). u_col_name := 'U_' || observ.COLUMN_NAME; -- Construction de la clause permettant de ne prendre en compte que la prise de valeur qui nous intéresse. -- Ex: "v.COLONNE = 'VALEUR'" ou "v.COLONNE IS NULL". where_to_value := 'v.' || observ.COLUMN_NAME || case when observ.TO_VALUE is null then ' is null' else ' = ''' || observ.TO_VALUE || '''' end; -- Construction de la requête recherchant dans la vue V_DIFF_X les lignes correspondant à : -- une prise de valeur particulière spécifiée par IMPORT_OBSERV.TO_VALUE, -- de la colonne spécifiée par IMPORT_OBSERV.COLUMN_NAME, -- dans la table spécifiée par IMPORT_OBSERV.TABLE_NAME. i_query := 'select v.source_code, t.' || observ.COLUMN_NAME || ' || ''>'' || v.' || observ.COLUMN_NAME || ' detail ' || 'from V_DIFF_' || observ.TABLE_NAME || ' v ' || 'join ' || observ.TABLE_NAME || ' t on t.source_code = v.source_code ' || 'where ' || u_col_name || ' = 1 and ' || where_to_value || ' ' || 'order by v.source_code'; --DBMS_OUTPUT.PUT_LINE(i_query); OPEN rc FOR i_query; LOOP FETCH rc INTO l_id, l_detail; EXIT WHEN rc%NOTFOUND; --DBMS_OUTPUT.PUT_LINE(l_id); DBMS_OUTPUT.PUT_LINE(l_detail); insert into IMPORT_OBSERV_ETAB_RESULT(ID, IMPORT_OBSERV_ETAB_ID, DATE_CREATION, SOURCE_CODE, RESULTAT, TOO_OLD) values (IMPORT_OBSERV_RESULT_ID_SEQ.nextval, observEtab.ID, sysdate, l_id, l_detail, 0); END LOOP; END; PROCEDURE STORE_OBSERV_RESULTS IS BEGIN -- Parcours des IMPORT_OBSERV_ETAB de type UPDATE et non désactivés. for observEtab in ( select ioe.* from IMPORT_OBSERV_ETAB ioe join IMPORT_OBSERV io on ioe.IMPORT_OBSERV_ID = io.ID and io.OPERATION = 'UPDATE' where ioe.ENABLED = 1 ) loop STORE_UPDATE_OBSERV_RESULT(observEtab); end loop; END; PROCEDURE SYNCHRONISATION IS BEGIN STORE_OBSERV_RESULTS; SYNC_TABLES; END; END APP_IMPORT;