[#2180] Expose migrated types PJ as legacy types PJ in procedure API
This commit is contained in:
parent
5e37400834
commit
082255b489
3 changed files with 57 additions and 1 deletions
|
@ -67,4 +67,21 @@ class PiecesJustificativesService
|
|||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def self.serialize_types_de_champ_as_type_pj(procedure)
|
||||
tdcs = procedure.types_de_champ.select { |type_champ| type_champ.old_pj.present? }
|
||||
tdcs.map.with_index do |type_champ, order_place|
|
||||
description = type_champ.description
|
||||
if /^(?<original_description>.*?)(?:[\r\n]+)Récupérer le formulaire vierge pour mon dossier : (?<lien_demarche>http.*)$/m =~ description
|
||||
description = original_description
|
||||
end
|
||||
{
|
||||
id: type_champ.old_pj[:stable_id],
|
||||
libelle: type_champ.libelle,
|
||||
description: description,
|
||||
order_place: order_place,
|
||||
lien_demarche: lien_demarche
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue