Browse Source

Allow special character %

master
venkataakhil 2 years ago
parent
commit
ce81ec93ff
  1. 1
      smart_service/apis/master_api.py
  2. 5
      smart_service/apis/publish_api.py
  3. 2
      smart_service/transactions/doctype/procedure/procedure.js
  4. 10
      smart_service/transactions/doctype/procedure/procedure.py

1
smart_service/apis/master_api.py

@ -445,6 +445,7 @@ def file_not_exists():
isExist = os.path.exists(base_path + path)
if not isExist:
print(d)
changed_file_list.append(d)
file_path_not_exists = base_path + "/files/json_files/1.json"

5
smart_service/apis/publish_api.py

@ -35,6 +35,7 @@ def custom_rate_limit(limit, seconds):
return "You hit the rate limit because of too many requests. Please try after sometime."
return 1
def get_parent_map(input_list, parameter):
parentChildMap = {}
for b in input_list:
@ -203,14 +204,14 @@ def json_grouping(args, language):
for k in docs_child:
if k['variant_mapping'] == d and k['system'] == i and k['sub_system'] == j:
# proc_details = frappe.db.sql('''select procedure_name, step_name, content_type, GROUP_CONCAT(case when content_type='Link' Then system_id else content end) as content,
# GROUP_CONCAT(file) as file,GROUP_CONCAT(DISTINCT idx order by idx) as display_order, idx from {}.tabProcedure_Details
# GROUP_CONCAT(file) as file,GROUP_CONCAT(DISTINCT idx order by idx) as display_order, idx from {}.tabProcedure_Details
# where parent ='{}' group by procedure_name,step_name,content_type,content order by idx asc; '''.format(
# current_db_name, k['procedure_link']), as_dict=True)
proc_details = frappe.db.sql('''select procedure_name, step_name, content_type, content,
file,idx as display_order,idx from {}.tabProcedure_Details
where parent ='{}' order by idx asc; '''.format(current_db_name, k['procedure_link']), as_dict=True)
proc_data = get_parent_map(
proc_details, 'procedure_name')
total_count += len(proc_data)

2
smart_service/transactions/doctype/procedure/procedure.js

@ -36,7 +36,7 @@ frappe.ui.form.on('Procedure', {
},
validate: function (frm) {
// var regex = /[@#$%^*\\[\]{}`~\\|\?]/;
var regex = /[@#$%^\\[\]{}`\\|\?]/;
var regex = /[@#$^\\[\]{}`\\|\?]/;
if (frm.doc.procedure_details) {
for (var i = 0; i < frm.doc.procedure_details.length; i++) {
if (regex.test(frm.doc.procedure_details[i].content) === true) {

10
smart_service/transactions/doctype/procedure/procedure.py

@ -14,9 +14,7 @@ class Procedure(Document):
if self.procedure_details:
for x in self.get("procedure_details"):
if x.content:
# try:
# title = x.content.encode('cp1252').decode('UTF-8')
# frappe.msgprint(str(x.as_dict())+":" +str(title))
res_str = re.sub("–", "", x.content)
res_str = re.sub("—", "", res_str)
res_str = re.sub("‘", "", res_str)
@ -24,12 +22,8 @@ class Procedure(Document):
res_str = re.sub("“", "", res_str)
res_str = re.sub("”", "", res_str)
res_str = re.sub("Â", "", res_str)
x.content = res_str
# frappe.msgprint(str(title))
# except Exception as e:
# frappe.log_error("validate encoding",frappe.get_traceback())
if x.content_type == "File":
if not x.file:
frappe.throw("Please choose the file in row no " + str(x.idx))

Loading…
Cancel
Save