fixed for customer
This commit is contained in:
@@ -39,5 +39,29 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
id = params[:sale_id][0,3]
|
||||
if(id == "SAL")
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
else
|
||||
@booking = BookingOrder.find_by_order_id(params[:sale_id])
|
||||
@orders = BookingOrder.where("booking_id = ? ", @booking.booking_id)
|
||||
|
||||
@orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
status = order.update_attributes(customer_id: params[:customer_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user