Description
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters
| oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bbanknumber.p)
/* backwards compatibility : fill new mandatory field when not filled yet */
for each t_sBankNumber where
t_sBankNumber.BankNumberIsBankCharge = ?:
assign t_sBankNumber.BankNumberIsBankCharge = false.
end.
/* ================================================================ */
/* Trim dirty characters from field t_sBankNumber.BankNumber */
/* Assign field t_sBankNumber.BankNumberFormatted in case it is empty */
/* ================================================================ */
for each t_sBankNumber where
t_sBankNumber.tc_Status <> "D":U:
assign vcBankNumberFormatted = t_sBankNumber.BankNumber
t_sBankNumber.BankNumber = replace(t_sBankNumber.BankNumber,".":U,"":U)
t_sBankNumber.BankNumber = replace(t_sBankNumber.BankNumber,"-":U,"":U)
t_sBankNumber.BankNumber = replace(t_sBankNumber.BankNumber," ":U,"":U)
t_sBankNumber.BankNumber = replace(t_sBankNumber.BankNumber,"/":U,"":U).
if vcActivityCode = "SupplierBankNumberExcelIntegration":U
then do:
if t_sBankNumber.BankNumberFormatted <> "":U
then do:
if t_sBankNumber.BankNumberValidation <> {&BANKNUMBERVALIDATION-XX}
then do:
<Q-83 run BankAccFormatSectionByFrmtCode (all) (Read) (NoCache)
(input t_sBankNumber.BankNumberValidation, (FormatCode)
output dataset tqBankAccFormatSectionByFrmtCode) in BBankAccountFormat>
assign vcBankNumberString = t_sBankNumber.BankNumberFormatted.
for each tqBankAccFormatsectionByFrmtCode
break by tqBankAccFormatSectionByFrmtCode.tiBankAccFormatSectSequence:
if last(tqBankAccFormatSectionByFrmtCode.tiBankAccFormatSectSequence)
then leave.
if length (tqBankAccFormatSectionByFrmtCode.tcBankAccFormatSectDelimiter,'CHARACTER') > 0
then assign vcBankNumberString = replace(vcBankNumberString,tqBankAccFormatSectionByFrmtCode.tcBankAccFormatSectDelimiter,"":U).
end. /* for each tqBankAccFormatsectionByFrmtCode */
end. /* if t_sBankNumber.BankNumberValidation <> {&BANKNUMBERVALIDATION-XX} */
else assign vcBankNumberString = t_sBankNumber.BankNumberFormatted.
if (vcBankNumberString <> t_sBankNumber.BankNumber)
then do:
oiReturnStatus = -1.
<M-73 run SetMessage
(input trim(#T-36'Fomatted bank number ($1) without formatting is not equal to unformatted bank number ($2).':255(173153065)T-36#) (icMessage),
input t_sBankNumber.BankNumberFormatted + chr(2) + t_sBankNumber.BankNumber (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-114919':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
return.
end. /* if (vcBankNumberString <> t_sBankNumber.BankNumber) */
end. /* if t_sBankNumber.BankNumberFormatted <> "":U */
/* Validate Pay Format Attribut value */
for each t_sBankNumberPayCode where
t_sBankNumberPayCode.tc_Status <> 'D':U and
t_sBankNumberPayCode.tc_Status <> '':U and
t_sBankNumberPayCode.tc_Status <> ? :
<Q-43 run PayFormatCodebyGroupID (all) (Read) (NoCache)
(input ?, (PayFormatCodeID)
input '':U, (PayFormatCode)
input t_sBankNumberPayCode.PayFormatGroup_ID, (PayFormatGroupID)
output dataset tqPayFormatCodebyGroupID) in BPaymentFormat>
find first tqPayFormatCodebyGroupID where
tqPayFormatCodebyGroupID.tiPayFormatGroup_ID = t_sBankNumberPayCode.PayFormatGroup_ID and
tqPayFormatCodebyGroupID.tcPayFormatCode = t_sBankNumberPayCode.BankNumberPayCodeValue
no-lock no-error.
if available tqPayFormatCodebyGroupID
then assign t_sBankNumberPayCode.tcPayFormatCode = tqPayFormatCodebyGroupID.tcPayFormatCode.
else if t_sBankNumberPayCode.tcPayFormatGroupInputOption = {&PAYFORMATGROUPINPUTOPTION-SELECTABLE}
then do:
assign vcMessage = trim(#T-31'The attribute value must be defined in Payment Format Maintenance.':100(55848)T-31#)
oiReturnStatus = -1.
<M-72 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-49706':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
end.
end. /* Validate Pay Format Attribut value */
end. /* if vcActivityCode = "SupplierBankNumberExcelIntegration":U */
if t_sBankNumber.BankNumberFormatted = "":U or
t_sBankNumber.BankNumberFormatted = ?
then assign t_sBankNumber.BankNumberFormatted = vcBankNumberFormatted.
end. /* for each t_sBankNumber where */
/* ================================== */
/* Assignments and manual validations */
/* ================================== */
<M-2 run ValidateComponentBeforeAncestor (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
assign viPreReturnStatus = oiReturnStatus.
<M-70 run CalculatePayFormatCodeDesc (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viFcReturnSuper = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viFcReturnSuper.
assign viPreReturnStatus = oiReturnStatus.
/* ============================================================= */
/* Avoid having NULL values in field belonging to a unique index */
/* ============================================================= */
for each t_sBankNumber where
t_sBankNumber.tc_Status = "N":U or
t_sBankNumber.tc_Status = "C":U :
if t_sBankNumber.BankNumber = ?
then assign t_sBankNumber.BankNumber = "":U.
if t_sBankNumber.BankNumberExtension = ?
then assign t_sBankNumber.BankNumberExtension = "":U.
if t_sBankNumber.BankNumberValidation = ?
then assign t_sBankNumber.BankNumberValidation = "":U.
if t_sBankNumber.BankPayFormat_ID = ?
then assign t_sBankNumber.BankPayFormat_ID = 0.
if t_sBankNumber.ParentObject_ID = ?
then assign t_sBankNumber.ParentObject_ID = 0.
if t_sBankNumber.CompanySharedSet_ID = ?
then assign t_sBankNumber.CompanySharedSet_ID = 0.
end. /* for each t_sBankNumber where */
<ANCESTOR-CODE>
assign oiReturnStatus = if (oiReturnStatus > 0 and
viPreReturnStatus = 0) or
oiReturnStatus < 0
then oiReturnStatus
else viPreReturnStatus.
<M-3 run ValidateComponentPost (output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0
then assign oiReturnStatus = viFcReturnSuper.