mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-03 02:21:33 +00:00
Remove order cycles feature toggle
This commit is contained in:
@@ -67,10 +67,6 @@ module OrderCyclesHelper
|
||||
@order_cycles_simple_form ||= @order_cycle.coordinator.sells == 'own'
|
||||
end
|
||||
|
||||
def order_cycles_enabled?
|
||||
OpenFoodNetwork::FeatureToggle.enabled? :order_cycles
|
||||
end
|
||||
|
||||
def pickup_time(order_cycle = current_order_cycle)
|
||||
order_cycle.exchanges.to_enterprises(current_distributor).outgoing.first.pickup_time
|
||||
end
|
||||
|
||||
@@ -74,11 +74,7 @@ Spree::Order.class_eval do
|
||||
# -- Methods
|
||||
def products_available_from_new_distribution
|
||||
# Check that the line_items in the current order are available from a newly selected distribution
|
||||
if OpenFoodNetwork::FeatureToggle.enabled? :order_cycles
|
||||
errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle)
|
||||
else
|
||||
errors.add(:distributor_id, "cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distributor?(distributor)
|
||||
end
|
||||
errors.add(:base, "Distributor or order cycle cannot supply the products in your cart") unless DistributionChangeValidator.new(self).can_change_to_distribution?(distributor, order_cycle)
|
||||
end
|
||||
|
||||
def empty_with_clear_shipping_and_payments!
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- elsif !distributor_available_for?(order, @product)
|
||||
= render 'add_to_cart_distributor_unavailable'
|
||||
|
||||
- elsif !order_cycle_available_for?(order, @product) and order_cycles_enabled?
|
||||
- elsif !order_cycle_available_for?(order, @product)
|
||||
= render 'add_to_cart_order_cycle_unavailable'
|
||||
|
||||
- else
|
||||
|
||||
@@ -7,7 +7,7 @@ module OpenFoodNetwork
|
||||
private
|
||||
|
||||
def self.features
|
||||
{order_cycles: true}
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -437,7 +437,7 @@ describe Spree::Order do
|
||||
|
||||
subject.distributor = test_enterprise
|
||||
subject.should_not be_valid
|
||||
subject.errors.messages.should == {:distributor_id => ["cannot supply the products in your cart"]}
|
||||
subject.errors.messages.should == {:base => ["Distributor or order cycle cannot supply the products in your cart"]}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user