Add customer_details_controller from spree_backend so that we can now merge it with the OFN's decorator

This commit is contained in:
luisramos0
2019-11-27 21:47:10 +00:00
parent 70147f908a
commit 51bca7ce2f

View File

@@ -0,0 +1,43 @@
module Spree
module Admin
module Orders
class CustomerDetailsController < Spree::Admin::BaseController
before_filter :load_order
def show
edit
render :action => :edit
end
def edit
country_id = Address.default.country.id
@order.build_bill_address(:country_id => country_id) if @order.bill_address.nil?
@order.build_ship_address(:country_id => country_id) if @order.ship_address.nil?
end
def update
if @order.update_attributes(params[:order])
if params[:guest_checkout] == "false"
@order.associate_user!(Spree.user_class.find_by_email(@order.email))
end
while @order.next; end
@order.shipments.map &:refresh_rates
flash[:success] = Spree.t('customer_details_updated')
redirect_to admin_order_customer_path(@order)
else
render :action => :edit
end
end
private
def load_order
@order = Order.find_by_number!(params[:order_id], :include => :adjustments)
end
end
end
end
end