fix(patch): escape illegal characters to avoid SQL syntax error (#17889)

This commit is contained in:
sahil28297
2019-06-10 17:38:42 +05:30
committed by Nabin Hait
parent cd2938e2d0
commit 4bc86c7e9d

View File

@@ -40,7 +40,7 @@ def execute():
# This is probably never used anywhere else as of now, but should be
values = []
for d in batch_transactions:
values.append("('{}', {})".format(d.parent, d.qty))
values.append("('{}', {})".format(frappe.db.escape(d.parent), d.qty))
conditions = ",".join(values)
frappe.db.sql("""
INSERT INTO `tab{}` (name, total_qty) VALUES {}