project QadFinancials > class BCompany > method ApiSynchroniseCustom
Description
Write extra code that needs to be executed when the general ApiSynchronise is run on a component inherited from BCompany.
Update the CompanyProperty information for the System Synchronize.
Parameters
| olUpdatesDone | output | logical | Updates done |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program/bcompany.p)
<ANCESTOR-CODE>
assign oiReturnStatus = -98.
find first tCompanyPropertyRef no-error.
if not available tCompanyPropertyRef
then do :
assign vcMessage = trim(substitute(#T-16'Internal error: cannot load the entity property instance.':255(1281)t-16#)).
<M-4 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-4696':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCompany>
assign oiReturnStatus = -1.
Return.
end. /* if not available tCompanyPropertyRef */
/* ============================== */
/* State all requiered properties */
/* ============================== */
if tCompanyPropertyRef.CompanyPropertyIsActive = false
then do :
assign tCompanyPropertyRef.CompanyPropertyIsActive = true.
if tCompanyPropertyRef.tc_Status = "":U
then assign tCompanyPropertyRef.tc_Status = "C":U.
end. /* if tCompanyPropertyRef.CompanyPropertyIsActive = false */
if tCompanyPropertyRef.tcBusinessRelationCode <> "999 - SYSADM":U
then do :
<Q-8 run BusinessRelationByCode (all) (Read) (NoCache)
(input '999 - SYSADM':U, (BusinessRelationCode)
input viDomainID, (DomainID)
output dataset tqBusinessRelationByCode) in BBusinessRelation >
find first tqBusinessRelationByCode no-lock no-error.
if available tqBusinessRelationByCode
then do :
assign tCompanyPropertyRef.tcBusinessRelationCode = tqBusinessRelationByCode.tcBusinessRelationCode.
if tCompanyPropertyRef.tc_Status = "":U
then assign tCompanyPropertyRef.tc_Status = "C":U.
end. /* if available tqBusinessRelationByCode */
end. /* if tCompanyPropertyRef.CompanyPropertyIsActive = false */
if tCompanyPropertyRef.tcCurrencyCode = "":U or
tCompanyPropertyRef.tcCurrencyCode = ?
then do :
<Q-10 run CurrencyPrim (all) (Read) (NoCache)
(input 'USD':U, (CurrencyCode)
input ?, (Currency_ID)
output dataset tqCurrencyPrim) in BCurrency >
find first tqCurrencyPrim no-lock no-error.
if not available tqCurrencyPrim
then do :
<Q-11 run CurrencyPrim (all) (Read) (NoCache)
(input ?, (CurrencyCode)
input ?, (Currency_ID)
output dataset tqCurrencyPrim) in BCurrency >
find first tqCurrencyPrim no-lock no-error.
end. /* if not available tqCurrencyPrim */
if available tqCurrencyPrim
then do:
assign tCompanyPropertyRef.tcCurrencyCode = tqCurrencyPrim.tcCurrencyCode.
if tCompanyPropertyRef.tc_Status = "":U
then assign tCompanyPropertyRef.tc_Status = "C":U.
end. /* if available tqCurrencyPrim */
end. /* if tCompanyPropertyRef.tcCurrencyCode = "":U */
/* ===================== */
/* Set output indication */
/* ===================== */
if can-find (first tCompanyPropertyRef where tCompanyPropertyRef.tc_Status <> "":U)
then assign olUpdatesDone = true.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.