Skip to content

Commit

Permalink
refactor: Removed frappe.db.escape from generated queries (#68)
Browse files Browse the repository at this point in the history
* refactor: Removed frappe.db.escape from generated queries
  • Loading branch information
Aradhya-Tripathi authored Jan 28, 2022
1 parent 1cdaf15 commit cce2f1c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions healthcare/controllers/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
@frappe.validate_and_sanitize_search_inputs
def get_healthcare_service_units(doctype, txt, searchfield, start, page_len, filters):
table = frappe.qb.DocType("Healthcare Service Unit")
query = frappe.qb.from_(table).where(table.is_group == 0) \
.where(table.company == frappe.db.escape(filters.get('company'))) \
.where(table.name.like(frappe.db.escape('%{0}%'.format(txt)))).get_sql()
query = (
frappe.qb.from_(table)
.where(table.is_group == 0)
.where(table.company == filters.get("company"))
.where(table.name.like("%{0}%".format(txt)))
.select("name")
.get_sql()
)

if filters and filters.get('inpatient_record'):
from healthcare.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
Expand Down

0 comments on commit cce2f1c

Please sign in to comment.