Rushabh Mehta | b21eb9a | 2013-02-28 18:42:46 +0530 | [diff] [blame] | 1 | # For license information, please see license.txt |
| 2 | |
| 3 | from __future__ import unicode_literals |
| 4 | import webnotes |
| 5 | |
| 6 | @webnotes.whitelist() |
| 7 | def get_time_log_list(doctype, txt, searchfield, start, page_len, filters): |
Anand Doshi | 9e1d120 | 2013-05-09 19:34:34 +0530 | [diff] [blame] | 8 | return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"]) |
| 9 | |
| 10 | @webnotes.whitelist() |
| 11 | def query_task(doctype, txt, searchfield, start, page_len, filters): |
| 12 | search_string = "%%%s%%" % txt |
| 13 | order_by_string = "%s%%" % txt |
| 14 | return webnotes.conn.sql("""select name, subject from `tabTask` |
| 15 | where `%s` like %s or `subject` like %s |
| 16 | order by |
| 17 | case when `subject` like %s then 0 else 1 end, |
| 18 | case when `%s` like %s then 0 else 1 end, |
| 19 | `%s`, |
| 20 | subject |
| 21 | limit %s, %s""" % |
| 22 | (searchfield, "%s", "%s", "%s", searchfield, "%s", searchfield, "%s", "%s"), |
| 23 | (search_string, search_string, order_by_string, order_by_string, start, page_len)) |