--
-- BEGIN / [#10547] Ajout du champ de fusion : département dépôt dossier
--

UPDATE om_requete SET
    requete = REPLACE(requete, 'dossier_instruction_type.libelle AS libelle_dit', 'dossier_instruction_type.libelle AS libelle_dit,
        (SELECT libelle FROM ledepartement) AS departement_dossier')
WHERE
    requete NOT LIKE '%dossier_instruction_type.libelle AS libelle_dit,
        (SELECT libelle FROM ledepartement) AS departement_dossier%'
    AND code = 'instruction';

UPDATE om_requete SET
    merge_fields = REPLACE(merge_fields, '[libelle_dit]', '[libelle_dit]
[departement_dossier] : libellé du département de dépôt du dossier')
WHERE
    merge_fields NOT LIKE '%[libelle_dit]
[departement_dossier] : libellé du département de dépôt du dossier%'
    AND code = 'instruction';