From c676d0d23d239392e72ba7a4eceebed483490cea Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Tue, 27 Dec 2016 14:50:36 +0100 Subject: [PATCH] Deprecate Spree::Order#has_step? The Spree::Order::Checkout module defines a `has_checkout_step?` method which does exactly the same, with a better name and a check for the `step` argument being `nil`. --- core/app/models/spree/order.rb | 7 +++---- frontend/app/views/spree/shared/_order_details.html.erb | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb index 2d58b60154b..1014af0e1e2 100644 --- a/core/app/models/spree/order.rb +++ b/core/app/models/spree/order.rb @@ -465,9 +465,8 @@ def empty! persist_totals end - def has_step?(step) - checkout_steps.include?(step) - end + alias_method :has_step?, :has_checkout_step? + deprecate has_step?: :has_checkout_step?, deprecator: Spree::Deprecation def state_changed(name) state = "#{name}_state" @@ -785,7 +784,7 @@ def require_email end def ensure_inventory_units - if has_step?("delivery") + if has_checkout_step?("delivery") inventory_validator = Spree::Stock::InventoryValidator.new errors = line_items.map { |line_item| inventory_validator.validate(line_item) }.compact diff --git a/frontend/app/views/spree/shared/_order_details.html.erb b/frontend/app/views/spree/shared/_order_details.html.erb index 5638a492254..3c814126d96 100644 --- a/frontend/app/views/spree/shared/_order_details.html.erb +++ b/frontend/app/views/spree/shared/_order_details.html.erb @@ -1,13 +1,13 @@
- <% if order.has_step?("address") %> + <% if order.has_checkout_step?("address") %>
<%= Spree.t(:billing_address) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:address) unless order.completed? %>
<%= render :partial => 'spree/shared/address', :locals => { :address => order.bill_address } %>
- <% if order.has_step?("delivery") %> + <% if order.has_checkout_step?("delivery") %>
<%= Spree.t(:shipping_address) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:address) unless order.completed? %>
<%= render :partial => 'spree/shared/address', :locals => { :address => order.ship_address } %> @@ -28,7 +28,7 @@ <% end %> <% end %> - <% if order.has_step?("payment") %> + <% if order.has_checkout_step?("payment") %>
<%= Spree.t(:payment_information) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:payment) unless order.completed? %>