project QadFinancials > class BProjectStatus > 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/bprojectstatus.p)

<ANCESTOR-CODE>

for each t_sProjectStatus where
         t_sProjectStatus.tc_Status = 'C':U,
    each t_iProjectStatus of t_sProjectStatus where
         t_iProjectStatus.ProjectStatusCode <> t_sProjectStatus.ProjectStatusCode:

    <Q-1 assign vlFcQueryRecordsAvailable = ProjectByProjectStatus (NoCache)
       (input ?, (CompanyId)
        input t_sProjectStatus.ProjectStatus_ID, (ProjectStatusId)
        input ?, (ProjectID)
        input ?, (ProjectCode)) in BProject >

    if vlFcQueryRecordsAvailable <> false
    then do:
        assign oiReturnStatus = -1.

        <M-2 run SetMessage
           (input  trim(#T-3'You cannot modify the (&1). The project status is already in use.':255(3437)t-3#) (icMessage), 
            input  t_sProjectStatus.ProjectStatusCode (icArguments), 
            input  'tProjectStatus.ProjectStatusCode':U (icFieldName), 
            input  t_sProjectStatus.ProjectStatusCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sProjectStatus.tc_Rowid (icRowid), 
            input  'QADFIN-1512':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BProjectStatus>
    end.
end.