Browse Source

Publish version fix for float, Input validation message update

master
venkataakhil 1 year ago
parent
commit
26d8d6fdf7
  1. 11
      smart_service/apis/master_api.py
  2. 15
      smart_service/apis/publish_api.py
  3. 2
      smart_service/masters/doctype/app_labels/app_labels.js
  4. 2
      smart_service/masters/doctype/drive/drive.js
  5. 2
      smart_service/masters/doctype/fuel/fuel.js
  6. 2
      smart_service/masters/doctype/procedure_name/procedure_name.js
  7. 2
      smart_service/masters/doctype/service_kilometers/service_kilometers.js
  8. 2
      smart_service/masters/doctype/sub_systems/sub_systems.js
  9. 2
      smart_service/masters/doctype/systems/systems.js
  10. 2
      smart_service/masters/doctype/transmission/transmission.js
  11. 2
      smart_service/masters/doctype/variant/variant.js
  12. 2
      smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

11
smart_service/apis/master_api.py

@ -437,17 +437,20 @@ def change_file_dir():
def file_not_exists(): def file_not_exists():
file_data = frappe.db.sql(''' file_data = frappe.db.sql('''
select parent,step_name,file,name from tabProcedure_Details where content_type = 'File' order by parent; ;''', as_dict=1) select parent,step_name,file,name from tabProcedure_Details where content_type = 'File' order by parent;''', as_dict=1)
changed_file_list = [] changed_file_list = []
count = 1
for d in file_data: for d in file_data:
path = d['file'] path = d['file']
isExist = os.path.exists(base_path + path) is_exist = os.path.exists(base_path + path)
if not isExist: if not is_exist:
print(d) print(d)
d['id'] = count
changed_file_list.append(d) changed_file_list.append(d)
count += 1
file_path_not_exists = base_path + "/files/json_files/1.json" file_path_not_exists = base_path + "/files/json_files/1.json"
with open(file_path_not_exists, 'w') as outfile: with open(file_path_not_exists, 'w') as outfile:
@ -572,4 +575,4 @@ def change_single_star_data():
def get_single_star_data(): def get_single_star_data():
count = frappe.db.sql(''' count = frappe.db.sql('''
select count(*) from tabProcedure_Details where content like "%*%";''', as_dict=1) select count(*) from tabProcedure_Details where content like "%*%";''', as_dict=1)
print(count) print(count)

15
smart_service/apis/publish_api.py

@ -316,7 +316,7 @@ def new_publish(args, publish_type, vehicle, language, version):
# get_step_total_count(full_update_file_name) # get_step_total_count(full_update_file_name)
else: else:
pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,version,publish_type FROM tabPublish where vehicle = '{}' pub_ver = frappe.db.sql(''' SELECT vehicle,`language`,format(version,2) as version,publish_type FROM tabPublish where vehicle = '{}'
and publish_type = 'Global' AND `language` = '{}' order by version desc limit 2 ;'''.format(vehicle, language), as_dict=True) and publish_type = 'Global' AND `language` = '{}' order by version desc limit 2 ;'''.format(vehicle, language), as_dict=True)
if pub_ver: if pub_ver:
prev_update_ver = pub_ver[1]['version'] prev_update_ver = pub_ver[1]['version']
@ -324,11 +324,11 @@ def new_publish(args, publish_type, vehicle, language, version):
'%s-%s-full_v%s.json' % (vehicle, '%s-%s-full_v%s.json' % (vehicle,
language, prev_update_ver) language, prev_update_ver)
# test_full_update_file_name = '/home/ubuntu/frappe-bench/sites/guidedsmartservice.com/public/files/json_files/full_update/XUV 0613/XUV 0613-en-full_update.json' # test_full_update_file_name = '/home/ubuntu/frappe-bench/sites/guidedsmartservice.com/public/files/json_files/full_update/XUV 0613/XUV 0613-en-full_update.json'
file_flag, final_update_file = merge_json_files( # file_flag, final_update_file = merge_json_files(
prev_full_update_file, file_name, full_update_file_name) # prev_full_update_file, file_name, full_update_file_name)
# return prev_full_update_file, file_name, new_full_update_file_name # return prev_full_update_file, file_name, new_full_update_file_name
# file_flag, final_update_file = new_merge_json_files( file_flag, final_update_file = new_merge_json_files(
# prev_full_update_file, file_name, new_full_update_file_name) prev_full_update_file, file_name, full_update_file_name)
return file_flag, final_update_file return file_flag, final_update_file
return True, file_name.split('public')[1] return True, file_name.split('public')[1]
@ -355,7 +355,6 @@ def merge_json_files(old_json_path, new_json_path, out_file_path):
try: try:
with open(old_json_path, 'r') as json_file: with open(old_json_path, 'r') as json_file:
data_old = json.load(json_file) data_old = json.load(json_file)
# return data_old
with open(new_json_path, 'r') as json_file1: with open(new_json_path, 'r') as json_file1:
data_new = json.load(json_file1) data_new = json.load(json_file1)
@ -594,7 +593,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path):
variant_asset_added = set() variant_asset_added = set()
variant_asset_list = [] variant_asset_list = []
try: try:
# variant_new['Variant']['Assets']
for variant_asset in variant_new['Variant']['Assets']: for variant_asset in variant_new['Variant']['Assets']:
variant_asset_name.add(variant_asset['file']) variant_asset_name.add(variant_asset['file'])
if variant_asset['file'] not in variant_asset_added and variant_asset[ if variant_asset['file'] not in variant_asset_added and variant_asset[
@ -604,7 +602,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path):
except: except:
pass pass
try: try:
# variant_new['Variant']['Systems']
for system in variant_new['Variant']['Systems']: for system in variant_new['Variant']['Systems']:
system_asset_name = set() system_asset_name = set()
system_asset_added = set() system_asset_added = set()
@ -771,7 +768,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path):
if variant_old['Variant']['name'] in variant_name and variant_old['Variant']['name'] not in variant_added: if variant_old['Variant']['name'] in variant_name and variant_old['Variant']['name'] not in variant_added:
data_consolidated['JSON'].append({'Variant': variant_old['Variant'], data_consolidated['JSON'].append({'Variant': variant_old['Variant'],
}) })
return True, data_consolidated
json_object = json.dumps(data_consolidated) json_object = json.dumps(data_consolidated)
with open(out_file_path, "w") as outfile: with open(out_file_path, "w") as outfile:
outfile.write(json_object) outfile.write(json_object)
@ -779,7 +775,6 @@ def new_merge_json_files(old_json_path, new_json_path, out_file_path):
return True, out_file_path return True, out_file_path
except Exception as e: except Exception as e:
return False, frappe.get_traceback() return False, frappe.get_traceback()
# return "Exception in publish"
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)

2
smart_service/masters/doctype/app_labels/app_labels.js

@ -39,7 +39,7 @@ frappe.ui.form.on('App Labels', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/;
if (frm.doc.english_label) { if (frm.doc.english_label) {
if (regex.test(frm.doc.english_label) === true) { if (regex.test(frm.doc.english_label) === true) {
frappe.throw(__("<b>English Label :</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.throw(__("<b>English Label :</b> Only letters, numbers and <b> - , </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.english_label) { } else if (frm.doc.english_label) {
if (frm.doc.english_label.includes("'")) { if (frm.doc.english_label.includes("'")) {

2
smart_service/masters/doctype/drive/drive.js

@ -20,7 +20,7 @@ frappe.ui.form.on('Drive', {
} }
var regex = /[!@#$%^&*()_+\=\[\]{};'`~:"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};'`~:"\\|.<>\/?]+/;
if (regex.test(frm.doc.drive) === true) { if (regex.test(frm.doc.drive) === true) {
frappe.msgprint(__("<b>Variant:</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.msgprint(__("<b>Variant:</b> Only letters, numbers and <b> - , </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.drive) { } else if (frm.doc.drive) {
if (frm.doc.drive.includes("'")) { if (frm.doc.drive.includes("'")) {

2
smart_service/masters/doctype/fuel/fuel.js

@ -21,7 +21,7 @@ frappe.ui.form.on('Fuel', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/;
if (frm.doc.fuel) { if (frm.doc.fuel) {
if (regex.test(frm.doc.fuel) === true) { if (regex.test(frm.doc.fuel) === true) {
frappe.msgprint(__("<b>Fuel:</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.msgprint(__("<b>Fuel:</b> Only letters, numbers and <b> - ,</b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.fuel) { } else if (frm.doc.fuel) {
if (frm.doc.fuel.includes("'")) { if (frm.doc.fuel.includes("'")) {

2
smart_service/masters/doctype/procedure_name/procedure_name.js

@ -20,7 +20,7 @@ frappe.ui.form.on('Procedure Name', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/;
if (frm.doc.procedure_name) { if (frm.doc.procedure_name) {
if (regex.test(frm.doc.procedure_name) === true) { if (regex.test(frm.doc.procedure_name) === true) {
frappe.msgprint(__("<b>Procedure Name:</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.msgprint(__("<b>Procedure Name:</b> Only letters, numbers and <b> - , </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.procedure_name) { } else if (frm.doc.procedure_name) {
if (frm.doc.procedure_name.includes("'")) { if (frm.doc.procedure_name.includes("'")) {

2
smart_service/masters/doctype/service_kilometers/service_kilometers.js

@ -31,7 +31,7 @@ frappe.ui.form.on('Service Kilometers', {
var regex = /[!@#$%^&*()_+\=\[\]{};~`':"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};~`':"\\|.<>\/?]+/;
if (frm.doc.kilometer) { if (frm.doc.kilometer) {
if (regex.test(frm.doc.kilometer) === true) { if (regex.test(frm.doc.kilometer) === true) {
frappe.throw(__("<b>Service Kilometer:</b> Only letters, numbers and <b> / - , </b> are allowed.")); frappe.throw(__("<b>Service Kilometer:</b> Only letters, numbers and <b> - , </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if ((frm.doc.kilometer.includes("'"))) { } else if ((frm.doc.kilometer.includes("'"))) {
frappe.throw(__("<b>Service Kilometer:</b> Only letters, numbers and <b> ,</b> are allowed.")); frappe.throw(__("<b>Service Kilometer:</b> Only letters, numbers and <b> ,</b> are allowed."));

2
smart_service/masters/doctype/sub_systems/sub_systems.js

@ -17,7 +17,7 @@ frappe.ui.form.on('Sub Systems', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~:"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~:"\\|.<>\/?]+/;
if (frm.doc.sub_system_name) { if (frm.doc.sub_system_name) {
if (regex.test(frm.doc.sub_system_name) === true) { if (regex.test(frm.doc.sub_system_name) === true) {
frappe.msgprint(__("<b>Sub System Name:</b> Only letters, numbers and <b> -,'</b> are allowed.")); frappe.msgprint(__("<b>Sub System Name:</b> Only letters, numbers and <b> - , ' </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} }
} }

2
smart_service/masters/doctype/systems/systems.js

@ -47,7 +47,7 @@ frappe.ui.form.on('Systems', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~:"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~:"\\|.<>\/?]+/;
if (frm.doc.system_name) { if (frm.doc.system_name) {
if (regex.test(frm.doc.system_name) === true) { if (regex.test(frm.doc.system_name) === true) {
frappe.msgprint(__("<b>system Name:</b> Only letters, numbers and <b> -,'</b> are allowed.")); frappe.msgprint(__("<b>system Name:</b> Only letters, numbers and <b> - ,' </b> are allowed."));
frappe.validated = false; frappe.validated = false;
} }
} }

2
smart_service/masters/doctype/transmission/transmission.js

@ -21,7 +21,7 @@ frappe.ui.form.on('Transmission', {
var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};`~':"\\|.<>\/?]+/;
if (frm.doc.transmission) { if (frm.doc.transmission) {
if (regex.test(frm.doc.transmission) === true) { if (regex.test(frm.doc.transmission) === true) {
frappe.msgprint(__("<b>Transmission:</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.msgprint(__("<b>Transmission:</b> Only letters, numbers and <b> - ,</b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.transmission) { } else if (frm.doc.transmission) {
if (frm.doc.transmission.includes("'")) { if (frm.doc.transmission.includes("'")) {

2
smart_service/masters/doctype/variant/variant.js

@ -27,7 +27,7 @@ frappe.ui.form.on('Variant', {
var regex = /[!@#$%^&*()_+\=\[\]{};'`~:"\\|.<>\/?]+/; var regex = /[!@#$%^&*()_+\=\[\]{};'`~:"\\|.<>\/?]+/;
if(frm.doc.variant){ if(frm.doc.variant){
if (regex.test(frm.doc.variant) === true){ if (regex.test(frm.doc.variant) === true){
frappe.msgprint(__("<b>Variant:</b> Only letters, numbers and <b> -,</b> are allowed.")); frappe.msgprint(__("<b>Variant:</b> Only letters, numbers and <b> - ,</b> are allowed."));
frappe.validated = false; frappe.validated = false;
} else if(frm.doc.variant) { } else if(frm.doc.variant) {
if(frm.doc.variant.includes("'")) { if(frm.doc.variant.includes("'")) {

2
smart_service/masters/doctype/vehicle_segment/vehicle_segment.js

@ -58,7 +58,7 @@ frappe.ui.form.on('Vehicle Segment', {
var regex = /[!@#$%^&*()_+\-=\[\]{};'`~:"\\|,.<>\/?]+/; var regex = /[!@#$%^&*()_+\-=\[\]{};'`~:"\\|,.<>\/?]+/;
if (frm.doc.vehicle_segment) { if (frm.doc.vehicle_segment) {
if (regex.test(frm.doc.vehicle_segment) === true) { if (regex.test(frm.doc.vehicle_segment) === true) {
frappe.msgprint(__("<b>Vehicle Segment:</b> Only letters and numbers are allowed")); frappe.msgprint(__("<b>Vehicle Segment:</b> Only letters , numbers and <b> - , </b> are allowed"));
frappe.validated = false; frappe.validated = false;
} else if (frm.doc.vehicle_segment) { } else if (frm.doc.vehicle_segment) {
if (frm.doc.vehicle_segment.includes("'")) { if (frm.doc.vehicle_segment.includes("'")) {

Loading…
Cancel
Save