project BLF > class BSetting > method DataLoadUser
Description
Load all system settings that are scoped to a end-user into the class temp-tables.
Parameters
iiUsrId | input | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bsetting.p)
define buffer bselectconfig for tqSelectConfig.
/* ================================================================= */
/* Load config */
/* ================================================================= */
<Q-1 run SelectConfig (all) (Read) (NoCache) (output dataset tqSelectConfig) in BSettingConfiguration >
/* ================================================================= */
/* Load setting */
/* ================================================================= */
assign vcLoad = "for each fcSetting where fcSetting.SettingScope = '' or fcSetting.SettingScope = '":U + string(iiUsrId) + "'":U.
<M-2 run DataLoad (input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcLoad (icFreeform),
input no (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BSetting>
if viFcReturnSuper = -4
then viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
for each tqSelectConfig where
tqSelectConfig.tcSettingConfigLevel = {&SETTINGCONFIG-LEVEL-USER}:
find first bselectconfig where
bselectconfig.tcSettingConfigName = tqSelectConfig.tcSettingConfigName and
bselectconfig.tcSettingConfigLevel = {&SETTINGCONFIG-LEVEL-SYSTEM} no-error.
if available bselectconfig
then do:
find first tfcSetting where
tfcSetting.SettingConfig_ID = bSelectConfig.tiSettingConfig_ID no-error.
if available tfcSetting
then vlFcOk = tfcSetting.SettingIsActive.
else vlFcOk = no.
end.
else vlFcOk = no.
find first tfcSetting where
tfcSetting.SettingConfig_ID = tqSelectConfig.tiSettingConfig_ID no-error.
if vlFcOk
then do:
if not available tfcSetting
then do:
/* ================================================================= */
/* Add missing setting */
/* ================================================================= */
<M-3 run AddDetailLine
(input 'fcSetting':U (icTable),
input '' (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BSetting>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
assign tfcSetting.SettingConfig_ID = tqSelectConfig.tiSettingConfig_ID
tfcSetting.SettingIsActive = tqSelectConfig.tlSettingConfigIsDefault
tfcSetting.SettingScope = string(iiUsrId).
end.
<M-4 run GetConfigLabel
(input tqSelectConfig.tcSettingConfigName (icConfigCode),
output tfcSetting.tcSettingConfigLabel (ocConfigLabel),
output viFcReturnSuper (oiReturnStatus)) in BSetting>
end.
else do:
/* ================================================================= */
/* Remove inactive setting */
/* ================================================================= */
if available tfcSetting
then delete tfcSetting.
end.
end.
/* ================================================================= */
/* Remove irrelevant setting */
/* ================================================================= */
for each tqSelectConfig where
tqSelectConfig.tcSettingConfigLevel <> {&SETTINGCONFIG-LEVEL-USER},
each tfcSetting where
tfcSetting.SettingConfig_ID = tqSelectConfig.tiSettingConfig_ID:
delete tfcSetting.
end.