diff --git a/app/controllers/spree/admin/orders_controller.rb b/app/controllers/spree/admin/orders_controller.rb index 69e75fa0ef..4590f5c3d2 100644 --- a/app/controllers/spree/admin/orders_controller.rb +++ b/app/controllers/spree/admin/orders_controller.rb @@ -8,10 +8,10 @@ module Spree include OpenFoodNetwork::SpreeApiKeyLoader helper CheckoutHelper - before_action :load_order, only: [:edit, :update, :fire, :resend, :invoice, :print] + before_action :load_order, + only: [:edit, :update, :fire, :resend, :invoice, :print, :capture, :ship] before_action :load_distribution_choices, only: [:new, :create, :edit, :update] before_action :require_distributor_abn, only: :invoice - before_action :authorize_order, only: [:capture, :ship] def index orders = SearchOrders.new(search_params, spree_current_user).orders @@ -125,7 +125,6 @@ module Spree def ship @order.send_shipment_email = false unless params[:send_shipment_email] - @order.send_shipment_email if @order.ship if params[:current_page] != 'index' return redirect_back fallback_location: admin_orders_path @@ -263,11 +262,6 @@ module Spree authorize! action, @order end - def authorize_order - @order = Spree::Order.find_by(number: params[:id]) - authorize! :admin, @order - end - def set_param_for_controller redirect_back fallback_location: admin_orders_path params[:id] = @order.number diff --git a/app/models/spree/ability.rb b/app/models/spree/ability.rb index 3233e58c6d..034a4fa3a5 100644 --- a/app/models/spree/ability.rb +++ b/app/models/spree/ability.rb @@ -266,7 +266,8 @@ module Spree def add_order_management_abilities(user) can [:index, :create], Spree::Order - can [:read, :update, :fire, :resend, :invoice, :print], Spree::Order do |order| + can [:read, :update, :fire, :resend, :invoice, :print, :ship, :capture], + Spree::Order do |order| # We allow editing orders with a nil distributor as this state occurs # during the order creation process from the admin backend order.distributor.nil? ||