Commit 09ba9cdf authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'release-1.3.4'

parents 1d3a072c a16e0b82
Pipeline #7831 passed with stage
in 17 seconds
Journal des modifications
=========================
1.3.4 (06/07/2020)
------------------
- Possibilité d'exécuter du SQL avant la mise à jour d'une table associée à un service.
Exemple : mise à jour de la vue matérialisée SYGAL_MV_EMAIL interrogée par la vue V_SYGAL_INDIVIDU avant que la table
SYGAL_INDIVIDU soit peuplée à partir de V_SYGAL_INDIVIDU.
1.3.3 (11/03/2020)
------------------
......
<?php
return [
/**
* Eventuelles instructions SQL à exécuter avant la mise à jour d'une table de service.
*/
'services_pre_sql' => [
//'individu' => "begin DBMS_MVIEW.REFRESH('SYGAL_MV_EMAIL', 'C'); end;",
],
/**
* Connexion à la base de données.
*/
'doctrine' => [
'connection' => [
'orm_default' => [
......@@ -15,6 +24,9 @@ return [
],
],
],
/**
* Config du mode d'authentification.
*/
'zf-mvc-auth' => [
'authentication' => [
'adapters' => [
......
......@@ -2,9 +2,9 @@
return [
'unicaen-app' => [
'app_infos' => [
'version' => '1.3.3',
'date' => '11/03/2020',
'version' => '1.3.4',
'date' => '06/07/2020',
],
],
'comment' => 'Fichier généré le 11/03/2020 à 14:05:58 avec /home/gauthierb/workspace/sygal-import-ws/bump-version',
'comment' => 'Fichier généré le 06/07/2020 à 14:42:53 avec /app/bump-version',
];
......@@ -6,104 +6,107 @@
-- Web Service d'import de données
-- -------------------------------
--
-- Vue matérialisée interrogeant Apogée et l'annuaire LDAP (grâce au package UCBN_LDAP) pour obtenir
-- les adresses électroniques.
-- Vue matérialisée interrogeant Apogée et l'annuaire LDAP pour obtenir
-- les adresses électroniques (grâce au package UCBN_LDAP).
--
-- NB : cette vue matérialisée est de type "refresh complete on demand", autrement dit est mise à jour manuellement
-- à l'aide de l'instruction PL/SQL `DBMS_MVIEW.REFRESH('SYGAL_MV_EMAIL', 'C')`.
--
-- drop materialized view SYGAL_MV_EMAIL
--/
CREATE MATERIALIZED VIEW SYGAL_MV_EMAIL
refresh complete USING TRUSTED CONSTRAINTS
START WITH SYSDATE NEXT SYSDATE + 1/24/6 as
select sysdate as last_update, tmp.*
from (
create materialized view UCBN_SODOCT.SYGAL_MV_EMAIL
refresh complete on demand using trusted constraints
as
select sysdate as last_update, tmp.*
from (
select
-- doctorants
to_char(ind.cod_etu) as id,
-- Numero etudiant
ucbn_ldap.etu2mail(ind.cod_etu) as email -- Mail etudiant
-- doctorants
to_char(ind.cod_etu) as id,
-- Numero etudiant
ucbn_ldap.etu2mail(ind.cod_etu) as email -- Mail etudiant
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 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
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
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
select *
from (
-- acteurs
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
)
select distinct
coalesce(regexp_replace(per.num_dos_har_per, '[^0-9]', ''), 'COD_PER_' || act.cod_per) as id,
-- Code Harpege ou Apogee de l acteur
case when per.num_dos_har_per is null
then null
else ucbn_ldap.uid2mail('p' || per.num_dos_har_per) end as email -- Mail acteur
from acteur act
join role_jury roj on roj.cod_roj = act.cod_roj
join personnel per on per.cod_per = act.cod_per
)
) tmp
where email is not null
-- acteurs
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
)
select distinct
coalesce(regexp_replace(per.num_dos_har_per, '[^0-9]', ''), 'COD_PER_' || act.cod_per) as id,
-- Code Harpege ou Apogee de l acteur
case when per.num_dos_har_per is null
then null
else ucbn_ldap.uid2mail('p' || per.num_dos_har_per) end as email -- Mail acteur
from acteur act
join role_jury roj on roj.cod_roj = act.cod_roj
join personnel per on per.cod_per = act.cod_per
)
) tmp
where email is not null
/
\ No newline at end of file
Version 1.3.4
=============
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.4 && 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
---------------
Nada.
......@@ -22,6 +22,11 @@ class TableService
*/
private $servicesToEntityClassesConfig;
/**
* @var array
*/
private $servicesPreSql = [];
/**
* Liste des colonnes à exclure lors de la mise à jour des tables sources.
*
......@@ -47,6 +52,14 @@ class TableService
$this->servicesToEntityClassesConfig = $servicesToEntityClassesConfig;
}
/**
* @param array $servicesPreSql
*/
public function setServicesPreSql(array $servicesPreSql)
{
$this->servicesPreSql = $servicesPreSql;
}
/**
* Lance la mise à jour des tables sources.
*
......@@ -122,14 +135,17 @@ class TableService
// exclusion éventuelle de certaines colonnes
$columnNames = array_diff($columnNames, $this->excludedColumnNames);
// SQL à exécuter au préalable ?
if (isset($this->servicesPreSql[$service])) {
$sqlParts[] = $this->servicesPreSql[$service];
}
$sqlParts[] = sprintf($deleteTemplate, $tableName);
$sqlParts[] = sprintf($updateTemplate, $tableName, $cols = implode(', ', $columnNames), $cols, $tableName);
}
$sqlParts[] = 'end;';
$sql = implode(PHP_EOL, $sqlParts);
return $sql;
return implode(PHP_EOL, $sqlParts);
}
/**
......
......@@ -15,10 +15,12 @@ class TableServiceFactory
/** @var array $config */
$config = $container->get('config');
$servicesToEntityClassesConfig = $config['services_to_entity_classes'];
$servicesPreSql = $config['services_pre_sql'] ?? [];
$service = new TableService();
$service->setEntityManager($entityManager);
$service->setServicesToEntityClassesConfig($servicesToEntityClassesConfig);
$service->setServicesPreSql($servicesPreSql);
return $service;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment