Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
sygal-import-ws
Commits
09400cc7
Commit
09400cc7
authored
Jul 06, 2020
by
Bertrand Gauthier
Browse files
Merge branch 'feature_pre_sql' into release-1.3.4
parents
1d3a072c
d311dd92
Changes
4
Hide whitespace changes
Inline
Side-by-side
config/autoload/local.php.dist
View file @
09400cc7
<?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'
=>
[
...
...
dist/SQL/apogee/annexe-emails.sql
View file @
09400cc7
...
...
@@ -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
module/Application/src/Service/TableService.php
View file @
09400cc7
...
...
@@ -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
);
}
/**
...
...
module/Application/src/Service/TableServiceFactory.php
View file @
09400cc7
...
...
@@ -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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment