diff --git a/app/helpers/injection_helper.rb b/app/helpers/injection_helper.rb index 6432597632..032aee2cf7 100644 --- a/app/helpers/injection_helper.rb +++ b/app/helpers/injection_helper.rb @@ -5,6 +5,10 @@ module InjectionHelper inject_json_ams "enterprises", Enterprise.activated.includes(address: :state).all, Api::EnterpriseSerializer, enterprise_injection_data end + def inject_enterprise_and_relatives + inject_json_ams "enterprises", current_distributor.relatives_including_self.activated.includes(address: :state).all, Api::EnterpriseSerializer, enterprise_injection_data + end + def inject_shop_enterprises ocs = if current_order_cycle [current_order_cycle] diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index ef11c97e49..3802468ee9 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -231,8 +231,8 @@ class Enterprise < ActiveRecord::Base end def relatives_and_oc_producers(order_cycles) - enterprise_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id - Enterprise.relatives_of_one_union_others(id, enterprise_ids) + oc_producer_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id + Enterprise.relatives_of_one_union_others(id, oc_producer_ids) end def relatives_including_self diff --git a/app/views/checkout/edit.html.haml b/app/views/checkout/edit.html.haml index f0bef536db..b3d30ed442 100644 --- a/app/views/checkout/edit.html.haml +++ b/app/views/checkout/edit.html.haml @@ -1,7 +1,7 @@ - content_for(:title) do = t :checkout_title -= inject_enterprises += inject_enterprise_and_relatives .darkswarm.footer-pad - content_for :order_cycle_form do diff --git a/app/views/spree/orders/edit.html.haml b/app/views/spree/orders/edit.html.haml index 2fa5c043db..3417eb5e6a 100644 --- a/app/views/spree/orders/edit.html.haml +++ b/app/views/spree/orders/edit.html.haml @@ -1,7 +1,7 @@ - content_for(:title) do = t :orders_edit_title -= inject_enterprises += inject_enterprise_and_relatives .darkswarm - content_for :order_cycle_form do