bind member for already register member

This commit is contained in:
Yan
2017-07-26 16:00:15 +06:30
parent 54d1fa68e6
commit e693b60945
5 changed files with 50 additions and 23 deletions

View File

@@ -128,8 +128,15 @@ class Crm::CustomersController < BaseCrmController
end
# format.json { render :index, status: :created, location: @crm_customers }
else
customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_type:member_group_id )
customer = Customer.find(@crm_customers.customer_id)
# Check membership id and bind to user
if response["membership_id"] != nil
status = customer.update_attributes(membership_id: response["membership_id"],membership_type:member_group_id )
else
status = customer.update_attributes(membership_type:member_group_id)
end
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' + response["message"]}
else