project QadFinancials > class BPosting > method ValidateComponent

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


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bposting.p)

    


/* ======================================================================================================= */
/* Stop possible earlier (in the previous run) started external classes to make sure we start from scratch */
/* ======================================================================================================= */
<M-82 run StopExternalInstances
   (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.

/* If there were automatically created Auto-balance posting line during previous try of Save, remove them */
<M-3 run ValidateComponentPreClearAutoBalAndRounding  (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.


/* If the posting is an auto reversal */
if can-find(first t_sPosting where 
                  t_sPosting.PostingIsAutoReversal = true)
then do:
   <M-86 run ValidateComponentReversingPosting  (output viFcReturnSuper (oiReturnStatus)) in BPosting> 
   if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
   if viFcReturnSuper < 0 then Return.
end.

/* Validations before ANCESTOR tag */
<M-84 run ValidateComponentPre  (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.
        


<ANCESTOR-CODE>
if oiReturnStatus < 0
then return.

       
<M-85 run ValidateComponentPost  (output viFcReturnSuper (oiReturnStatus)) in BPosting>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.