Commit 8d6bdfae authored by Florian Joriot's avatar Florian Joriot
Browse files

Remontée de la composante d'affectation si celle du contrat est null dans l'indicateur des contrats

parent 8f4c1cde
Loading
Loading
Loading
Loading
+2 −1
Changes for data/ddl/view/V_INDICATEUR_450.sql: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_450 AS
SELECT DISTINCT
  c.intervenant_id,
  c.structure_id
  COALESCE(c.structure_id, i.structure_id) structure_id
FROM
  contrat                c
    JOIN intervenant i ON c.intervenant_id = i.id
    JOIN contrat_fichier  cf ON cf.contrat_id = c.id
    JOIN fichier           f ON f.id = cf.fichier_id
    AND f.histo_destruction IS NULL
+2 −1
Changes for data/ddl/view/V_INDICATEUR_460.sql: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_460 AS
SELECT DISTINCT
  c.intervenant_id,
  c.structure_id
  COALESCE(c.structure_id, i.structure_id) structure_id
FROM
  contrat                c
    JOIN tbl_workflow w ON w.intervenant_id = c.intervenant_id AND (w.structure_id = c.structure_id OR w.structure_id is NULL) AND w.etape_code = 'CONTRAT' AND w.atteignable = 1
    JOIN validation v ON v.id = c.validation_id AND v.histo_destruction IS NULL
    JOIN intervenant i ON c.intervenant_id = i.id
    LEFT JOIN contrat_fichier cf ON cf.contrat_id = c.id
    LEFT JOIN fichier f ON f.id = cf.fichier_id AND f.histo_destruction IS NULL
WHERE