|
|
@@ -17,24 +17,20 @@ def get_contact_list(txt, page_length=20): |
|
|
|
if cached_contacts: |
|
|
|
return cached_contacts[:page_length] |
|
|
|
|
|
|
|
try: |
|
|
|
match_conditions = build_match_conditions("Contact") |
|
|
|
match_conditions = "and {0}".format(match_conditions) if match_conditions else "" |
|
|
|
|
|
|
|
out = frappe.db.sql( |
|
|
|
"""select email_id as value, |
|
|
|
concat(first_name, ifnull(concat(' ',last_name), '' )) as description |
|
|
|
from tabContact |
|
|
|
where name like %(txt)s or email_id like %(txt)s |
|
|
|
%(condition)s |
|
|
|
limit %(page_length)s""", |
|
|
|
{"txt": "%" + txt + "%", "condition": match_conditions, "page_length": page_length}, |
|
|
|
as_dict=True, |
|
|
|
) |
|
|
|
out = filter(None, out) |
|
|
|
|
|
|
|
except: |
|
|
|
raise |
|
|
|
match_conditions = build_match_conditions("Contact") |
|
|
|
match_conditions = "and {0}".format(match_conditions) if match_conditions else "" |
|
|
|
|
|
|
|
out = frappe.db.sql( |
|
|
|
"""select email_id as value, |
|
|
|
concat(first_name, ifnull(concat(' ',last_name), '' )) as description |
|
|
|
from tabContact |
|
|
|
where name like %(txt)s or email_id like %(txt)s |
|
|
|
%(condition)s |
|
|
|
limit %(page_length)s""", |
|
|
|
{"txt": "%" + txt + "%", "condition": match_conditions, "page_length": page_length}, |
|
|
|
as_dict=True, |
|
|
|
) |
|
|
|
out = filter(None, out) |
|
|
|
|
|
|
|
update_contact_cache(out) |
|
|
|
|
|
|
|