project QadFinancials > class BDCollection > 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/bdcollection.p)

/* Assign IsOpen flag:  set to false for bounced, initial, paid and voided document statuses */
assign
    vcClosedStatuses = 
        {&DOCUMENTSTATUS-BOUNCED} + ',':U +
        {&DOCUMENTSTATUS-INIT} + ',':U +
        {&DOCUMENTSTATUS-PAID} + ',':U + 
        {&DOCUMENTSTATUS-VOID}.
for each t_sDCollection where
    t_sDCollection.tc_status='C':U or
    t_sDCollection.tc_status='N':U:
    <Q-2 assign vlFcQueryRecordsAvailable = DDocumentByCollectionID (NoCache)
        (input ?, (CompanyId)
         input t_sDCollection.DCollection_ID, (DCollectionID)
         input ?, (DDocumentID)
         input vcClosedStatuses, (DDocumentStatus)) in BDDocument >
    if(vlFcQueryRecordsAvailable <> false) then
        assign t_sDCollection.DCollectionIsOpen = false.
    else
        assign t_sDCollection.DCollectionIsOpen = true.
end.
<ANCESTOR-CODE>