Commit a21a69b8 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Ajout SRC octopus pour affectation recherche et structure code

parent fd482415
Loading
Loading
Loading
Loading
+25 −0
Changes for doc/Connecteurs Import/Octopus/SRC_AFFECTATION_RECHERCHE.sql: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
CREATE
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,
 		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)
 )
SELECT i.id                                                           intervenant_id,
       s2.id                                                          structure_id,
       src.id                                                         source_id,
       affrech.source_code || '_' || unicaen_import.get_current_annee source_code,
       s2.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
         LEFT JOIN octo.v_structure@octoprod s2 ON sr.structure_id = s2.id
 No newline at end of file
+7 −0
Changes for doc/Connecteurs Import/Octopus/SRC_HARPEGE_STRUCTURE_CODES.sql: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
CREATE
OR REPLACE VIEW SRC_HARPEGE_STRUCTURE_CODES AS
SELECT vs.code  c_structure,
       vs2.code c_structuren2
FROM v_structure@ vs
         JOIN v_structure vs2 ON vs.niv2_id = vs2.id
WHERE vs.racine_id = (SELECT id FROM v_structure WHERE code = 'UNIV')
 No newline at end of file