Skip to content
Snippets Groups Projects
Commit d4391e99 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Amélioration de la remontée des affectations de recherche via Octopus (SIHAM).

Suppression d'une contrainte d'intégrité sur structure_id de la table affectation_recherche pour éviter d'être obligé de tout remonter dans la table structure et polluer les listes de OSE.
parent ffe053ca
No related branches found
No related tags found
No related merge requests found
<?php
//@formatter:off
return [
'name' => 'AFFECTATION_R_STRUCTURE_FK',
'table' => 'AFFECTATION_RECHERCHE',
'rtable' => 'STRUCTURE',
'delete_rule' => NULL,
'index' => NULL,
'columns' => [
'STRUCTURE_ID' => 'ID',
],
];
//@formatter:on
...@@ -3,24 +3,22 @@ OR REPLACE FORCE VIEW SRC_AFFECTATION_RECHERCHE AS ...@@ -3,24 +3,22 @@ OR REPLACE FORCE VIEW SRC_AFFECTATION_RECHERCHE AS
WITH affectation_recherche AS ( WITH affectation_recherche AS (
SELECT SELECT
indaff.individu_id z_code, indaff.individu_id z_code,
s.structure_recherche_id z_structure_recherche_id, s.id z_structure_recherche_id,
indaff.id source_code indaff.id source_code
from from
octo.individu_affectation@octoprod indaff octo.individu_affectation@octoprod indaff
JOIN octo.v_structure@octoprod s ON s.id = indaff.structure_id JOIN octo.v_structure@octoprod s ON s.id = indaff.structure_id
WHERE WHERE
indaff.type_id = 3--Uniquement les affectations de type recherche indaff.type_id = 3--Uniquement les affectations de type recherche
AND SYSDATE BETWEEN indaff.date_debut AND COALESCE(indaff.date_fin + 1, SYSDATE) AND SYSDATE BETWEEN indaff.date_debut AND COALESCE(indaff.date_fin + 184, SYSDATE)
AND indaff.source_id = 'SIHAM'
) )
SELECT DISTINCT i.id intervenant_id, SELECT DISTINCT i.id intervenant_id,
s.id structure_id, s.id structure_id,
src.id source_id, src.id source_id,
i.id || '_' || s.id source_code, i.id || '_' || s.id source_code,
s2.libelle_court labo_libelle s.libelle_court labo_libelle
FROM affectation_recherche affrech FROM affectation_recherche affrech
JOIN source src ON src.code = 'Octopus' JOIN source src ON src.code = 'Octopus'
JOIN intervenant i ON i.code = CAST(affrech.z_code AS varchar(255)) JOIN intervenant i ON i.code = CAST(affrech.z_code AS varchar(255)) AND i.annee_id = unicaen_import.get_current_annee
AND i.annee_id = unicaen_import.get_current_annee JOIN octo.v_structure@octoprod s ON affrech.z_structure_recherche_id = s.id
JOIN octo.structure_recherche@octoprod sr ON sr.id = affrech.z_structure_recherche_id \ No newline at end of file
JOIN octo.v_structure@octoprod s2 ON sr.structure_id = s2.id
JOIN structure s ON s2.code = s.source_code;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment