project QadFinancials > class BMfgCustomer > 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/bmfgcustomer.p)

<M-2 run StopExternalInstances
   (output viFcReturnSuper (oiReturnStatus)) in BMfgCustomer>

/* =================================================================================== */
/* In case we only have new records we do not want to check the uniqueness of indexes  */
/* as this can cause a performane issue especially in cases where customers are loaded */
/* by xls and there is a lot to replicate                                              */
/* Therefore we set the tcStatus to blank temporary and oid to ?                       */
/* This way we do not skip the ancestor code but only skip the checks on uniqueness    */
/* =================================================================================== */
assign vlReset = no.
if not can-find (first t_scm_mstr where 
                       t_scm_mstr.tc_Status <> 'N')
then do:
    assign vlReset = yes.
    for each t_scm_mstr where
             t_scm_mstr.tc_Status = 'N' :
           
        assign t_scm_mstr.cm__qadd01  = t_scm_mstr.oid_cm_mstr
               t_scm_mstr.oid_cm_mstr = ?
               t_scm_mstr.tc_Status = ''.
    end.
end.

<ANCESTOR-CODE>

if vlReset
then do:
    for each t_scm_mstr where
             t_scm_mstr.tc_Status = '' :
        assign t_scm_mstr.tc_Status = 'N'
               t_scm_mstr.oid_cm_mstr = t_scm_mstr.cm__qadd01
               t_scm_mstr.cm__qadd01 = 0.
    end.
end. /* vlReset */