update customer
This commit is contained in:
@@ -82,7 +82,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
card_no = customer_params[:card_no]
|
||||
member_group_id = params[:member_group_id]
|
||||
|
||||
if !member_group_id.nil?
|
||||
if member_group_id.present?
|
||||
puts "aaaaaaaaa"
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
merchant_uid = memberaction.merchant_account_id.to_s
|
||||
@@ -101,6 +102,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
@@ -110,9 +112,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
rescue SocketError
|
||||
response = { status: false}
|
||||
end
|
||||
|
||||
if response["status"] == true
|
||||
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||
|
||||
@@ -125,11 +125,17 @@ class Crm::CustomersController < BaseCrmController
|
||||
else
|
||||
# @crm_customers.destroy
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. But '}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. But ' }
|
||||
end
|
||||
end
|
||||
else
|
||||
if params[:sale_id]
|
||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created. '}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created. ' }
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -183,6 +189,8 @@ end
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
puts "hhhhhhhhh"
|
||||
puts response.to_json
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false }
|
||||
|
||||
@@ -200,7 +208,7 @@ end
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
|
||||
else
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
format.html { redirect_to crm_customers_path, notice: response["error"] }
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user