mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
No longer copying old ship address from pickup, adding phone to custom shipping address
This commit is contained in:
@@ -45,7 +45,7 @@ Spree::CheckoutController.class_eval do
|
||||
past = Spree::Order.order("id desc").where(:email => email).where("state != 'cart'").limit(8)
|
||||
if order = past.detect(&:bill_address)
|
||||
bill_address = order.bill_address.clone if order.bill_address
|
||||
ship_address = order.ship_address.clone if order.ship_address
|
||||
ship_address = order.ship_address.clone if order.ship_address if order.shipping_method.require_ship_address
|
||||
end
|
||||
|
||||
[bill_address, ship_address]
|
||||
|
||||
@@ -106,6 +106,9 @@
|
||||
= sa.text_field :firstname
|
||||
.large-6.columns
|
||||
= sa.text_field :lastname
|
||||
.row
|
||||
.large-6.columns
|
||||
= sa.text_field :phone
|
||||
|
||||
#ship_address_hidden{"ng-show" => "order.ship_address_same_as_billing"}
|
||||
= sa.hidden_field :address1, "ng-value" => "order.bill_address.address1",
|
||||
|
||||
@@ -37,6 +37,14 @@ describe Shop::CheckoutController do
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it "doesn't copy the previous shipping address from a pickup order" do
|
||||
old_order = create(:order, bill_address: create(:address), ship_address: create(:address))
|
||||
old_order.shipping_method.should_receive(:require_ship_address).and_return(false)
|
||||
Spree::Order.stub_chain(:order, :where, :where, :limit, :detect).and_return(old_order)
|
||||
|
||||
controller.send(:find_last_used_addresses, "email").last.should == nil
|
||||
end
|
||||
|
||||
describe "building the order" do
|
||||
before do
|
||||
controller.stub(:current_distributor).and_return(distributor)
|
||||
|
||||
Reference in New Issue
Block a user