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/bpaymentcondition.p)
<M-1 run PreValidateComponent (output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
<ANCESTOR-CODE>
<Q-8 run PaymentConditionByIdCode (Start) in BPaymentCondition >
VALIDATEBLOCK:
for each t_sPaymentCondition where
t_sPaymentCondition.PaymentConditionPaymentTyp = {&PAYMENTCONDITIONPAYMENTTYPE-STAGED} and
(t_sPaymentCondition.tc_Status = "C":U or
t_sPaymentCondition.tc_Status = "N":U):
assign vcStagePeriodTypes = "":U
vcStageNumOfPeriods = "":U.
for each t_sPaymentConditionStaged where
t_sPaymentConditionStaged.tc_ParentRowid = t_sPaymentCondition.tc_Rowid and
t_sPaymentConditionStaged.tc_Status <> "D":U:
<Q-7 run PaymentConditionByIdCode (all) (Read) (NoCache)
(input t_sPaymentConditionStaged.StagedPaymentCondition_ID, (PaymentConditionId)
input ?, (PaymentConditionCode)
output dataset tqPaymentConditionByIdCode) in BPaymentCondition >
find first tqPaymentConditionByIdCode where
tqPaymentConditionByIdCode.tiPaymentCondition_ID = t_sPaymentConditionStaged.StagedPaymentCondition_ID no-error.
if available tqPaymentConditionByIdCode
then do:
if vcStagePeriodTypes = "":U or vcStagePeriodTypes = ?
then assign vcStagePeriodTypes = tqPaymentConditionByIdCode.tcPaymentConditionPeriodType
vcStageNumOfPeriods = string(tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths)
vcStageBaseDates = (if (tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths = 0 or
tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths = ?) and
tqPaymentConditionByIdCode.ttPaymentConditionBaseDate <> ?
then string(tqPaymentConditionByIdCode.ttPaymentConditionBaseDate)
else "?":U).
else assign vcStagePeriodTypes = vcStagePeriodTypes + ",":U + tqPaymentConditionByIdCode.tcPaymentConditionPeriodType
vcStageNumOfPeriods = vcStageNumOfPeriods + ",":U + string(tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths)
vcStageBaseDates = vcStageBaseDates + ",":U + (if (tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths = 0 or
tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths = ?) and
tqPaymentConditionByIdCode.ttPaymentConditionBaseDate <> ?
then string(tqPaymentConditionByIdCode.ttPaymentConditionBaseDate)
else "?":U).
repeat viCounter = 1 to num-entries(vcStagePeriodTypes) - 1:
if tqPaymentConditionByIdCode.tcPaymentConditionPeriodType = entry(viCounter, vcStagePeriodTypes) and
string(tqPaymentConditionByIdCode.tiPaymentConditionDaysMonths) = entry(viCounter, vcStageNumOfPeriods) and
string(tqPaymentConditionByIdCode.ttPaymentConditionBaseDate) = entry(viCounter, vcStageBaseDates)
then do:
assign vcMsg = trim(#T-11'You cannot link two or more credit terms with the same Period Type, Base date and No of Periods to the same staged credit term.':255(89770504)T-11#)
oiReturnStatus = -1.
<M-10 run SetMessage
(input vcMsg (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPaymentCondition.tc_Rowid (icRowid),
input 'QadFin-8281':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
next VALIDATEBLOCK.
end. /* if bPaymentCondition.PaymentConditionPeriodType = ... */
end. /* repeat viCounter = 1 to num-entries(vcStagePeriodTypes) - 1 */
end. /* if available bPaymentCondition */
end. /* for each t_sPaymentConditionStaged */
end. /* for each t_sPaymentCondition */
<Q-9 run PaymentConditionByIdCode (Stop) in BPaymentCondition >
<M-3 run StopExternalInstances
(output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>