@ -239,7 +239,6 @@ def old_publish(vehicle, language):
@frappe . whitelist ( )
def update_mapping ( variant_mapping , doc ) :
# frappe.msgprint("call update mapping")
doc = frappe . get_doc ( " Publish " , doc )
current_db_name = frappe . conf . get ( " db_name " )
if doc . publish_documents :
@ -261,14 +260,12 @@ def update_mapping(variant_mapping, doc):
sm = frappe . get_doc ( " System Mapping " , system_map . name )
for sys_asset in sm . get ( ' systems_assets ' ) :
if sys_asset . systems == variant . system :
# frappe.msgprint("asset")
sys_asset . published = ' 1 '
frappe . db . sql ( """ update {0} .`tabSystem Mapping_System Assets` set published = ' 1 ' where parent = " {1} " and systems = " {2} " ; """ . format (
current_db_name , sm . name , variant . system ) )
frappe . db . commit ( )
for sm_item in sm . get ( " system_sub_systems " ) :
# frappe.msgprint("system")
if sm_item . systems == variant . system and sm_item . sub_systems == variant . sub_system and sm_item . procedure == variant . procedure_link :
sm_item . procedure_is_published = ' 1 '
frappe . db . sql ( """ update {0} .`tabSystem Mapping_Sub System` set procedure_is_published = ' 1 ' where parent = " {1} "
@ -280,22 +277,22 @@ def update_mapping(variant_mapping, doc):
@frappe . whitelist ( )
def get_vm_asset ( doc ) :
def get_vm_asset ( doc , lang ) :
doc = frappe . get_doc ( " Variant Mapping " , doc )
vm_assets = frappe . db . sql ( """ select category,language,attach_file,active_status from {0} .`tabVariant Mapping_Assets`
where parent = " {1} " and published = ' 0 ' ; """ .format(current_db_name, doc.name), as_dict=1)
where parent = " {1} " and language ' {2} ' and published = ' 0 ' ; """ .format(current_db_name, doc.name,lang ), as_dict=1)
return vm_assets
@frappe . whitelist ( )
def get_sm_asset ( doc , name ) :
system_map = frappe . db . sql ( """ select name from {0} .`tabSystem Mapping` where variant_mapping= " {1} " and name = " {2} " ; """ . format (
current_db_name , doc , name ) , as_dict = 1 )
def get_sm_asset ( doc , name , lang ) :
system_map = frappe . db . sql ( """ select name from {0} .`tabSystem Mapping` where variant_mapping= " {1} " and name = " {2} " and language = ' {3} ' ; """ . format (
current_db_name , doc , name , lang ) , as_dict = 1 )
if system_map :
for s in system_map :
doc = frappe . get_doc ( " System Mapping " , s . name )
system_asset = frappe . db . sql ( """ select systems,language,active_status,system_asset from {0} .`tabSystem Mapping_System Assets`
where parent = " {1} " and published = ' 0 ' ; """ .format(current_db_name, s.name), as_dict=1)
where parent = " {1} " and language = " {2} " and published = ' 0 ' ; """ .format(current_db_name, s.name,lang ), as_dict=1)
return system_asset
@ -305,7 +302,6 @@ def get_system(doc, name,lang):
current_db_name , doc , name , lang ) , as_dict = 1 )
if system_map :
for s in system_map :
frappe . msgprint ( str ( s . name ) )
doc = frappe . get_doc ( " System Mapping " , s . name )
system = frappe . db . sql ( """ select systems,sub_systems,active_status,symptom,component,estimate_time,rts,component,mat,
procedure_status , ` procedure ` from { 0 } . ` tabSystem Mapping_Sub System ` where parent = " {1} " and