//** DESCRIPTION: //** This routine will go through the WEBUSER, USEROPTS, and assciated files to do preliminary //** edit checks and to return valuable information on the USER. //** Error results will be given but no messages will be displayed, the Application needs to show the Error Messages and //** in the case of the FATAL Error stop processing all together! The FATAlError field is passed in the call back function. //** The authenticate routine uses a split command to gather passed values, when calling authenticate send it in a //** string field in this format "variable1Name='Value'|variable2Name='Value'". Use the pipe '|' as a value seperator. //** For example: authenticate("frameNm='AUTH'|funcNm='editUser()'") //** //** ARGUMENTS: 4 Arguments 1 required 3 optional //** 1) (required) frameNm = the hidden frame all the DME calls will be directed //** 2) (optional) func = the function name to be called on the return. (default -> "startApp(FATALError)") //** 3) (optional) desiredEdit = the associated field to do extended edits. (default -> "user.type") //** valid entries for desiredEdit are: 'VN' (Vendor), //** 'EM' (Employee), //** 'CU' (Customer), //** 'BU' (Buyer), //** 'RQ' (Requester), //** 'AP' (Approver) //** 4) (optional) hostNm = the Host Name //** Look at the office programs in $WEBDIR/lawson/office for some extensive examples. //** This is the user Object and the initial values: function userInformation(frameNm,func) { this.frameNm = frameNm //** (Passed) the Hidden frame the DME calls use this.func = func //** (Passed) the function name to call on the return, startApp() is called if '' is passed //** A parameter representing the FATALError flag will be added to the end of the function call, either a true or false this.webuser = null //** These fields are the WEBUSER file this.status = null this.type = null this.type_name = null this.email = null this.login = null this.prodline = null this.access = false this.company = null //** These fields are the association information off the WEBUSER file this.employee = null //** Edits are done from these key fields this.is_super = false this.requester = null this.approve_cd = null this.cust_group = null this.customer = null this.vendor_group = null this.vendor = null this.buyer_code = null this.prospect = null this.partner = null this.ErrorMsg = null //** This contains the Error Message this.FATALError = false //** The causes for a Fatal Error are: //** 1) Webuser record does not exist //** 2) Webuser record has been inactivated this.editError = false //** The causes for a Non-Fatal Error are: //** 1) When Webuser type key fields are left blank //** 2) When "Desired" edit key fields are left blank //** 3) When a validity error occurs with "Desired" edit. i.e. Employee Number is not on Employee File this.editDone = null //** Stores what edit was done so if authenticate is called again edit checks wil not occur again. this.name = null //** Name according to "Desired" edit this.locale = null //** These fields represent a users locale (language). this.language = null this.date_format = null this.time_format = null this.currency = null this.gif_text = null //** These fields are from the USEROPTS file this.font_color = '000000' this.cell_color = 'ffffff' this.bg_color = '000000' this.font_size = '3' this.font_type = null this.style = '' this.alwaysIcons = false this.alwaysText = false this.do_stats = false //** These fields are from the USEROPTS file at a Global Level this.note = '' this.logout_tmr = 3 this.styleIcons = null //** These are a result of the users style from the USEROPTS file this.styleButtons = null //** If a style is specified then we go into the desired style directory and this.nbrOfIcons = 0 //** all the Icon and Button information. (Used in conjunction with button.js) this.nbrOfButtons = 0 } //** Function to call when creating an Authenticate Object: //** authenticate('Parameter String') //** Will use a call back function to continue processing host=null authUser=null editThis=null quickEdit=false function authenticate(param) { var frameNm = '' var funcNm = '' var desiredEdit = '' var hostNm = '' var paramLst = param.split('|') var NbrParams = paramLst.length for (var i=0;i 0) { var dmeCall = new DMEObject(authUser.prodline,"requester") if (host) dmeCall.host=host dmeCall.out = "JAVASCRIPT" dmeCall.index = "reqset2" dmeCall.field = "name" dmeCall.key = escape(authUser.requester) dmeCall.func = "validateAuthData(true)" dmeCall.exclude = "DRILL;KEYS;SORTS" DME(dmeCall,authUser.frameNm) } else validateAuthData(false) } function GetAuthApprover() { if ((authUser.approve_cd == null || authUser.approve_cd.length < 1) || (authUser.company == null || authUser.company.length < 1)) { var dmeCall = new DMEObject(authUser.prodline,"rqappcode") if (host) dmeCall.host=host dmeCall.out = "JAVASCRIPT" dmeCall.field = "description" dmeCall.key = parseInt(authUser.company) + "=" + escape(authUser.approve_cd) dmeCall.func = "validateAuthData(true)" dmeCall.exclude = "DRILL;KEYS;SORTS" DME(dmeCall,authUser.frameNm) } else validateAuthData(false) } function validateAuthData(associationMade) { if (!associationMade) { authUser.ErrorMsg = "Warning: An association to a " + editThis + " needs to be made on your Webuser record.\nPlease contact your Administrator." authUser.editError = true } else if (typeof eval('window.' + authUser.frameNm + '.NbrRecs') == "number") { if (eval('window.' + authUser.frameNm + '.NbrRecs == 0') && (authUser.type != "AD" || user.type != "FN")) { authUser.ErrorMsg = "Warning: " + editThis + " record does not exist for web user.\nPlease contact your Administrator." authUser.editError = true } } if (authUser.editError) authUser.name = '** ERROR **' else { if (editThis == "EM") { if (eval('window.' + authUser.frameNm + '.record[0].nick_name != " "')) authUser.name = eval('window.' + authUser.frameNm + '.record[0].nick_name') else authUser.name = eval('window.' + authUser.frameNm + '.record[0].first_name') authUser.name += " " + eval('window.' + authUser.frameNm + '.record[0].last_name') authUser.is_super = eval('window.' + authUser.frameNm + '.is_supervisor[0][0]') authUser.editDone = "EM" } if (editThis == "VN") { authUser.name = eval('window.' + authUser.frameNm + '.record[0].vendor_vname') authUser.editDone = "VN" } if (editThis == "CU") { authUser.name = eval('window.' + authUser.frameNm + '.record[0].customerdesc_name') authUser.editDone = "CU" } if (editThis == "BU") { authUser.name = eval('window.' + authUser.frameNm + '.record[0].name') authUser.editDone = "BU" } if (editThis == "RQ") { authUser.name = eval('window.' + authUser.frameNm + '.record[0].name') authUser.editDone = "RQ" } if (editThis == "AP") { authUser.name = eval('window.' + authUser.frameNm + '.record[0].description') authUser.editDone = "AP" } if (editThis == "FN") { authUser.name = "Finance" authUser.editDone = "FN" } if (editThis == "AD") { authUser.name = "Administrator" authUser.editDone = "AD" } } if (!quickEdit) getStyleDirectory() else finishUp() } function getStyleDirectory() { if (authUser.style == null || authUser.style.length < 1) authUser.style = 'style1' window.open("/cgi-lawson/dirContents?" + WebDir + "/lawson/images/lawson/" + authUser.style + "&authDirContents()", authUser.frameNm) } function authDirContents() { var Icntr = 0 var Bcntr = 0 authUser.styleIcons = new Array() authUser.styleButtons = new Array() for (var i=0;i