project QadFinancials > class BDebtor > method ValBusinessRelation

Description

Validates the Business Relation of the Debtor.
This method is run from PreValidateComponent, thus all the relevant data can be found in t_s tables.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtor.PostValidateComponent


program code (program1/bdebtor.p)

/*error: BusinessRelation must exist - checked by FC*/
/*error: BusinessRelation must be active*/
if t_sDebtor.BusinessRelation_ID <> 0 and 
   t_sDebtor.BusinessRelation_ID <> ? and 
   (t_sDebtor.tc_Status = "N":U or 
    (t_sDebtor.tc_Status = "C" and 
     can-find (t_iDebtor where 
               t_iDebtor.tc_Rowid             = t_sDebtor.tc_Rowid and 
               t_iDebtor.BusinessRelation_ID <> t_sDebtor.BusinessRelation_ID )))
then do:
    <Q-1 run BusinessRelationByIdCode (all) (Read) (NoCache)
       (input t_sDebtor.BusinessRelation_ID, (BusinessRelationId)
        input ?, (BusinessRelationCode)
        output dataset tqBusinessRelationByIdCode) in BBusinessRelation >
    find first tqBusinessRelationByIdCode no-error.
    if available tqBusinessRelationByIdCode and
       not tqBusinessRelationByIdCode.tlBusinessRelationIsActive
    then do:
        assign vcMessage     = trim(substitute(#T-3'The business relation (&1) is not active.':200(1449)T-3#, 
                                                trim(tqBusinessRelationByIdCode.tcBusinessRelationCode))) + chr(10) + 
                               program-name(1)
              oiReturnStatus = -1.
        <M-2 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tDebtor.tcBusinessRelationCode':U (icFieldName),
                     input  t_sDebtor.tcBusinessRelationCode (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  t_sDebtor.tc_Rowid (icRowid),
                     input  'QADFIN-309':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BDebtor>
    end.
end.