diff --git a/app/models/champs/departement_champ.rb b/app/models/champs/departement_champ.rb index 962d2e182..f197a58c4 100644 --- a/app/models/champs/departement_champ.rb +++ b/app/models/champs/departement_champ.rb @@ -21,6 +21,10 @@ # type_de_champ_id :integer # class Champs::DepartementChamp < Champs::TextChamp + def for_export + [name, code] + end + def to_s formatted_value end diff --git a/app/models/champs/pays_champ.rb b/app/models/champs/pays_champ.rb index 80d580cb7..8246a18ee 100644 --- a/app/models/champs/pays_champ.rb +++ b/app/models/champs/pays_champ.rb @@ -21,6 +21,10 @@ # type_de_champ_id :integer # class Champs::PaysChamp < Champs::TextChamp + def for_export + [formatted_value, code] + end + def to_s formatted_value end diff --git a/app/models/champs/region_champ.rb b/app/models/champs/region_champ.rb index ec9450af8..3426b337c 100644 --- a/app/models/champs/region_champ.rb +++ b/app/models/champs/region_champ.rb @@ -21,6 +21,10 @@ # type_de_champ_id :integer # class Champs::RegionChamp < Champs::TextChamp + def for_export + [name, code] + end + def selected code end diff --git a/app/models/types_de_champ/departement_type_de_champ.rb b/app/models/types_de_champ/departement_type_de_champ.rb index 58a8cb3d0..e4b36b91f 100644 --- a/app/models/types_de_champ/departement_type_de_champ.rb +++ b/app/models/types_de_champ/departement_type_de_champ.rb @@ -1,2 +1,5 @@ class TypesDeChamp::DepartementTypeDeChamp < TypesDeChamp::TextTypeDeChamp + def libelle_for_export(index) + [libelle, "#{libelle} (Code)"][index] + end end diff --git a/app/models/types_de_champ/pays_type_de_champ.rb b/app/models/types_de_champ/pays_type_de_champ.rb index c35e06d78..4067f22d0 100644 --- a/app/models/types_de_champ/pays_type_de_champ.rb +++ b/app/models/types_de_champ/pays_type_de_champ.rb @@ -1,2 +1,5 @@ class TypesDeChamp::PaysTypeDeChamp < TypesDeChamp::TextTypeDeChamp + def libelle_for_export(index) + [libelle, "#{libelle} (Code)"][index] + end end diff --git a/app/models/types_de_champ/region_type_de_champ.rb b/app/models/types_de_champ/region_type_de_champ.rb index b694303fb..3d22f492d 100644 --- a/app/models/types_de_champ/region_type_de_champ.rb +++ b/app/models/types_de_champ/region_type_de_champ.rb @@ -1,2 +1,5 @@ class TypesDeChamp::RegionTypeDeChamp < TypesDeChamp::TextTypeDeChamp + def libelle_for_export(index) + [libelle, "#{libelle} (Code)"][index] + end end diff --git a/spec/services/procedure_export_service_spec.rb b/spec/services/procedure_export_service_spec.rb index 1d62e4d73..3f3d93f08 100644 --- a/spec/services/procedure_export_service_spec.rb +++ b/spec/services/procedure_export_service_spec.rb @@ -68,8 +68,11 @@ describe ProcedureExportService do "communes (Code insee)", "communes (Département)", "departements", + "departements (Code)", "regions", + "regions (Code)", "pays", + "pays (Code)", "dossier_link", "piece_justificative", "rna", @@ -172,8 +175,11 @@ describe ProcedureExportService do "communes (Code insee)", "communes (Département)", "departements", + "departements (Code)", "regions", + "regions (Code)", "pays", + "pays (Code)", "dossier_link", "piece_justificative", "rna", @@ -259,8 +265,11 @@ describe ProcedureExportService do "communes (Code insee)", "communes (Département)", "departements", + "departements (Code)", "regions", + "regions (Code)", "pays", + "pays (Code)", "dossier_link", "piece_justificative", "rna",