diff --git a/backend/app/views/spree/admin/orders/customer_details/_form.html.erb b/backend/app/views/spree/admin/orders/customer_details/_form.html.erb index de9b9735c8f..842f0a4a912 100644 --- a/backend/app/views/spree/admin/orders/customer_details/_form.html.erb +++ b/backend/app/views/spree/admin/orders/customer_details/_form.html.erb @@ -44,7 +44,7 @@ <% if Spree::Config[:order_bill_address_used] %>
- <%= check_box_tag 'order[use_billing]', '1', ((@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address == @order.ship_address) %> + <%= check_box_tag 'order[use_billing]', '1', (@order.ship_address.new_record? && @order.bill_address == @order.ship_address) %> <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
diff --git a/backend/spec/features/admin/orders/new_order_spec.rb b/backend/spec/features/admin/orders/new_order_spec.rb index f2c6a3806b8..d6a904592e0 100644 --- a/backend/spec/features/admin/orders/new_order_spec.rb +++ b/backend/spec/features/admin/orders/new_order_spec.rb @@ -35,7 +35,7 @@ targetted_select2_search user.email, from: "#s2id_customer_search" end - check "order_use_billing" + expect(page).to have_checked_field('order_use_billing') fill_in_address click_on "Update" @@ -73,7 +73,7 @@ targetted_select2_search user.email, from: "#s2id_customer_search" end - check "order_use_billing" + expect(page).to have_checked_field('order_use_billing') fill_in_address click_on "Update" @@ -108,7 +108,7 @@ targetted_select2_search user.email, from: "#s2id_customer_search" end - check "order_use_billing" + expect(page).to have_checked_field('order_use_billing') fill_in_address click_on "Update" @@ -157,7 +157,7 @@ targetted_select2_search user.email, from: "#s2id_customer_search" end - check "order_use_billing" + expect(page).to have_checked_field('order_use_billing') fill_in_address click_on "Update" diff --git a/core/app/models/spree/address.rb b/core/app/models/spree/address.rb index e7f990023b6..6e4890039a6 100644 --- a/core/app/models/spree/address.rb +++ b/core/app/models/spree/address.rb @@ -106,19 +106,28 @@ def ==(other_address) end def same_as?(other_address) - Spree::Deprecation.warn("Address.same_as? is deprecated. It's equivalent to Address.==", caller) + Spree::Deprecation.warn("Address#same_as? is deprecated. It's equivalent to Address.==", caller) self == other_address end def same_as(other_address) - Spree::Deprecation.warn("Address.same_as is deprecated. It's equivalent to Address.==", caller) + Spree::Deprecation.warn("Address#same_as is deprecated. It's equivalent to Address.==", caller) self == other_address end + # @deprecated Do not use this def empty? + Spree::Deprecation.warn("Address#empty? is deprecated.", caller) attributes.except('id', 'created_at', 'updated_at', 'country_id').all? { |_, v| v.nil? } end + # This exists because the default Object#blank?, checks empty? if it is + # defined, and we have defined empty. + # This should be removed once empty? is removed + def blank? + false + end + # @return [Hash] an ActiveMerchant compatible address hash def active_merchant_hash {