project QadFinancials > class BSystem > method ApiSetSystemPropertiesExtInvCert
Description
ApiSetSystemPropertiesExtInvCert: most recent version of method ApiSetSystemProperties.
Call this method to set all the system properties.
Parameters
icSysLngCode | input | character | SysLngCode |
icSysDomainCode | input | character | |
ilSysPropertyIsBudOverCh | input | logical | SysPropertyIsBudOverCh |
icSysPropertyCurrencyCode | input | character | SysPropertyCurrencyCode (Consolidation currency) |
ilSysPropertyIsWithBudget | input | logical | SysPropertyIsWithBudget |
ilSysPropertyIsSpecCIApprove | input | logical | SysPropertyIsSpecCIApprove |
ilSysPropertyIsBudOLCheckGL | input | logical | SysPropertyIsBudOLCheckGL |
ilSysPropertyIsBudOLCheckPrj | input | logical | SysPropertyIsBudOLCheckPrj |
ilSysPropertyIsBudOLCheckCC | input | logical | SysPropertyIsBudOLCheckCC |
icSystAdminUserLogin | input | character | |
icSystAdminUserPwd | input | character | |
icSysApplicationId | input | character | Input parameter System Application ID. It is the unique identification if the application. |
ilSysPropertyIsBusRelDomRes | input | logical | default value of BusinessRelation.BusinessRelationIsDomRestr should come from SysPropertyIsBusRelDomRes and have that lather field on System maintenance UI with label Are business relations by domain ? |
icSysPropertyInvCertCertificate | input | character | SysPropertyInvCertCertificate |
icSysPropertyInvCertVersion | input | character | SysPropertyInvCertVersion |
icSysPropertyInvCertPublicKey | input | character | SysPropertyInvCertPublicKey |
icSysPropertyInvCertOpenSSLDir | input | character | SysPropertyInvCertOpenSSLDir |
iiSysPropertyBankFileBatchSize | input | integer | Bank File Batch Size. |
iiSysPropertyMaxBatchSize | input | integer | Maximum Batch Size |
iiSysPropertyMinBatchSize | input | integer | Minimum Batch Size |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program8/bsystem.p)
/* =============================================================================== */
/* Clear the instance, check parameters */
/* Find the single system-record, if available then load it, else create a new one */
/* Update the Data */
/* =============================================================================== */
<M-44 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ================================================================================ */
/* Check if the Syst Records already exists - create it if this is not the case yet */
/* ================================================================================ */
<Q-60 run SystByID (all) (Read) (NoCache)
(input ?, (Syst_ID)
output dataset tqSystByID) in BSystem >
find first tqSystByID no-lock no-error.
if not available tqSystByID
then do :
<M-87 run DataNew (output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
<M-58 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
/* If the caller is the synchronize, the logins is mfg and no password */
if icSystAdminUserLogin = 'XXXmfgXXX'
then do:
<Q-36 assign vlFcQueryRecordsAvailable = UserPrim (NoCache)
(input ?, (UsrId)
input 'mfg':U, (UsrLogin)) in BUser>
if vlFcQueryRecordsAvailable = true
then assign icSystAdminUserLogin = 'mfg':U
icSystAdminUserPwd = ''.
else assign icSystAdminUserLogin = ''
icSystAdminUserPwd = ''.
end.
end. /* if not available tqSystByID */
else do :
<M-61 run DataLoad
(input '':U (icRowids),
input STRING(tqSystByID.tiSyst_ID) (icPkeys),
input '':U (icObjectIds),
input '' (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
<M-41 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
find tSyst where
tSyst.Syst_ID = tqSystByID.tiSyst_ID
no-error.
if not available tSyst
then do :
assign vcMessage = trim(substitute(#T-17'The system cannot load the system properties based on the ID (&1).':255(3763)T-17#,string(tqSystByID.tiSyst_ID))) + " (3)":U
oiReturnStatus = -3.
<M-64 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-155168':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BSystem>
<M-67 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if not available tqSystByID */
else assign tSyst.tc_Status = "C":U.
/* If the caller is the synchronize, we take Usr and Login from the db */
if icSystAdminUserLogin = 'XXXmfgXXX'
then assign icSystAdminUserLogin = tSyst.tcSystAdminUsrLogin
icSystAdminUserPwd = tSyst.SystAdminUserPwd.
end. /* if available tqSystByID */
/* ====================================== */
/* Assign the value based upon the params */
/* ====================================== */
assign tSyst.tcLngCode = icSysLngCode
tSyst.tcDomainCode = icSysDomainCode
tSyst.SystApplicationId = icSysApplicationId.
If tSyst.tcSystAdminUsrLogin <> icSystAdminUserLogin or
tSyst.SystAdminUserPwd <> icSystAdminUserPwd
then assign tSyst.tcSystAdminUsrLogin = icSystAdminUserLogin
tSyst.SystAdminUserPwd = icSystAdminUserPwd.
/* ======================================================================================================== */
/* Validate BSystem; this needs to be done before the communication towards BSystemProperty is started */
/* because in the ancestor-code of BSystem.ValidateComponent, then instance of BSystemProperty is discarded */
/* ======================================================================================================== */
<M-9 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
<M-38 run StopExternalInstances (output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
/* ============================================================================================================================ */
/* When this method is called from the Synchronise-process then the CurrencyCode is surrounded by XXX */
/* This way we know this method is called from the Synchronise process - and not via the system-maintenance */
/* We also make sure to strip-off the XXX around the currency-code parameter before copying it to the instance-data */
/* ============================================================================================================================ */
if icSysPropertyCurrencyCode begins 'XXX' and
length(icSysPropertyCurrencyCode,"Character":U) > 6 and
substring(icSysPropertyCurrencyCode, length(icSysPropertyCurrencyCode, "Character":U) - 2, -1, "Character":U) = "XXX":U
then assign vlCalledFromSynchronise = true
icSysPropertyCurrencyCode = substring(icSysPropertyCurrencyCode, 4 , length(icSysPropertyCurrencyCode, "Character":U) - 6, "Character":U).
else assign vlCalledFromSynchronise = false.
/* ===================================================== */
/* Execute a similar method on component BSystemProperty */
/* ===================================================== */
if viBSystemPropertyID = 0 or viBSystemPropertyID = ?
then do :
<I-24 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BSystemProperty"}>
end. /* if viBSystemProperty = 0 or BSystemProperty = ? */
else do :
<I-94 {bFcOpenInstance
&CLASS = "BSystemProperty"}>
end. /* not if viBSystemProperty = 0 or BSystemProperty = ? */
<M-90 run SetSystemProperties
(input ilSysPropertyIsBudOverCh (ilSysPropertyIsBudOverCh),
input icSysPropertyCurrencyCode (icSysPropertyCurrencyCode),
input ilSysPropertyIsWithBudget (ilSysPropertyIsWithBudget),
input ilSysPropertyIsSpecCIApprove (ilSysPropertyIsSpecCIApprove),
input ilSysPropertyIsBudOLCheckGL (ilSysPropertyIsBudOLCheckGL),
input ilSysPropertyIsBudOLCheckPrj (ilSysPropertyIsBudOLCheckPrj),
input ilSysPropertyIsBudOLCheckCC (ilSysPropertyIsBudOLCheckCC),
input ilSysPropertyIsBusRelDomRes (ilSysPropertyIsBusRelDomRes),
input icSysPropertyInvCertCertificate (icSysPropertyInvCertCertificate),
input icSysPropertyInvCertVersion (icSysPropertyInvCertVersion),
input icSysPropertyInvCertPublicKey (icSysPropertyInvCertPublicKey),
input icSysPropertyInvCertOpenSSLDir (icSysPropertyInvCertOpenSSlDir),
input vlCalledFromSynchronise (ilCalledFromSynchronise),
input iiSysPropertyBankFileBatchSize (iiSysPropertyBankFileBatchSize),
input iiSysPropertyMaxBatchSize (iiSysPropertyMaxBatchSize),
input iiSysPropertyMinBatchSize (iiSysPropertyMinBatchSize),
output viSetSystemPropertiesReturn (oiReturnStatus)) in BSystemProperty>
<I-66 {bFcCloseInstance
&CLASS = "BSystemProperty"}>
if viSetSystemPropertiesReturn <> 0 then assign oiReturnStatus = viSetSystemPropertiesReturn.
if oiReturnStatus < 0
then do :
<M-45 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
/* ==================================================================== */
/* AddtionalUpdates and Save (ValidateBC was done earlier) */
/* ==================================================================== */
<M-81 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
<M-51 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
<M-12 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do :
<M-89 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BSystem>
return.
end. /* if oiReturnStatus < 0 */
Sample code: how to call this method through RPCRequestService (QXtend Inbound)
define temp-table ttContext no-undo
field propertyQualifier as character
field propertyName as character
field propertyValue as character
index entityContext is primary unique
propertyQualifier
propertyName
index propertyQualifier
propertyQualifier.
define dataset dsContext for ttContext.
define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.
/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
ttContext.propertyValue = "BSystem".
create ttContext.
assign ttContext.propertyName = "methodName"
ttContext.propertyValue = "ApiSetSystemPropertiesExtInvCert".
create ttContext.
assign ttContext.propertyName = "applicationId"
ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
ttContext.propertyValue = "".
/* Create input dataset */
create dataset vhInputDS.
vhInputDS:read-xmlschema("file", "xml/bsystem.apisetsystempropertiesextinvcert.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().
assign vhParameter::icSysLngCode = <parameter value>
vhParameter::icSysDomainCode = <parameter value>
vhParameter::ilSysPropertyIsBudOverCh = <parameter value>
vhParameter::icSysPropertyCurrencyCode = <parameter value>
vhParameter::ilSysPropertyIsWithBudget = <parameter value>
vhParameter::ilSysPropertyIsSpecCIApprove = <parameter value>
vhParameter::ilSysPropertyIsBudOLCheckGL = <parameter value>
vhParameter::ilSysPropertyIsBudOLCheckPrj = <parameter value>
vhParameter::ilSysPropertyIsBudOLCheckCC = <parameter value>
vhParameter::icSystAdminUserLogin = <parameter value>
vhParameter::icSystAdminUserPwd = <parameter value>
vhParameter::icSysApplicationId = <parameter value>
vhParameter::ilSysPropertyIsBusRelDomRes = <parameter value>
vhParameter::icSysPropertyInvCertCertificate = <parameter value>
vhParameter::icSysPropertyInvCertVersion = <parameter value>
vhParameter::icSysPropertyInvCertPublicKey = <parameter value>
vhParameter::icSysPropertyInvCertOpenSSLDir = <parameter value>
vhParameter::iiSysPropertyBankFileBatchSize = <parameter value>
vhParameter::iiSysPropertyMaxBatchSize = <parameter value>
vhParameter::iiSysPropertyMinBatchSize = <parameter value>.
/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").
if not vhServer:connected()
then do:
message "Could not connect AppServer" view-as alert-box error title "Error".
return.
end.
/* Run */
assign vhContextDS = dataset dsContext:handle.
run program/rpcrequestservice.p on vhServer
(input-output dataset-handle vhContextDS by-reference,
output dataset-handle vhExceptionDS,
input dataset-handle vhInputDS by-reference,
input-output dataset-handle vhInputOutputDS by-reference,
output dataset-handle vhOutputDS).
/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).
if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).
/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.
if valid-handle(vhInputDS)
then delete object vhInputDS.
if valid-handle(vhOutputDS)
then delete object vhOutputDS.
if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.