mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix state_id and country_id type bug
This commit is contained in:
@@ -1,4 +1,13 @@
|
||||
Darkswarm.factory 'CurrentOrder', (currentOrder) ->
|
||||
# Populate Currentorder.order from json in page. This is probably redundant now.
|
||||
new class CurrentOrder
|
||||
order: currentOrder
|
||||
constructor: ->
|
||||
if currentOrder.bill_address
|
||||
currentOrder.bill_address.state_id = currentOrder.bill_address.state_id + ''
|
||||
currentOrder.bill_address.country_id = currentOrder.bill_address.country_id + ''
|
||||
|
||||
if currentOrder.ship_address
|
||||
currentOrder.ship_address.state_id = currentOrder.ship_address.state_id + ''
|
||||
currentOrder.ship_address.country_id = currentOrder.ship_address.country_id + ''
|
||||
|
||||
@order = currentOrder
|
||||
|
||||
@@ -156,7 +156,7 @@ class CheckoutController < Spree::CheckoutController
|
||||
last_used_bill_address = lua.last_used_bill_address.andand.clone
|
||||
last_used_ship_address = lua.last_used_ship_address.andand.clone
|
||||
|
||||
preferred_bill_address, preferred_ship_address = spree_current_user.bill_address, spree_current_user.ship_address if spree_current_user.respond_to?(:bill_address) && spree_current_user.respond_to?(:ship_address)
|
||||
preferred_bill_address, preferred_ship_address = spree_current_user.bill_address, spree_current_user.ship_address
|
||||
@order.bill_address ||= preferred_bill_address || last_used_bill_address || Spree::Address.default
|
||||
@order.ship_address ||= preferred_ship_address || last_used_ship_address || Spree::Address.default
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user