diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 1eba8c56..2fb61b1f 100644 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -67,13 +67,19 @@ class Api::OrdersController < Api::ApiController if booking if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved' if !booking.sale_id.nil? - check_order_with_booking(booking) + sale_status = check_order_with_booking(booking) + if sale_status + return false + end else @order.new_booking = false @order.booking_id = params[:booking_id] end else - check_order_with_table(params[:table_id]) + sale_status = check_order_with_table(params[:table_id]) + if sale_status + return false + end end end #booking exists else @@ -90,9 +96,11 @@ class Api::OrdersController < Api::ApiController if booking if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" @order.new_booking = true + return true else @order.new_booking = false @order.booking_id = booking.booking_id + return false end end end @@ -101,9 +109,11 @@ class Api::OrdersController < Api::ApiController def check_order_with_booking(booking) if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" @order.new_booking = true + return true else @order.new_booking = false @order.booking_id = params[:booking_id] + return false end end # Description