merge with staging

This commit is contained in:
Yan
2017-07-31 19:37:51 +06:30
7 changed files with 38 additions and 26 deletions

View File

@@ -96,7 +96,8 @@ class Crm::CustomersController < BaseCrmController
merchant_uid:merchant_uid,auth_token:auth_token}.to_json
# Check for paypar account exists
if paypar_account_no != nil || paypar_account_no != ''
# if paypar_account_no != nil || paypar_account_no != ''
if paypar_account_no.present?
member_params = { name: name,phone: phone,email: email,
dob: dob,address: address,nrc:nrc,card_no:card_no,
paypar_account_no: paypar_account_no,
@@ -153,8 +154,8 @@ class Crm::CustomersController < BaseCrmController
if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer cannot created.' + response["message"]}
else
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
format.html { redirect_to crm_customers_path, notice: 'Customer cannot created.' + response["message"] }
end
end
if params[:sale_id]
@@ -243,13 +244,14 @@ end
response = { status: false}
end
customer = Customer.find(@crm_customer.customer_id)
if response["status"] == true
customer = Customer.find(@crm_customer.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
else
customer = Customer.find(@crm_customer.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 )
@@ -303,11 +305,12 @@ end
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
format.json { render :show, status: :ok, location: @crm_customer }
else
customer = Customer.find(@crm_customer.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)
status = customer.update_attributes(membership_type:member_group_id )
end
format.html { redirect_to crm_customers_path, notice: response["message"] }
end