From 0d504491dd9561dd68fe69b9b12d9bc3f001ef8b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 13 May 2013 15:15:20 +0530 Subject: [PATCH] [task] [query] added match conditions to task query --- projects/utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/utils.py b/projects/utils.py index 70f6995bf5..e37a21c2c4 100644 --- a/projects/utils.py +++ b/projects/utils.py @@ -9,15 +9,21 @@ def get_time_log_list(doctype, txt, searchfield, start, page_len, filters): @webnotes.whitelist() def query_task(doctype, txt, searchfield, start, page_len, filters): + from webnotes.widgets.reportview import build_match_conditions + search_string = "%%%s%%" % txt order_by_string = "%s%%" % txt + match_conditions = build_match_conditions("Task") + match_conditions = ("and" + match_conditions) if match_conditions else "" + return webnotes.conn.sql("""select name, subject from `tabTask` - where `%s` like %s or `subject` like %s + where (`%s` like %s or `subject` like %s) %s order by case when `subject` like %s then 0 else 1 end, case when `%s` like %s then 0 else 1 end, `%s`, subject limit %s, %s""" % - (searchfield, "%s", "%s", "%s", searchfield, "%s", searchfield, "%s", "%s"), + (searchfield, "%s", "%s", match_conditions, "%s", + searchfield, "%s", searchfield, "%s", "%s"), (search_string, search_string, order_by_string, order_by_string, start, page_len)) \ No newline at end of file