project QadFinancials > class BDebtor > method ValDivisionProfile
Description
Validates Division Profile.
Note: The method is called within PreValidateComponent, thus all the relevant data can be found in t_s tables.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bdebtor.p)
/*error: Profile must exist - checked by FC*/
/*error: Profile must be of certain type*/
if t_sDebtor.DivisionProfile_ID > 0
then do:
<Q-2 run ProfileById (all) (Read) (Cache)
(input t_sDebtor.DivisionProfile_ID, (Profile_ID)
output dataset tqProfileById) in BProfile>
find first tqProfileById no-error.
/*error: not available tqProfileById should be checked by FC*/
/*error: if > 0 then it must be an existing profile of type = "Division"*/
if available tqProfileById and
tqProfileById.tcProfileTypeCode <> {&PROFILETYPECODE-DIVISION}
then do:
assign vcMessage = trim(substitute(#T-5'The sub-account profile &1 is not of type &2 for customer &3.':200(1680)t-5#,
trim(tqProfileById.tcProfileCode),
trim({&PROFILETYPECODE-DIVISION-TR}),
trim(t_sDebtor.DebtorCode))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-3 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tDebtor.tcDivisionProfileCode':U (icFieldName),
input t_sDebtor.tcDivisionProfileCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDebtor.tc_Rowid (icRowid),
input 'QADFIN-311':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
end.
/*error: if > 0 and exists then should be active*/
if available tqProfileById and
tqProfileById.tcProfileTypeCode = {&PROFILETYPECODE-DIVISION} and
not tqProfileById.tlProfileIsActive
then do:
assign vcMessage = trim(substitute(#T-6'The sub-account profile &1 is not active for customer &2.':200(1681)t-6#,
trim(tqProfileById.tcProfileCode),
trim(t_sDebtor.DebtorCode))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tDebtor.tcDivisionProfileCode':U (icFieldName),
input t_sDebtor.tcDivisionProfileCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDebtor.tc_Rowid (icRowid),
input 'QADFIN-312':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
end.
end.