2013-08-05 09:29:54 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2013-02-28 13:12:46 +00:00
|
|
|
# For license information, please see license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
import webnotes
|
|
|
|
|
|
|
|
@webnotes.whitelist()
|
|
|
|
def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
|
2013-05-09 14:04:34 +00:00
|
|
|
return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
|
|
|
|
|
|
|
|
@webnotes.whitelist()
|
|
|
|
def query_task(doctype, txt, searchfield, start, page_len, filters):
|
2013-05-13 09:45:20 +00:00
|
|
|
from webnotes.widgets.reportview import build_match_conditions
|
|
|
|
|
2013-05-09 14:04:34 +00:00
|
|
|
search_string = "%%%s%%" % txt
|
|
|
|
order_by_string = "%s%%" % txt
|
2013-05-13 09:45:20 +00:00
|
|
|
match_conditions = build_match_conditions("Task")
|
|
|
|
match_conditions = ("and" + match_conditions) if match_conditions else ""
|
|
|
|
|
2013-05-09 14:04:34 +00:00
|
|
|
return webnotes.conn.sql("""select name, subject from `tabTask`
|
2013-05-13 09:45:20 +00:00
|
|
|
where (`%s` like %s or `subject` like %s) %s
|
2013-05-09 14:04:34 +00:00
|
|
|
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""" %
|
2013-05-13 09:45:20 +00:00
|
|
|
(searchfield, "%s", "%s", match_conditions, "%s",
|
|
|
|
searchfield, "%s", searchfield, "%s", "%s"),
|
2013-05-09 14:04:34 +00:00
|
|
|
(search_string, search_string, order_by_string, order_by_string, start, page_len))
|