Merge pull request #782 from frappe/mergify/bp/main-hotfix/pr-781
fix: international call log issue (backport #781)
This commit is contained in:
commit
2ea03cfbbf
@ -110,12 +110,12 @@ def get_contact_by_phone_number(phone_number):
|
|||||||
number = parse_phone_number(phone_number)
|
number = parse_phone_number(phone_number)
|
||||||
|
|
||||||
if number.get("is_valid"):
|
if number.get("is_valid"):
|
||||||
return get_contact(number.get("national_number"))
|
return get_contact(number.get("national_number"), number.get("country"))
|
||||||
else:
|
else:
|
||||||
return get_contact(phone_number, exact_match=True)
|
return get_contact(phone_number, number.get("country"), exact_match=True)
|
||||||
|
|
||||||
|
|
||||||
def get_contact(phone_number, exact_match=False):
|
def get_contact(phone_number, country="IN", exact_match=False):
|
||||||
if not phone_number:
|
if not phone_number:
|
||||||
return {"mobile_no": phone_number}
|
return {"mobile_no": phone_number}
|
||||||
|
|
||||||
@ -149,11 +149,11 @@ def get_contact(phone_number, exact_match=False):
|
|||||||
deal = frappe.db.get_value(
|
deal = frappe.db.get_value(
|
||||||
"CRM Contacts", {"contact": contact.name, "is_primary": 1}, "parent"
|
"CRM Contacts", {"contact": contact.name, "is_primary": 1}, "parent"
|
||||||
)
|
)
|
||||||
if are_same_phone_number(contact.mobile_no, phone_number, validate=not exact_match):
|
if are_same_phone_number(contact.mobile_no, phone_number, country, validate=not exact_match):
|
||||||
contact["deal"] = deal
|
contact["deal"] = deal
|
||||||
return contact
|
return contact
|
||||||
# Else, return the first contact
|
# Else, return the first contact
|
||||||
if are_same_phone_number(contacts[0].mobile_no, phone_number, validate=not exact_match):
|
if are_same_phone_number(contacts[0].mobile_no, phone_number, country, validate=not exact_match):
|
||||||
return contacts[0]
|
return contacts[0]
|
||||||
|
|
||||||
# Else, Check if the number is associated with a lead
|
# Else, Check if the number is associated with a lead
|
||||||
@ -173,7 +173,7 @@ def get_contact(phone_number, exact_match=False):
|
|||||||
|
|
||||||
if len(leads):
|
if len(leads):
|
||||||
for lead in leads:
|
for lead in leads:
|
||||||
if are_same_phone_number(lead.mobile_no, phone_number, validate=not exact_match):
|
if are_same_phone_number(lead.mobile_no, phone_number, country, validate=not exact_match):
|
||||||
lead["lead"] = lead.name
|
lead["lead"] = lead.name
|
||||||
lead["full_name"] = lead.lead_name
|
lead["full_name"] = lead.lead_name
|
||||||
return lead
|
return lead
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user