app/controllers/spree/admin/orders_controller.rb in spree_backend-2.4.10 vs app/controllers/spree/admin/orders_controller.rb in spree_backend-3.0.0.rc1
- old
+ new
@@ -9,11 +9,10 @@
def index
params[:q] ||= {}
params[:q][:completed_at_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
@show_only_completed = params[:q][:completed_at_not_null] == '1'
params[:q][:s] ||= @show_only_completed ? 'completed_at desc' : 'created_at desc'
- params[:q][:completed_at_not_null] = '' unless @show_only_completed
# As date params are deleted if @show_only_completed, store
# the original date so we can restore them into the params
# after the search
created_at_gt = params[:q][:created_at_gt]
@@ -55,19 +54,19 @@
def edit
can_not_transition_without_customer_info
unless @order.completed?
- @order.refresh_shipment_rates
+ @order.refresh_shipment_rates(ShippingMethod::DISPLAY_ON_FRONT_AND_BACK_END)
end
end
def cart
unless @order.completed?
@order.refresh_shipment_rates
end
- if @order.shipped_shipments.count > 0
+ if @order.shipments.shipped.count > 0
redirect_to edit_admin_order_url(@order)
end
end
def update
@@ -101,11 +100,11 @@
flash[:success] = Spree.t(:order_approved)
redirect_to :back
end
def resend
- OrderMailer.confirm_email(@order.id, true).deliver
+ OrderMailer.confirm_email(@order.id, true).deliver_later
flash[:success] = Spree.t(:order_email_resent)
redirect_to :back
end
@@ -130,10 +129,10 @@
params[:created_by_id] = try_spree_current_user.try(:id)
params.permit(:created_by_id)
end
def load_order
- @order = Order.includes(:adjustments).find_by_number!(params[:id])
+ @order = Order.includes(:adjustments).friendly.find(params[:id])
authorize! action, @order
end
# Used for extensions which need to provide their own custom event links on the order details view.
def initialize_order_events