mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
When suppress_error_msg is present do no validate order and redirect
- When creating a new order, it's not necessary to display the "Line items can't be blank" as the order has just been created and the user is rightly doing configuration about line items
This commit is contained in:
@@ -38,11 +38,12 @@ module Spree
|
||||
@order.recreate_all_fees!
|
||||
|
||||
unless order_params.present? && @order.update(order_params) && @order.line_items.present?
|
||||
if @order.line_items.empty?
|
||||
if @order.line_items.empty? && !params[:suppress_error_msg]
|
||||
@order.errors.add(:line_items, Spree.t('errors.messages.blank'))
|
||||
end
|
||||
return redirect_to(spree.edit_admin_order_path(@order),
|
||||
flash: { error: @order.errors.full_messages.join(', ') })
|
||||
|
||||
flash[:error] = @order.errors.full_messages.join(', ') if @order.errors.present?
|
||||
return redirect_to spree.edit_admin_order_path(@order)
|
||||
end
|
||||
|
||||
if @order.complete?
|
||||
|
||||
Reference in New Issue
Block a user