project QadFinancials > class BDInvoice > 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/bdinvoice.p)

/*stop the instance of bqdinvoicemovement so that if there are warnings during invoice save the movement records are not duplicated*/
if viBQDInvoiceMovementID <> 0 and
   viBQDInvoiceMovementID <> ?
then do:
    <I-71 {bFcStopInstance
         &CLASS           = "BQDInvoiceMovement"}>      
end. /*IF  viBQDInvoiceMovementID <> 0*/      



/* ============================================================== */
/* staged pc  / assign t_sDInvoice.Period_ID                      */
/* give some db fields the right value based on calculated fields */
/* give cc amounts of DInvoicevat the right value                 */
/* give the total fields the right value                          */
/* give the id's the right values                                 */
/* ============================================================== */
<M-48 run ValidateComponentPre (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.

/* =============================================================================================================== */
/* Call a submethod that updates DInvoiceDIText to YYYY/Daybook/Voucher                                            */
/* =============================================================================================================== */
<M-10 run ValidateComponentDInvoiceDIText  (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.

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




/* ====================== */
/* some extra validations */
/* checks for bank number */
/* checks on modify       */
/* ====================== */
<M-49 run ValidateComponentAll (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.