project QadFinancials > class BAPMatching > 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/bapmatching.p)

  
    /* ============================================================================== */
    /* Set default return-status                                                      */
    /* ============================================================================== */
    assign oiReturnStatus = -98.
    
    /* ============================================================================== */
    /* Start with a clear instance: call method StopExternalInstances                 */
    /* ============================================================================== */
    <M-4 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    if viFcReturnSuper <> 0
    then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then Return.
    
    /* ==================================================================================== */
    /* Call a submethod that will do some auto-assignments for a bunch of redundant fields  */ 
    /* ==================================================================================== */
    <M-3 run ValidateComponentPre  (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    if viFcReturnSuper <> 0
    then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then Return.
    
    /* ============================================================================== */
    /* Set return-status = OK                                                         */
    /* ============================================================================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.
    
    
<ANCESTOR-CODE>

    /* ============================================================================== */
    /* Return in case the ancestor caused errors because the submethods expect the    */
    /* ID-fields to be assigned (and this is not so in case some errors occured)      */
    /* ============================================================================== */
    /* Set default return-status                                                      */
    /* ============================================================================== */
    If oiReturnStatus < 0 
    then Return.
    If oiReturnStatus = 0 /* needed to catch previous warnings */
    then assign oiReturnStatus = -98.
    
    /* ============================================================================== */
    /* Run validations after the ancestor-code: now all IDs are filled                */
    /* ============================================================================== */
    <M-1 run ValidateComponentPost (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    if viFcReturnSuper <> 0
    then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then Return.
    
    /* ============================================================================== */
    /* Set return-status = OK                                                         */
    /* ============================================================================== */
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.