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
Loading
Loading
Loading
Loading
−16

File deleted.

+6 −8
Changes for doc/Connecteurs-Import/Octopus/SRC_AFFECTATION_RECHERCHE.sql: 6 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -3,24 +3,22 @@ OR REPLACE FORCE VIEW SRC_AFFECTATION_RECHERCHE AS
WITH affectation_recherche AS (
 	SELECT
 		indaff.individu_id           z_code,
 		s.structure_recherche_id     z_structure_recherche_id,
 		s.id     					 z_structure_recherche_id,
 		indaff.id                    source_code
 	from
 		octo.individu_affectation@octoprod indaff
 	    JOIN octo.v_structure@octoprod s ON s.id = indaff.structure_id
 	WHERE
 		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,
                s.id                structure_id,
                src.id              source_id,
                i.id || '_' || s.id source_code,
                s2.libelle_court    labo_libelle
                s.libelle_court    labo_libelle
FROM affectation_recherche affrech
         JOIN source src ON src.code = 'Octopus'
         JOIN intervenant i ON i.code = CAST(affrech.z_code AS varchar(255))
    AND i.annee_id = unicaen_import.get_current_annee
         JOIN octo.structure_recherche@octoprod sr ON sr.id = affrech.z_structure_recherche_id
         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
         JOIN intervenant i ON i.code = CAST(affrech.z_code AS varchar(255))  AND i.annee_id = unicaen_import.get_current_annee
         JOIN octo.v_structure@octoprod s ON affrech.z_structure_recherche_id = s.id
 No newline at end of file