diff options
| author | Alban Peignier | 2018-03-15 12:54:55 +0100 |
|---|---|---|
| committer | Alban Peignier | 2018-03-15 13:08:52 +0100 |
| commit | 07e874419730ba492d91dd2506e78add28733020 (patch) | |
| tree | bf2723ca3f7de3fb5ded4c3bf772b194865270b3 | |
| parent | 410457e1c1cad57ed2109fe8de9d1dc1eecf353f (diff) | |
| download | chouette-core-07e874419730ba492d91dd2506e78add28733020.tar.bz2 | |
Ignore undefined CustomFields in extra headers for VehicleJourneysController. Refs #6143
| -rw-r--r-- | app/controllers/vehicle_journeys_controller.rb | 4 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/index.html.slim | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index 14795227c..e532712d2 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -155,6 +155,10 @@ class VehicleJourneysController < ChouetteController private def load_custom_fields @custom_fields = referential.workgroup&.custom_fields_definitions || {} + + @extra_headers = Rails.application.config.vehicle_journeys_extra_headers.dup.delete_if do |header| + header[:type] == :custom_field and not @custom_fields.has_key?(header[:name].to_s) + end end def map_stop_points points diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim index 5606bc055..d23c61394 100644 --- a/app/views/vehicle_journeys/index.html.slim +++ b/app/views/vehicle_journeys/index.html.slim @@ -29,7 +29,7 @@ | window.features = #{raw @features}; | window.all_missions = #{(@all_missions.to_json).html_safe}; | window.custom_fields = #{(@custom_fields.to_json).html_safe}; - | window.extra_headers = #{Rails.application.config.vehicle_journeys_extra_headers.to_json.html_safe}; + | window.extra_headers = #{(@extra_headers.to_json).html_safe}; // | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe}; - if has_feature?(:vehicle_journeys_return_route) |
