您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

32 行
1.0 KiB

  1. # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
  2. # License: GNU General Public License v3. See license.txt
  3. # For license information, please see license.txt
  4. import frappe
  5. @frappe.whitelist()
  6. @frappe.validate_and_sanitize_search_inputs
  7. def query_task(doctype, txt, searchfield, start, page_len, filters):
  8. from frappe.desk.reportview import build_match_conditions
  9. search_string = "%%%s%%" % txt
  10. order_by_string = "%s%%" % txt
  11. match_conditions = build_match_conditions("Task")
  12. match_conditions = ("and" + match_conditions) if match_conditions else ""
  13. return frappe.db.sql(
  14. """select name, subject from `tabTask`
  15. where (`%s` like %s or `subject` like %s) %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 offset %s"""
  22. % (searchfield, "%s", "%s", match_conditions, "%s", searchfield, "%s", searchfield, "%s", "%s"),
  23. (search_string, search_string, order_by_string, order_by_string, page_len, start),
  24. )