diff --git a/smart_service/apis/master_api.py b/smart_service/apis/master_api.py index 100e326..3f3c6ce 100644 --- a/smart_service/apis/master_api.py +++ b/smart_service/apis/master_api.py @@ -311,3 +311,35 @@ def change_file_type(): os.rename(f1, f2) return count + + +def change_procedure_ext(): + try: + frappe.db.sql(''' + update tabProcedure_Details set file = concat(substring(file,1,length(file)-3),lower(substring(file,length(file)-2))) + where substring(file,length(file)-2) REGEXP BINARY '[A-Z]'; + ''') + frappe.db.commit() + return True + except: + return False + + +def change_file_ext(): + try: + """ File URL Change """ + frappe.db.sql(''' + update tabFile set file_url = concat(substring(file_url,1,length(file_url)-3),lower(substring(file_url,length(file_url)-2))) + where substring(file_url,length(file_url)-2) REGEXP BINARY '[A-Z]'; + ''') + frappe.db.commit() + + """ File Name """ + frappe.db.sql(''' + update _a9b9faaf89312ce4.tabFile set file_name = concat(substring(file_name,1,length(file_name)-3),lower(substring(file_name,length(file_name)-2))) + where substring(file_name,length(file_name)-2) REGEXP BINARY '[A-Z]'; + ''') + frappe.db.commit() + except: + return False + return True