Fixes in link field queries

This commit is contained in:
Nabin Hait 2014-04-30 20:30:33 +05:30
parent b85a9108eb
commit 613919325d

View File

@ -37,7 +37,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", employee_name), locate("%(_txt)s", item_name), 99999),
if(locate("%(_txt)s", employee_name), locate("%(_txt)s", employee_name), 99999),
name, employee_name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
@ -54,8 +54,8 @@ def lead_query(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", lead_name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", company_name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", lead_name), locate("%(_txt)s", lead_name), 99999),
if(locate("%(_txt)s", company_name), locate("%(_txt)s", company_name), 99999),
name, lead_name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'_txt': txt.replace("%", ""),
@ -79,7 +79,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", customer_name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", customer_name), locate("%(_txt)s", customer_name), 99999),
name, customer_name
limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, '_txt': txt.replace("%", ""),
@ -102,7 +102,7 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by
if(locate("%(_txt)s", name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", supplier_name), locate("%(_txt)s", name), 99999),
if(locate("%(_txt)s", supplier_name), locate("%(_txt)s", supplier_name), 99999),
name, supplier_name
limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, '_txt': txt.replace("%", ""),