| icGlobalSessionId | input | character | identification of the global session |
| icCompanyCode | input | character | Entity to log in to. When empty, default entity will be used |
| icExtra | input | character | Extra parameters for login, chr(2) separated DebugLevel {2} 0-63 {2} RefreshCompanyData {2} Y/N |
| ilReturnTimeStamps | input | logical | When true, lookup value for the timestamp parameters. When false, timestamp parameters remain empty. |
| ocReportTimeStamp | output | character | Returns the timestamp of the most recent updated report file (standard reports + custom reports). format is 'mm/dd/yy=>>>>9;mm/dd/yy=>>>>9'. |
| ocSystCacheDateTime | output | character | If persistent cache on the client is older that this timestamp, it must be updated. |
| ocSystDateTime | output | character | Returns local time on the server. |
| oiReturnStatus | output | integer | Return status of the method. |
BLF
QadFinancials
assign vcGlobalSessionId = icGlobalSessionId.
<M-58 run StartPersistence
(output vhPLA (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* read debug level from global session */
if viSessionDebugLevel = 0
then do:
vhFcComponent = vhPLA.
vcCPO = "for each fcSession where fcSession.GlobalSessionId = '" + vcGlobalSessionId + "'".
<M-25 run ReadDirect
(input 'fcSession' (icTableName),
input vcCPO (icPrepare),
input 'GlobalSessionDebugLevel' (icFieldList),
output vcDebugLevel (ocValueList),
input {&TARGETPROCEDURE} (ihClass),
output viFcReturnSuper (oiReturnStatus)) in Progress>
if viFcReturnSuper = -4
then viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-90 run SetDebugLevel (input integer (vcDebugLevel) (iiDebugLevel)) in Session>
end.
<M-74 run GetIntegerValue
(input 'CompanyId' (icName),
output viOldCompanyId (oiValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-75 run GetCharacterValue
(input 'CompanyCode' (icName),
output vcOldCompanyCode (ocValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
/* Set debugging if not already set */
IF Not vlSetDebugCalled
Then Do:
<M-76 run SetDebug
(input icExtra (icExtra),
output viFcReturnSuper (oiReturnStatus)) in Session>
If viFcReturnSuper < 0
Then Assign oiReturnStatus = viFcReturnSuper.
If oiReturnStatus < 0
Then RETURN.
End.
/* Clear cache of previous login */
<M-77 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-78 run ClearCache (output viFcReturnSuper (oiReturnStatus)) in Cacher>
/* ================================================================= */
/* Set system settings */
/* ================================================================= */
<M-6 run SetLogicalValue (input 'DraftsActive':U (icName),
input vlDraftsActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-79 run SetCharacterValue
(input 'GlobalSessionId':U (icName),
input icGlobalSessionId (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign vcFile = search ("server.xml":U)
viMaxInstances = 500.
if vcFile <> ?
then do:
assign vhFcComponent = ?.
<M-80 run MainBlock () in XML>
assign vhXMLhandle = vhFcComponent.
<M-11 run ReadXMLNodeValue
(input vcFile (icXMLFile),
input 'transactions':U (icStartTag),
input 'MaximumInstancesInTransaction':U (icNodeTag),
output vcMaximumInstancesInTransaction (ocNodeValue),
output viFcReturnSuper (oiReturnStatus)) in XML>
run gipr_DeleteProcedure in vhXMLhandle.
delete procedure vhXMLHandle.
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
If vcMaximumInstancesInTransaction <> ""
Then Assign viMaxInstances = Integer(vcMaximumInstancesInTransaction) no-error.
End.
<M-10 run SetIntegerValue
(input 'MaxInstancesInTransaction':U (icName),
input viMaxInstances (iiValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if ilReturnTimeStamps
then do:
ocSystDateTime = string(now).
vhFcComponent = ?.
<M-81 run ApiGetReportGlobalTimeStamp
(output ocReportTimeStamp (ocTimestamp),
output viFcReturnSuper (oiReturnStatus)) in BReportComm>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
If vcUserFromUIShell = '':U Or
vcUserFromUIShell = ?
Then Do:
if com.qad.qra.config.QraConfig:IsEnabled
then do:
<I-21 {bFcStartAndOpenInstance
&CLASS = "PAuthenticationQRA"}>
<M-50 run GetUser
(input icGlobalSessionId (icGlobalSessionId),
output vcUsrLoginId (ocUserId),
output vcCPO (ocClientPrincipalObject),
output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
<I-12 {bFcCloseAndStopInstance
&CLASS = "PAuthenticationQRA"}>
end.
else do:
<I-38 {bFcStartAndOpenInstance
&CLASS = "PAuthentication"}>
<M-39 run GetUser
(input icGlobalSessionId (icGlobalSessionId),
output vcUsrLoginId (ocUserId),
output vcCPO (ocClientPrincipalObject),
output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
<I-40 {bFcCloseAndStopInstance
&CLASS = "PAuthentication"}>
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/*
<M-73 run RegisterClientPrincipalInPool
(input 'showusage' (icObjectKey),
output viFcReturnSuper (oiReturnStatus)) in ComponentPool>
*/
run RegisterClientPrincipalInPool (input vcCPO, output viFcReturnSuper).
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-69 run SetCharacterValue
(input 'CPO' (icName),
input vcCPO (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
End.
Else
Assign vcUsrLoginId = vcUserFromUIShell.
<Q-35 run UserByUsrLogin (all) (Read) (NoCache)
(input vcUsrLoginId, (UsrLogin)
output dataset tqUserByUsrLogin) in BUser >
Find First tqUserByUsrLogin Where
tqUserByUsrLogin.tcUsrLogin = vcUsrLoginId No-error.
if available tqUserByUsrLogin
then do:
<M-28 run SetIntegerValue (input 'UsrId':U (icName),
input tqUserByUsrLogin.tiUsr_ID (iiValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-29 run SetCharacterValue (input 'UserName':U (icName),
input tqUserByUsrLogin.tcUsrName (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-30 run SetCharacterValue (input 'UserLogin':U (icName),
input tqUserByUsrLogin.tcUsrLogin (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign viUsrId = tqUserByUsrLogin.tiUsr_ID
vcUserName = tqUserByUsrLogin.tcUsrName
vcUserLogin = tqUserByUsrLogin.tcUsrLogin.
end.
else do:
<M-32 run SetCharacterValue (input 'UserLogin':U (icName),
input vcUsrLoginId (icValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign viUsrId = 0
vcUserName = vcUsrLoginId
vcUserLogin = vcUsrLoginId.
end.
if icCompanyCode = ""
or icCompanyCode = ?
then do:
<Q-5 run UsrDefaultDomainCompany (all) (Read) (NoCache)
(input 0, (UsrID)
input vcUsrLoginId, (UsrLogin)
output dataset tqUsrDefaultDomainCompany) in BUser>
find first tqUsrDefaultDomainCompany no-error.
if available tqUsrDefaultDomainCompany
then icCompanyCode = tqUsrDefaultDomainCompany.tcCompanyCode.
else do:
/* no default ? take a random */
<Q-3 run UserCompanies (all) (Read) (NoCache)
(input vcUsrLoginId, (UserLogin)
input 0, (CyId)
input 0, (DomainId)
output dataset tqUserCompanies) in BUser>
find first tqUserCompanies no-error.
if available tqUserCompanies
then icCompanyCode = tqUserCompanies.tcCompanyCode.
end.
end.
/* ============================================================================== */
/* Check on the existence of a system record. */
/* Except for the "mfg" user, as that account is used for the initial */
/* Synchronise run and should not be blocked with a non-existing user. */
/* ============================================================================== */
if ilReturnTimeStamps
then do:
<Q-70 run SystByID (all) (Read) (NoCache)
(input 0, (Syst_ID)
output dataset tqSystByID) in BSystem >
find first tqSystByID no-error.
if available tqSystByID
then ocSystCacheDateTime = tqSystByID.tcSystCacheDateTime.
vlFcQueryRecordsAvailable = (available tqSystByID).
end.
else do:
<Q-71 assign vlFcQueryRecordsAvailable = SystByID (NoCache) (input 0, (Syst_ID)) in BSystem >
end.
if vcUsrLoginId <> "mfg":U
then do :
if not vlFcQueryRecordsAvailable
then do :
<M-45 run SetMessage
(input #T-44'A system record could not be found. This is needed for a successful login.':100(8215)T-44# (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 1 (iiSeverity),
input '' (icRowid),
input 'BLF-387':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign oiReturnStatus = -1.
return.
end.
end.
/* ================================================================= */
/* Set system settings */
/* ================================================================= */
<M-82 run SetLogicalValue
(input 'ObjectSecurityActive':U (icName),
input vlObjectSecurityActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-83 run SetLogicalValue
(input 'EventPublishingActive':U (icName),
input vlEventPublishingActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-84 run SetLogicalValue
(input 'CBFActive':U (icName),
input vlCBFActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-72 run SetLogicalValue
(input 'WorkFlowActive':U (icName),
input vlWorkflowActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<M-85 run SetLogicalValue
(input 'FieldSecurityActive':U (icName),
input vlFieldSecurityActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
if vlFieldSecurityActive
then do:
/* activate field security only for business components with active field security */
<Q-86 run FieldSecurityComponents (all) (Read) (NoCache) (output dataset tqFieldSecurityComponents) in BFieldSecurity >
For Each tqFieldSecurityComponents:
<M-9 run SetLogicalValue (input tqFieldSecurityComponents.tcBusComponentCode + 'FieldSecurityActive':U (icName),
input true (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
End.
end.
/* ================================================================= */
/* Load user setting : UI customization */
/* ================================================================= */
<Q-56 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-UICUSTOM}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName and
tqCheckSettingByName.tlSettingIsActive = true
then do:
<Q-57 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-UICUSTOM}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-USER}, (ConfigLevel)
input string (viUsrId), (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName
then assign vlUICustomizationActive = tqCheckSettingByName.tlSettingIsActive.
else assign vlUICustomizationActive = true.
end.
else assign vlUICustomizationActive = false.
<M-87 run SetLogicalValue
(input 'UICustomizationActive':U (icName),
input vlUICustomizationActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
/* ============================================ */
/* Load user setting: translatable descriptions */
/* ============================================ */
<Q-93 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-OBJECTTRANSLATIONS}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName
no-error.
if available tqCheckSettingByName and
tqCheckSettingByName.tlSettingIsActive = true
then do:
<Q-31 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-OBJECTTRANSLATIONS}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-USER}, (ConfigLevel)
input string (viUsrId), (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName
no-error.
assign vlObjectTranslationsActive = if available tqCheckSettingByName
then tqCheckSettingByName.tlSettingIsActive
else true.
end.
else assign vlObjectTranslationsActive = false.
<M-97 run SetLogicalValue
(input 'UseTranslations' (icName),
input vlObjectTranslationsActive (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
Assign vlSwitchCompany = False.
If icCompanyCode = ? Then Assign icCompanyCode = '':U.
If vcOldCompanyCode = ? Then Assign vcOldCompanyCode = '':U.
If icCompanyCode <> vcOldCompanyCode And
icCompanyCode <> '':U And
icCompanyCode <> ?
Then Do:
Assign vlSwitchCompany = True.
End.
if vlSwitchcompany = no
then do:
assign viFcCount1 = lookup("RefreshCompanyData":U,icExtra,chr(2)).
if viFcCount1 > 0
and entry(viFcCount1 + 1, icExtra,chr(2)) = "Y":U
then vlSwitchcompany = yes.
end.
if vlSwitchcompany = yes
then do:
<M-19 run SwitchCompany (input icCompanyCode (icCompanyCode),
input ? (iiCompanyId),
output viFcReturnSuper (oiReturnStatus)) in Session>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
/* ================================================================= */
/* These 3 settings are not kept on business level. */
/* ================================================================= */
<Q-62 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-AUTOSAVEGRID}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName and
tqCheckSettingByName.tlSettingIsActive = true
then do:
<Q-63 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-AUTOSAVEGRID}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-USER}, (ConfigLevel)
input string (viUsrId), (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName
then assign vlSetting = tqCheckSettingByName.tlSettingIsActive.
else assign vlSetting = true.
end.
else assign vlSetting = false.
<M-22 run SetLogicalValue (input {&SETTINGCONFIG-AUTOSAVEGRID} (icName),
input vlSetting (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
if vlSetting
then assign vlSetting = no.
else do:
<Q-23 assign vlFcQueryRecordsAvailable = CheckSettingByName (NoCache) (input {&SETTINGCONFIG-ALLOWSAVEGRID}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input yes, (Active)) in BSettingConfiguration >
vlSetting = (vlFcQueryRecordsAvailable <> no).
end.
<M-24 run SetLogicalValue (input {&SETTINGCONFIG-ALLOWSAVEGRID} (icName),
input vlSetting (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
<Q-64 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-AUTOSAVELASTUSED}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName and
tqCheckSettingByName.tlSettingIsActive = true
then do:
<Q-65 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-AUTOSAVELASTUSED}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-USER}, (ConfigLevel)
input string (viUsrId), (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName
then assign vlSetting = tqCheckSettingByName.tlSettingIsActive.
else assign vlSetting = true.
end.
else assign vlSetting = false.
<M-27 run SetLogicalValue (input {&SETTINGCONFIG-AUTOSAVELASTUSED} (icName),
input vlSetting (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
/*Setting Enable Persistent Cache*/
<Q-18 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-ENABLEPERSISTENTCACHE}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-SYSTEM}, (ConfigLevel)
input '', (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName and
tqCheckSettingByName.tlSettingIsActive = true
then do:
<Q-66 run CheckSettingByName (all) (Read) (NoCache)
(input {&SETTINGCONFIG-ENABLEPERSISTENTCACHE}, (ConfigName)
input {&SETTINGCONFIG-LEVEL-USER}, (ConfigLevel)
input string (viUsrId), (Scope)
input ?, (Active)
output dataset tqCheckSettingByName) in BSettingConfiguration >
find first tqCheckSettingByName no-error.
if available tqCheckSettingByName
then assign vlSetting = tqCheckSettingByName.tlSettingIsActive.
Else Assign vlSetting = False.
end.
else assign vlSetting = false.
<M-67 run SetLogicalValue
(input {&SETTINGCONFIG-ENABLEPERSISTENTCACHE} (icName),
input vlSetting (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
/*login is succesfull so create the fcSession record*/
if com.qad.qra.config.QraConfig:IsEnabled
then do:
<I-91 {bFcStartAndOpenInstance
&CLASS = "PAuthenticationQRA"}>
<M-94 run GetTimeOutWrapper
(input icGlobalSessionId (icGlobalSessionId),
output viTimeOut (oiTimeOut),
output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>
<I-569 {bFcCloseAndStopInstance
&CLASS = "PAuthenticationQRA"}>
end.
else do:
<I-49 {bFcStartAndOpenInstance
&CLASS = "PAuthentication"}>
<M-52 run GetTimeOutWrapper
(input icGlobalSessionId (icGlobalSessionId),
output viTimeOut (oiTimeOut),
output viFcReturnSuper (oiReturnStatus)) in PAuthentication>
<I-51 {bFcCloseAndStopInstance
&CLASS = "PAuthentication"}>
end.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
/* Save date and time in UTC */
session:timezone = 0.
vhFcComponent = vhPLA.
<M-55 run CreateFcSession
(input viSessionID (iiSessionInstanceId),
input icGlobalSessionId (icGlobalSessionId),
input Time (iiSessionLastCheckTime),
input Today (itSessionLastCheckDate),
input Time (iiGlobalSessionLastCheckTime),
input Today (itGlobalSessionLastCheckDate),
input False (ilGlobalSessionNeedsUpdate),
input viTimeOut (iiSessionTimeOut),
input viSessionDebugLevel (iiGlobalSessionDebugLevel),
output viFcReturnSuper (oiReturnStatus)) in persistence>
session:timezone = viTimeOffset.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
Assign vlDeleteFcSession = true.
<M-36 run SetLogicalValue (input 'ValidLogin':U (icName),
input true (ilValue),
output viFcReturnSuper (oiReturnStatus)) in Session>
assign vlLoginFailed = false.