Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
OSE
Commits
dd9f64c3
Commit
dd9f64c3
authored
Sep 01, 2021
by
Laurent Lécluse
Browse files
Meilleure gestion des non autorisés / Autres
parent
40a61627
Changes
1
Hide whitespace changes
Inline
Side-by-side
doc/Connecteurs-Import/Générique/SRC_INTERVENANT.sql
View file @
dd9f64c3
...
...
@@ -57,7 +57,7 @@ FROM (
CASE
-- Cas 1 : Si on est sur un statut multiple avec un non-autorisé et un autre statut, alors le non autorisé est supprimé
WHEN
statut_
intervenant
_nautorise
=
1
AND
intervenant_local
=
0
AND
nb_intervenants
>
1
AND
intervenant_histo
=
0
THEN
'drop'
WHEN
statut_
source
_nautorise
=
1
AND
nb_sources
>
1
THEN
'drop'
-- Cas 2 : Si on est sur les mêmes fiches, alors on synchronise tout le temps
...
...
@@ -152,6 +152,9 @@ FROM (
-- Si le nouveau statut est de type différent, alors on ajoute une nouvelle fiche
WHEN
types_identiques
=
0
THEN
'insert'
-- Si on a AUTRE+ NA en source et NA en intervenant => on transforme
WHEN
nb_statut_source_nautorise
>
0
AND
statut_intervenant_nautorise
=
1
THEN
'update'
-- Sinon, on ne prend pas en compte pour éviter tout problème
ELSE
'drop'
...
...
@@ -268,6 +271,8 @@ FROM (
COUNT
(
DISTINCT
ssi
.
id
)
OVER
(
PARTITION
BY
s
.
code
,
a
.
id
)
nb_sources
,
COUNT
(
DISTINCT
i
.
id
)
OVER
(
PARTITION
BY
i
.
code
,
i
.
annee_id
)
nb_intervenants
,
SUM
(
CASE
WHEN
ssi
.
id
=
i
.
statut_id
THEN
1
ELSE
0
END
)
OVER
(
PARTITION
BY
s
.
code
,
a
.
id
)
nb_statuts_egaux
,
COUNT
(
CASE
WHEN
ssi
.
code
=
'AUTRES'
THEN
1
ELSE
0
END
)
OVER
(
PARTITION
BY
s
.
code
,
a
.
id
)
nb_statut_source_autre
,
COUNT
(
CASE
WHEN
ssi
.
code
=
'NON_AUTORISE'
THEN
1
ELSE
0
END
)
OVER
(
PARTITION
BY
s
.
code
,
a
.
id
)
nb_statut_source_nautorise
,
MAX
(
CASE
WHEN
ssi
.
id
=
i
.
statut_id
THEN
ssi
.
id
ELSE
0
END
)
OVER
(
PARTITION
BY
s
.
code
,
a
.
id
)
statuts_egaux_id
FROM
mv_intervenant
s
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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