fixed for customer

This commit is contained in:
Yan
2017-06-22 15:01:13 +06:30
19 changed files with 205 additions and 143 deletions

View File

@@ -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