deleted and disabled users excluded in applicable to and approver link fields

This commit is contained in:
Nabin Hait 2012-02-13 12:22:08 +05:30
parent b0fd0b3615
commit bf0d92e125

View File

@ -72,7 +72,7 @@ cur_frm.cscript.transaction = function(doc,cdt,cdn){
// System User Trigger
// -------------------
cur_frm.fields_dict['system_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
@ -86,7 +86,7 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) {
// Approving User Trigger
// -----------------------
cur_frm.fields_dict['approving_user'].get_query = function(doc) {
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
}
@ -106,4 +106,4 @@ cur_frm.fields_dict['master_name'].get_query = function(doc){
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) and `tabItem`.is_sales_item = "Yes" and tabItem.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` DESC LIMIT 50';
else
return 'SELECT `tabItem`.`name` FROM `tabItem` WHERE `tabItem`.`name` = "cheating done to avoid null" ORDER BY `tabItem`.`name` DESC LIMIT 50';
}
}