mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-02 02:11:33 +00:00
Extract method on_update that will be used elsewhere
This commit is contained in:
@@ -34,12 +34,7 @@ module Spree
|
||||
end
|
||||
|
||||
def update
|
||||
@order.recreate_all_fees!
|
||||
|
||||
unless @order.cart?
|
||||
@order.create_tax_charge!
|
||||
@order.update_order!
|
||||
end
|
||||
on_update
|
||||
|
||||
if params[:set_distribution_step] && @order.update(order_params)
|
||||
return redirect_to spree.admin_order_customer_path(@order)
|
||||
@@ -106,6 +101,15 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def on_update
|
||||
@order.recreate_all_fees!
|
||||
|
||||
unless @order.cart?
|
||||
@order.create_tax_charge!
|
||||
@order.update_order!
|
||||
end
|
||||
end
|
||||
|
||||
def order_params
|
||||
return params[:order] if params[:order].blank?
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ Spree::Core::Engine.routes.draw do
|
||||
get :invoice
|
||||
get :print
|
||||
get :distribution, to: 'orders#set_distribution'
|
||||
put :distribution, to: 'orders#set_distribution'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
||||
Reference in New Issue
Block a user