[#1110] Simplification: directly use symbols
This commit is contained in:
parent
b1b8ebe1a3
commit
b603af1ec7
1 changed files with 11 additions and 11 deletions
|
@ -59,25 +59,25 @@ class AttestationTemplate < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_tags
|
def dossier_tags
|
||||||
[{ libelle: 'motivation', description: '', target: 'motivation' },
|
[{ libelle: 'motivation', description: '', target: :motivation },
|
||||||
{ libelle: 'numéro du dossier', description: '', target: 'id' }]
|
{ libelle: 'numéro du dossier', description: '', target: :id }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def individual_tags
|
def individual_tags
|
||||||
[{ libelle: 'civilité', description: 'M., Mme', target: 'gender' },
|
[{ libelle: 'civilité', description: 'M., Mme', target: :gender },
|
||||||
{ libelle: 'nom', description: "nom de l'usager", target: 'nom' },
|
{ libelle: 'nom', description: "nom de l'usager", target: :nom },
|
||||||
{ libelle: 'prénom', description: "prénom de l'usager", target: 'prenom' }]
|
{ libelle: 'prénom', description: "prénom de l'usager", target: :prenom }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def entreprise_tags
|
def entreprise_tags
|
||||||
[{ libelle: 'SIREN', description: '', target: 'siren' },
|
[{ libelle: 'SIREN', description: '', target: :siren },
|
||||||
{ libelle: 'numéro de TVA intracommunautaire', description: '', target: 'numero_tva_intracommunautaire' },
|
{ libelle: 'numéro de TVA intracommunautaire', description: '', target: :numero_tva_intracommunautaire },
|
||||||
{ libelle: 'SIRET du siège social', description: '', target: 'siret_siege_social' },
|
{ libelle: 'SIRET du siège social', description: '', target: :siret_siege_social },
|
||||||
{ libelle: 'raison sociale', description: '', target: 'raison_sociale' }]
|
{ libelle: 'raison sociale', description: '', target: :raison_sociale }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def etablissement_tags
|
def etablissement_tags
|
||||||
[{ libelle: 'adresse', description: '', target: 'inline_adresse' }]
|
[{ libelle: 'adresse', description: '', target: :inline_adresse }]
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_pdf(dossier)
|
def build_pdf(dossier)
|
||||||
|
@ -135,7 +135,7 @@ class AttestationTemplate < ApplicationRecord
|
||||||
def replace_tags_with_values_from_data(text, tags, data)
|
def replace_tags_with_values_from_data(text, tags, data)
|
||||||
if data.present?
|
if data.present?
|
||||||
tags.inject(text) do |acc, tag|
|
tags.inject(text) do |acc, tag|
|
||||||
replace_tag(acc, tag, data.send(tag[:target].to_sym))
|
replace_tag(acc, tag, data.send(tag[:target]))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
text
|
text
|
||||||
|
|
Loading…
Add table
Reference in a new issue