project QadFinancials > class BDDocument > 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/bddocument.p)

assign oiReturnStatus = -98
       viLocalReturn  = 0.

MAIN_BLOCK:
do on error undo, leave:

    <M-56 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    if viFcReturnSuper < 0 or viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
    if viFcReturnSuper < 0 then leave MAIN_BLOCK.

    for each t_sDDocumentPostingLine where 
             t_sDDocumentPostingLine.tc_Status = "N":U:
        assign t_sDDocumentPostingLine.tc_Status = "D":U.
    end.
    
    /* Validate component pre */
    <M-43 run ValidateComponentPre  (output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    if viFcReturnSuper < 0 or viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
    if viFcReturnSuper < 0 then leave MAIN_BLOCK.


    assign oiReturnStatus = 0.
    <ANCESTOR-CODE>
    if oiReturnStatus < 0 or viLocalReturn = 0 then assign viLocalReturn = oiReturnStatus.
    assign oiReturnStatus = -98.

    /* Validate component post */
    <M-52 run ValidateComponentPost  (output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    if viFcReturnSuper < 0 or viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.

end. /* MAIN_BLOCK */

/* Error handling */
assign oiReturnStatus = viLocalReturn.