project BLF > class BEventConfig > 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/beventconfig.p)

<ANCESTOR-CODE>
    
    /* ========================================================================= */
    /* Check; in case AllUpdates=true then Status should be empty and vice-versa */
    /* ========================================================================= */
    for each t_sEventConfig where 
             t_sEventConfig.tc_Status = "C":U or 
             t_sEventConfig.tc_Status = "N":U on error undo, throw:

        if  t_sEventConfig.tlSuppressEmptyFields   = yes
        and t_sEventConfig.tlSuppressDefaultFields = yes
        then do:
            vcMessage = #T-80'Options 'Suppress empty values' and 'suppress default values' cannot both be enabled.':255(147250783)T-80#.
            oiReturnStatus = -1.
            <M-27 run SetMessage
               (input  vcMessage (icMessage), 
                input  '' (icArguments), 
                input  'tEventConfig.tlSuppressEmptyFields' (icFieldName), 
                input  'true' (icFieldValue), 
                input  'E' (icType), 
                input  3 (iiSeverity), 
                input  t_sEventConfig.tc_Rowid (icRowid), 
                input  'blf-775052':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BEventConfig>
        end.
        else
        if  t_sEventConfig.tlSuppressEmptyFields   = yes
        and t_sEventConfig.tlSuppressDefaultFields = no
        then t_sEventConfig.EventConfigSuppressEmpty = yes.
        else
        if  t_sEventConfig.tlSuppressEmptyFields   = no
        and t_sEventConfig.tlSuppressDefaultFields = yes
        then t_sEventConfig.EventConfigSuppressEmpty = ?.
        else t_sEventConfig.EventConfigSuppressEmpty = no.

        assign vcMessage = "":U.
        if t_sEventConfig.EventConfigAllUpdates  = true and 
           t_sEventConfig.EventConfigStatusValue <> "":U and 
           t_sEventConfig.EventConfigStatusValue <> ?   
        then assign vcMessage = trim(substitute(#T-2'If '&1' is turned on, '&2' cannot be specified.':255(419)T-2#,trim(#T-3'Publish Any Update':23(7186)T-3#),trim(#T-4'Object Status':20(7849)T-4#))).
        else 
            if t_sEventConfig.EventConfigAllUpdates  = false and 
               (t_sEventConfig.EventConfigStatusValue = "":U or
                t_sEventConfig.EventConfigStatusValue = ?)   
            then assign vcMessage = trim(substitute(#T-5'If '&1' is deactivated, you must specify '&2'.':255(422)T-5#,trim(#T-6'Publish Any Update':23(7186)T-6#),trim(#T-7'Object Status':20(7849)T-7#))).
        if vcMessage <> "":U
        then do :
            assign oiReturnStatus = -1.
            <M-1 run SetMessage (input  vcMessage (icMessage), 
                     input  '':U (icArguments), 
                     input  't_sEventConfig.EventConfigStatusValue':U (icFieldName), 
                     input  t_sEventConfig.EventConfigStatusValue (icFieldValue), 
                     input  'E':U (icType), 
                     input  3 (iiSeverity), 
                     input  t_sEventConfig.tc_Rowid (icRowid), 
                     input  'BLF-83':U (icFcMsgNumber), 
                     input  '' (icFcExplanation), 
                     input  '' (icFcIdentification), 
                     input  '' (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BEventConfig>
        end. /* if vcMessage <> "":U */
    end. /* for each */