bfc195dd8b
* Remove quotes from sql to make it compatible with postgres as well * Fix queries - Replace mysql specifc queries with standard ones * Make repo URL chages to test pg-poc * Add root passowrd to test site config * Fix quotes issue * Remove debug flag from a pricing rule query * Remove python 3.6 version from travis.yml * Fix improper query issue * Fix incorrect query * Fix a query - This fix need to be changed when we will start supporting postgres since date_format is not supported by postgres * Get price list map as dict * Convert price_list_currency_map to dict
29 lines
1013 B
Python
29 lines
1013 B
Python
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
# For license information, please see license.txt
|
|
|
|
from __future__ import unicode_literals
|
|
import frappe
|
|
|
|
@frappe.whitelist()
|
|
def query_task(doctype, txt, searchfield, start, page_len, filters):
|
|
from frappe.desk.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 frappe.db.sql("""select name, subject from `tabTask`
|
|
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", match_conditions, "%s",
|
|
searchfield, "%s", searchfield, "%s", "%s"),
|
|
(search_string, search_string, order_by_string, order_by_string, start, page_len))
|