project QadFinancials > class BJournalGroup > 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/bjournalgroup.p)

<ANCESTOR-CODE>


/* If this is the first journal group to be created then from this point journal groups will be mandatory for journsls
 being created.  For this reason we want to verify that the user is aware of this */

<Q-4 assign vlFcQueryRecordsAvailable = JournalGroupByCodeByID (NoCache)
    (input ?, (JournalGroupCode)
     input ?, (JournalGroupId)
     input true, (JournalGroupIsActive)
     input viCompanyID, (CompanyId)) in BJournalGroup >

assign vlJournalGroupsExists = if vlFcQueryRecordsAvailable <> false then true else false.
    
for each t_sJournalGroup
    where t_sJournalGroup.tc_status = "N":U:
          
     if not vlJournalGroupsExists
     then do:
        assign vcMessageText  = trim(#T-2'Creating a Daybook Group will make Daybook Groups mandatory in all domains that use this Daybook Shared Set.  Do you wish to continue?':255(999890762)T-2#)
               oiReturnStatus = 1.
        <M-3 run SetMessage
           (input  vcMessageText (icMessage), 
            input  '' (icArguments), 
            input  '' (icFieldName), 
            input  '' (icFieldValue), 
            input  'W' (icType), 
            input  3 (iiSeverity), 
            input  t_sJournalGroup.tc_rowid (icRowid), 
            input  'QadFin-9274':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalGroup>
            return.
       end.

end.