Commit 3bd1996e authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Connexion du workflow à tbl_service & tbl_referentiel

suppression de tbl_service_saisie
parent 00daeb1b
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE_ANNEE_FK',
'unique' => FALSE,
'table' => 'TBL_SERVICE_SAISIE',
'columns' => [
'ANNEE_ID',
],
];
//@formatter:on
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE_PK',
'unique' => TRUE,
'table' => 'TBL_SERVICE_SAISIE',
'columns' => [
'ID',
],
];
//@formatter:on
<?php
//@formatter:off
return [
'name' => 'TBL_SRV_SAISIE_INTERVENANT_FK',
'unique' => FALSE,
'table' => 'TBL_SERVICE_SAISIE',
'columns' => [
'INTERVENANT_ID',
],
];
//@formatter:on
......@@ -352,6 +352,7 @@ CREATE OR REPLACE PACKAGE BODY OSE_WORKFLOW AS
intervenant CLOB;
dossier CLOB;
service_saisie CLOB;
service_saisie_realise CLOB;
validation_enseignement CLOB;
validation_referentiel CLOB;
pieces_justificatives CLOB;
......@@ -448,27 +449,56 @@ CREATE OR REPLACE PACKAGE BODY OSE_WORKFLOW AS
service_saisie := '
SELECT
e.code etape_code,
tss.intervenant_id intervenant_id,
NULL structure_id,
1 objectif,
CASE
WHEN e.code = ''SERVICE_SAISIE'' THEN
CASE WHEN tss.heures_service_prev + tss.heures_referentiel_prev > 0 THEN 1 ELSE 0 END
''SERVICE_SAISIE'' etape_code,
i.id intervenant_id,
NULL structure_id,
1 objectif,
CASE WHEN t.intervenant_id IS NULL THEN 0 ELSE 1 END realisation
FROM
intervenant i
JOIN statut si ON si.id = i.statut_id
LEFT JOIN (
SELECT DISTINCT t.intervenant_id
FROM tbl_service t
WHERE t.heures > 0 AND t.type_volume_horaire_code = ''PREVU''
UNION
SELECT DISTINCT t.intervenant_id
FROM tbl_referentiel t
WHERE t.heures > 0 AND t.type_volume_horaire_code = ''PREVU''
) t ON t.intervenant_id = i.id
WHERE
i.histo_destruction IS NULL
AND (si.service_prevu = 1 OR si.referentiel_prevu = 1)
';
WHEN e.code = ''SERVICE_SAISIE_REALISE'' THEN
CASE WHEN tss.heures_service_real + tss.heures_referentiel_real > 0 THEN 1 ELSE 0 END
END realisation
service_saisie_realise := '
SELECT
''SERVICE_SAISIE_REALISE'' etape_code,
i.id intervenant_id,
NULL structure_id,
1 objectif,
CASE WHEN t.intervenant_id IS NULL THEN 0 ELSE 1 END realisation
FROM
TBL_SERVICE_SAISIE tss
JOIN (
SELECT ''SERVICE_SAISIE'' code FROM dual
UNION SELECT ''SERVICE_SAISIE_REALISE'' code FROM dual
) e ON 1=1
intervenant i
JOIN statut si ON si.id = i.statut_id
LEFT JOIN (
SELECT DISTINCT t.intervenant_id
FROM tbl_service t
WHERE t.heures > 0 AND t.type_volume_horaire_code = ''REALISE''
UNION
SELECT DISTINCT t.intervenant_id
FROM tbl_referentiel t
WHERE t.heures > 0 AND t.type_volume_horaire_code = ''REALISE''
) t ON t.intervenant_id = i.id
WHERE
' || unicaen_tbl.MAKE_WHERE(param, VALUE) || '
AND (tss.service = 1 OR tss.referentiel = 1)
i.histo_destruction IS NULL
AND (si.service_realise = 1 OR si.referentiel_realise = 1)
';
......@@ -676,6 +706,7 @@ CREATE OR REPLACE PACKAGE BODY OSE_WORKFLOW AS
JOIN wf_etape e ON 1 = CASE ' || dems || ' END
LEFT JOIN ( ' || dossier || '
UNION ALL ' || service_saisie || '
UNION ALL ' || service_saisie_realise || '
UNION ALL ' || validation_enseignement || '
UNION ALL ' || validation_referentiel || '
UNION ALL ' || pieces_justificatives || '
......
......@@ -2649,80 +2649,9 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
PROCEDURE C_SERVICE_SAISIE(useParams BOOLEAN DEFAULT FALSE) IS
TYPE r_cursor IS REF CURSOR;
c r_cursor;
d TBL_SERVICE_SAISIE%rowtype;
viewQuery CLOB;
BEGIN
viewQuery := 'SELECT
i.annee_id,
i.id intervenant_id,
si.service,
si.referentiel,
SUM( CASE WHEN tvhs.code = ''PREVU'' THEN NVL(vh .heures,0) ELSE 0 END ) heures_service_prev,
SUM( CASE WHEN tvhrs.code = ''PREVU'' THEN NVL(vhr.heures,0) ELSE 0 END ) heures_referentiel_prev,
SUM( CASE WHEN tvhs.code = ''REALISE'' THEN NVL(vh .heures,0) ELSE 0 END ) heures_service_real,
SUM( CASE WHEN tvhrs.code = ''REALISE'' THEN NVL(vhr.heures,0) ELSE 0 END ) heures_referentiel_real
FROM
intervenant i
JOIN statut si ON si.id = i.statut_id
LEFT JOIN service s ON s.intervenant_id = i.id AND s.histo_destruction IS NULL
LEFT JOIN volume_horaire vh ON vh.service_id = s.id AND vh.histo_destruction IS NULL
LEFT JOIN type_volume_horaire tvhs ON tvhs.id = vh.type_volume_horaire_id
LEFT JOIN service_referentiel sr ON sr.intervenant_id = i.id AND sr.histo_destruction IS NULL
LEFT JOIN volume_horaire_ref vhr ON vhr.service_referentiel_id = sr.id AND vhr.histo_destruction IS NULL
LEFT JOIN type_volume_horaire tvhrs ON tvhrs.id = vhr.type_volume_horaire_id
WHERE
i.histo_destruction IS NULL
/*@INTERVENANT_ID=i.id*/
/*@ANNEE_ID=i.annee_id*/
GROUP BY
i.annee_id,
i.id,
si.service,
si.referentiel';
OPEN c FOR '
SELECT
CASE WHEN
t.ANNEE_ID = v.ANNEE_ID
AND t.INTERVENANT_ID = v.INTERVENANT_ID
AND t.SERVICE = v.SERVICE
AND t.REFERENTIEL = v.REFERENTIEL
AND t.HEURES_SERVICE_PREV = v.HEURES_SERVICE_PREV
AND t.HEURES_REFERENTIEL_PREV = v.HEURES_REFERENTIEL_PREV
AND t.HEURES_SERVICE_REAL = v.HEURES_SERVICE_REAL
AND t.HEURES_REFERENTIEL_REAL = v.HEURES_REFERENTIEL_REAL
THEN -1 ELSE t.ID END ID,
v.ANNEE_ID,
v.INTERVENANT_ID,
v.SERVICE,
v.REFERENTIEL,
v.HEURES_SERVICE_PREV,
v.HEURES_REFERENTIEL_PREV,
v.HEURES_SERVICE_REAL,
v.HEURES_REFERENTIEL_REAL
FROM
(' || QUERY_APPLY_PARAMS(viewQuery, useParams) || ') v
FULL JOIN TBL_SERVICE_SAISIE t ON
t.INTERVENANT_ID = v.INTERVENANT_ID
WHERE ' || PARAMS_MAKE_FILTER(useParams);
LOOP
FETCH c INTO d; EXIT WHEN c%NOTFOUND;
IF d.id IS NULL THEN
d.id := TBL_SERVICE_SAISIE_ID_SEQ.NEXTVAL;
INSERT INTO TBL_SERVICE_SAISIE values d;
ELSIF
d.INTERVENANT_ID IS NULL
THEN
DELETE FROM TBL_SERVICE_SAISIE WHERE id = d.id;
ELSIF d.id <> -1 THEN
UPDATE TBL_SERVICE_SAISIE SET row = d WHERE id = d.id;
END IF;
END LOOP;
CLOSE c;
BEGIN
return;
END;
......
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE_PK',
'table' => 'TBL_SERVICE_SAISIE',
'index' => 'TBL_SERVICE_SAISIE_PK',
'columns' => [
'ID',
],
];
//@formatter:on
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE_ANNEE_FK',
'table' => 'TBL_SERVICE_SAISIE',
'rtable' => 'ANNEE',
'delete_rule' => 'CASCADE',
'index' => NULL,
'columns' => [
'ANNEE_ID' => 'ID',
],
];
//@formatter:on
<?php
//@formatter:off
return [
'name' => 'TBL_SRV_SAISIE_INTERVENANT_FK',
'table' => 'TBL_SERVICE_SAISIE',
'rtable' => 'INTERVENANT',
'delete_rule' => 'CASCADE',
'index' => NULL,
'columns' => [
'INTERVENANT_ID' => 'ID',
],
];
//@formatter:on
......@@ -116,7 +116,6 @@ return [
'TBL_PLAFOND_VOLUME_HORA_ID_SEQ',
'TBL_SERVICE_ID_SEQ',
'TBL_SERVICE_REFERENTIEL_ID_SEQ',
'TBL_SERVICE_SAISIE_ID_SEQ',
'TBL_VALIDATION_ENSEIGNE_ID_SEQ',
'TBL_VALIDATION_REFERENT_ID_SEQ',
'TBL_WORKFLOW_ID_SEQ',
......
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE',
'temporary' => FALSE,
'logging' => FALSE,
'commentaire' => 'Service (pour alimenter le Workflow)',
'sequence' => 'TBL_SERVICE_SAISIE_ID_SEQ',
'columns' => [
'ANNEE_ID' => [
'name' => 'ANNEE_ID',
'type' => 'int',
'bdd-type' => 'NUMBER',
'length' => 0,
'scale' => '0',
'precision' => NULL,
'nullable' => FALSE,
'default' => NULL,
'position' => 2,
'commentaire' => NULL,
],
'HEURES_REFERENTIEL_PREV' => [
'name' => 'HEURES_REFERENTIEL_PREV',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 7,
'commentaire' => 'NB d\'heures de référentiel prévisionnel',
],
'HEURES_REFERENTIEL_REAL' => [
'name' => 'HEURES_REFERENTIEL_REAL',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 9,
'commentaire' => 'NB d\'heures de référentiel réalisé',
],
'HEURES_SERVICE_PREV' => [
'name' => 'HEURES_SERVICE_PREV',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 6,
'commentaire' => 'NB d\'heures de service prévisionnel',
],
'HEURES_SERVICE_REAL' => [
'name' => 'HEURES_SERVICE_REAL',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 8,
'commentaire' => 'NB d\'heures de service réalisé',
],
'ID' => [
'name' => 'ID',
'type' => 'int',
'bdd-type' => 'NUMBER',
'length' => 0,
'scale' => '0',
'precision' => NULL,
'nullable' => FALSE,
'default' => NULL,
'position' => 1,
'commentaire' => NULL,
],
'INTERVENANT_ID' => [
'name' => 'INTERVENANT_ID',
'type' => 'int',
'bdd-type' => 'NUMBER',
'length' => 0,
'scale' => '0',
'precision' => NULL,
'nullable' => FALSE,
'default' => NULL,
'position' => 3,
'commentaire' => NULL,
],
'REFERENTIEL' => [
'name' => 'REFERENTIEL',
'type' => 'bool',
'bdd-type' => 'NUMBER',
'length' => 0,
'scale' => '0',
'precision' => 1,
'nullable' => FALSE,
'default' => '0',
'position' => 5,
'commentaire' => 'Témoin (0 ou 1)',
],
'SERVICE' => [
'name' => 'SERVICE',
'type' => 'bool',
'bdd-type' => 'NUMBER',
'length' => 0,
'scale' => '0',
'precision' => 1,
'nullable' => FALSE,
'default' => '0',
'position' => 4,
'commentaire' => 'Témoin (0 ou 1)',
],
],
];
//@formatter:on
<?php
//@formatter:off
return [
'name' => 'TBL_SERVICE_SAISIE_UN',
'table' => 'TBL_SERVICE_SAISIE',
'index' => 'TBL_SRV_SAISIE_INTERVENANT_FK',
'columns' => [
'INTERVENANT_ID',
],
];
//@formatter:on
......@@ -105,22 +105,13 @@ FROM
LEFT JOIN validation v ON v.intervenant_id = i.id
AND v.type_validation_id = tv.id
AND v.histo_destruction IS NULL
/*Champs autre 1*/
LEFT JOIN dossier_champ_autre_par_statut dcas1 ON dcas1.dossier_champ_autre_id = 1 AND dcas1.statut_id = si.id
LEFT JOIN dossier_champ_autre dca1 ON dca1.id = 1 AND dcas1.dossier_champ_autre_id = dca1.id
/*Champs autre 2*/
LEFT JOIN dossier_champ_autre_par_statut dcas2 ON dcas2.dossier_champ_autre_id = 2 AND dcas2.statut_id = si.id
LEFT JOIN dossier_champ_autre dca2 ON dca2.id = 2 AND dcas2.dossier_champ_autre_id = dca2.id
/*Champs autre 3*/
LEFT JOIN dossier_champ_autre_par_statut dcas3 ON dcas3.dossier_champ_autre_id = 3 AND dcas3.statut_id = si.id
LEFT JOIN dossier_champ_autre dca3 ON dca3.id = 3 AND dcas3.dossier_champ_autre_id = dca3.id
/*Champs autre 4*/
LEFT JOIN dossier_champ_autre_par_statut dcas4 ON dcas4.dossier_champ_autre_id = 4 AND dcas4.statut_id = si.id
LEFT JOIN dossier_champ_autre dca4 ON dca4.id = 4 AND dcas4.dossier_champ_autre_id = dca4.id
/*Champs autre 5*/
LEFT JOIN dossier_champ_autre_par_statut dcas5 ON dcas5.dossier_champ_autre_id = 5 AND dcas5.statut_id = si.id
LEFT JOIN dossier_champ_autre dca5 ON dca5.id = 5 AND dcas5.dossier_champ_autre_id = dca5.id
LEFT JOIN dossier_champ_autre dca1 ON dca1.id = 1 AND si.dossier_autre_1 = 1
LEFT JOIN dossier_champ_autre dca2 ON dca2.id = 2 AND si.dossier_autre_2 = 1
LEFT JOIN dossier_champ_autre dca3 ON dca3.id = 3 AND si.dossier_autre_3 = 1
LEFT JOIN dossier_champ_autre dca4 ON dca4.id = 4 AND si.dossier_autre_4 = 1
LEFT JOIN dossier_champ_autre dca5 ON dca5.id = 5 AND si.dossier_autre_5 = 1
WHERE
i.histo_destruction IS NULL
/*@INTERVENANT_ID=i.id*/
/*@INTERVENANT_ID=i.id*/
/*@ANNEE_ID=i.annee_id*/
\ No newline at end of file
CREATE OR REPLACE FORCE VIEW V_TBL_SERVICE_SAISIE AS
SELECT
i.annee_id,
i.id intervenant_id,
si.service,
si.referentiel,
SUM( CASE WHEN tvhs.code = 'PREVU' THEN NVL(vh .heures,0) ELSE 0 END ) heures_service_prev,
SUM( CASE WHEN tvhrs.code = 'PREVU' THEN NVL(vhr.heures,0) ELSE 0 END ) heures_referentiel_prev,
SUM( CASE WHEN tvhs.code = 'REALISE' THEN NVL(vh .heures,0) ELSE 0 END ) heures_service_real,
SUM( CASE WHEN tvhrs.code = 'REALISE' THEN NVL(vhr.heures,0) ELSE 0 END ) heures_referentiel_real
FROM
intervenant i
JOIN statut si ON si.id = i.statut_id
LEFT JOIN service s ON s.intervenant_id = i.id AND s.histo_destruction IS NULL
LEFT JOIN volume_horaire vh ON vh.service_id = s.id AND vh.histo_destruction IS NULL
LEFT JOIN type_volume_horaire tvhs ON tvhs.id = vh.type_volume_horaire_id
LEFT JOIN service_referentiel sr ON sr.intervenant_id = i.id AND sr.histo_destruction IS NULL
LEFT JOIN volume_horaire_ref vhr ON vhr.service_referentiel_id = sr.id AND vhr.histo_destruction IS NULL
LEFT JOIN type_volume_horaire tvhrs ON tvhrs.id = vhr.type_volume_horaire_id
WHERE
i.histo_destruction IS NULL
/*@INTERVENANT_ID=i.id*/
/*@ANNEE_ID=i.annee_id*/
GROUP BY
i.annee_id,
i.id,
si.service,
si.referentiel
\ No newline at end of file
......@@ -1600,17 +1600,6 @@ return [
'HEURES',
'VALIDE',
],
'TBL_SERVICE_SAISIE' => [
'ID',
'ANNEE_ID',
'INTERVENANT_ID',
'SERVICE',
'REFERENTIEL',
'HEURES_SERVICE_PREV',
'HEURES_REFERENTIEL_PREV',
'HEURES_SERVICE_REAL',
'HEURES_REFERENTIEL_REAL',
],
'TBL_VALIDATION_ENSEIGNEMENT' => [
'ID',
'ANNEE_ID',
......
......@@ -8,6 +8,7 @@ return [
'TMP_SCENARIO_NOEUD_EFFECTIF',
'DOSSIER_CHAMP_AUTRE_PAR_STATUT',
'TBL_SERVICE_REFERENTIEL',
'TBL_SERVICE_SAISIE',
],
],
'materialized-view' => [
......@@ -40,6 +41,7 @@ return [
'V_INDICATEUR_1230',
'V_INDICATEUR_1240',
'V_TBL_SERVICE_REFERENTIEL',
'V_TBL_SERVICE_SAISIE',
], 'excludes' => [
'V_TBL_PLAFOND_%', // Les vues plafonds sont générées et non créées à partir de la DDL
],
......@@ -59,7 +61,7 @@ return [
],
'sequence' => [
'includes' => [
'TBL_SERVICE_SAISIE_ID_SEQ',
],
],
];
\ No newline at end of file
......@@ -662,16 +662,6 @@ return [
'ORDRE' => 9,
'FEUILLE_DE_ROUTE' => true,
],
[
'TBL_NAME' => 'service_saisie',
'TABLE_NAME' => 'TBL_SERVICE_SAISIE',
'VIEW_NAME' => 'V_TBL_SERVICE_SAISIE',
'SEQUENCE_NAME' => null,
'CONSTRAINT_NAME' => 'TBL_SERVICE_SAISIE_UN',
'CUSTOM_CALCUL_PROC' => null,
'ORDRE' => 10,
'FEUILLE_DE_ROUTE' => true,
],
[
'TBL_NAME' => 'referentiel',
'TABLE_NAME' => 'TBL_REFERENTIEL',
......
......@@ -2,8 +2,8 @@ SELECT
i.annee_id annee_id,
fr.type_volume_horaire_id type_volume_horaire_id,
i.id intervenant_id,
fr.heures_compl_fc_majorees heures,
ROUND( (COALESCE(si.plafond_hc_remu_fc,0) - COALESCE(i.montant_indemnite_fc,0)) / a.taux_hetd, 2 ) plafond
fr.heures_compl_fc_majorees heures
/*ROUND( (COALESCE(si.plafond_hc_remu_fc,0) - COALESCE(i.montant_indemnite_fc,0)) / a.taux_hetd, 2 ) plafond*/
FROM
intervenant i
......
......@@ -372,24 +372,6 @@ Référentiel
| HEURES | Nombre d'heures concernées |
## Table TBL_SERVICE_SAISIE
Service (pour alimenter le Workflow)
| Colonne |Description |
|-------------------------|---------------------------------------|
| ID | |
| ANNEE_ID |==> ANNEE.ID |
| INTERVENANT_ID |==> INTERVENANT.ID |
| SERVICE |Témoin (0 ou 1) |
| REFERENTIEL |Témoin (0 ou 1) |
| HEURES_SERVICE_PREV |NB d'heures de service prévisionnel |
| HEURES_REFERENTIEL_PREV |NB d'heures de référentiel prévisionnel|
| HEURES_SERVICE_REAL |NB d'heures de service réalisé |
| HEURES_REFERENTIEL_REAL |NB d'heures de référentiel réalisé |
## Table TBL_VALIDATION_ENSEIGNEMENT
Suivi des validations de services
......
......@@ -169,7 +169,6 @@ return [
'Application\Entity\Db\TblPieceJointeDemande' => __DIR__ . '/src/Entity/Db/TblPieceJointeDemande.php',
'Application\Entity\Db\TblPieceJointeFournie' => __DIR__ . '/src/Entity/Db/TblPieceJointeFournie.php',
'Application\Entity\Db\TblService' => __DIR__ . '/src/Entity/Db/TblService.php',
'Application\Entity\Db\TblServiceSaisie' => __DIR__ . '/src/Entity/Db/TblServiceSaisie.php',
'Application\Entity\Db\TblValidationEnseignement' => __DIR__ . '/src/Entity/Db/TblValidationEnseignement.php',
'Application\Entity\Db\TblValidationReferentiel' => __DIR__ . '/src/Entity/Db/TblValidationReferentiel.php',
'Application\Entity\Db\TblWorkflow' => __DIR__ . '/src/Entity/Db/TblWorkflow.php',
......
......@@ -316,7 +316,6 @@ class IntervenantDossierController extends AbstractController
{
$this->getServiceWorkflow()->calculerTableauxBord([
'dossier',
'service_saisie',
'piece_jointe_demande',
], $intervenant);
}
......
Supports Markdown
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