project QadFinancials > class BCOAMaskCC > method ValidateComponentPre

validation procedure

Description

This method does validation before ancestor code


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCOAMaskCC.ValidateComponent


program code (program7/bcoamaskcc.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

MAIN_BLOCK:
do on error undo, return:
    /* get GLSharedSet_ID DivSharedSet_ID of current domain */
    <I-7 {bFcOpenInstance
         &CLASS           = "Session"}>
         
    <M-5 run GetIntegerValue
        (input  'SharedSetForGL':U (icName), 
         output viGLSharedSetID (oiValue), 
         output viFcReturnSuper (oiReturnStatus)) in Session>
    if viFcReturnSuper <  0 or (viFcReturnSuper > 0 and viLocalReturnStatus = 0)
    then assign viLocalReturnStatus = viFcReturnSuper.
    
    <M-10 run GetIntegerValue
       (input  'SharedSetForDIVISION':U (icName), 
        output viDivSharedSetID (oiValue), 
        output viFcReturnSuper (oiReturnStatus)) in Session>
    if viFcReturnSuper <  0 or (viFcReturnSuper > 0 and viLocalReturnStatus = 0)
    then assign viLocalReturnStatus = viFcReturnSuper.

    <I-18 {bFcCloseInstance
         &CLASS           = "Session"}>
    
    if viFcReturnSuper < 0 or viLocalReturnStatus < 0 then leave MAIN_BLOCK.
    
    /* ========================================================================== */
    /* when there is no any range, one default all range is automatically created */
    /* ========================================================================== */
    for each t_sCOAMaskCC where
             t_sCOAMaskCC.tc_Status <> "D":U:

        if not can-find(first t_sCOAMaskCCGL where
                              t_sCOAMaskCCGL.tc_Status       <> "D":U                  and
                              t_sCOAMaskCCGL.tc_ParentRowid   =  t_sCOAMaskCC.tc_Rowid and
                              t_sCOAMaskCCGL.GLSharedSet_ID   =  viGLSharedSetID       and
                              t_sCOAMaskCCGL.COAMaskCCGLIsNeg = false)
        then do:
            <M-17 run AddDetailLine
               (input  'COAMaskCCGL':U (icTable), 
                input  t_sCOAMaskCC.tc_Rowid (icParentRowid), 
                output viFcReturnSuper (oiReturnStatus)) in BCOAMaskCC>
            if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and viLocalReturnStatus = 0)
            then assign viLocalReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0 then leave MAIN_BLOCK.

            create t_sCOAMaskCCGL.
            buffer-copy tCOAMaskCCGL to t_sCOAMaskCCGL.
    
            assign t_sCOAMaskCCGL.COAMaskCCGLIsNeg = false
                   t_sCOAMaskCCGL.GLSharedSet_ID   = viGLSharedSetID.
        end. /* if not available t_sCOAMaskCCGL */

        if not can-find(first t_sCOAMaskCCDiv where
                              t_sCOAMaskCCDiv.tc_Status        <> "D":U                  and
                              t_sCOAMaskCCDiv.tc_ParentRowid    =  t_sCOAMaskCC.tc_Rowid and
                              t_sCOAMaskCCDiv.DivSharedSet_ID   = viDivSharedSetID       and
                              t_sCOAMaskCCDiv.COAMaskCCDivIsNeg = false)
        then do:
            <M-19 run AddDetailLine
               (input  'COAMaskCCDiv':U (icTable), 
                input  t_sCOAMaskCC.tc_Rowid (icParentRowid), 
                output viFcReturnSuper (oiReturnStatus)) in BCOAMaskCC>
            if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and viLocalReturnStatus = 0)
            then assign viLocalReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0 then leave MAIN_BLOCK.
    
            create t_sCOAMaskCCDiv.
            buffer-copy tCOAMaskCCDiv to t_sCOAMaskCCDiv.
            
            assign t_sCOAMaskCCDiv.COAMaskCCDivIsNeg = false
                   t_sCOAMaskCCDiv.DivSharedSet_ID   = viDivSharedSetID.
        end. /* if not available t_sCOAMaskCCDiv */
    end. /* for each t_sCOAMaskCC where */
end. /* MAIN_BLOCK */

/* ================================================================================ */
/* Range of a different GLSharedSet_ID cannot be created/modified in current domain */
/* ================================================================================ */
for each t_sCOAMaskCC where
         t_sCOAMaskCC.tc_Status <> "D":U:
    
    if can-find( first t_sCOAMaskCCGL where
                       t_sCOAMaskCCGL.tc_ParentRowid  = t_sCOAMaskCC.tc_Rowid and
                       t_sCOAMaskCCGL.GLSharedSet_ID <> viGLSharedSetID         and
                       t_sCOAMaskCCGL.tc_Status      <> "":U )
    then do:
        <M-11 run SetMessage
           (input  #T-12'It  is not allowed to create or modify a GL range which contains a different GL SharedSet from current domain.':255(999890760)T-12# (icMessage), 
            input  '':U (icArguments), 
            input  'tCOAMaskCC.COAMaskCCCode':U (icFieldName), 
            input  t_sCOAMaskCC.COAMaskCCCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sCOAMaskCC.tc_Rowid (icRowid), 
            input  'QadFin-9282':U (icFcMsgNumber), 
            input  #T-13'It  is not allowed to create or modify a GL range which contains a different GL SharedSet from current domain.':255(999890760)T-13# (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCOAMaskCC>
        assign viLocalReturnStatus = -1.
    end. /* if can-find( first t_sCOAMaskCCGL where */

    if can-find( first t_sCOAMaskCCDiv where
                       t_sCOAMaskCCDiv.tc_ParentRowid   = t_sCOAMaskCC.tc_Rowid and
                       t_sCOAMaskCCDiv.DivSharedSet_ID <> viDivSharedSetID      and
                       t_sCOAMaskCCDiv.tc_Status       <> "":U )
    then do:
        <M-14 run SetMessage
           (input  #T-15'It  is not allowed to create or modify a Sub-Account range which contains a different Sub-Account SharedSet from current domain.':255(999890766)T-15# (icMessage), 
            input  '':U (icArguments), 
            input  'tCOAMaskCC.COAMaskCCCode':U (icFieldName), 
            input  t_sCOAMaskCC.COAMaskCCCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sCOAMaskCC.tc_Rowid (icRowid), 
            input  'QadFin-9284':U (icFcMsgNumber), 
            input  #T-16'It  is not allowed to create or modify a Sub-Account range which contains a different Sub-Account SharedSet from current domain.':255(999890766)T-16# (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCOAMaskCC>
        assign viLocalReturnStatus = -1.
    end. /* for each t_sCOAMaskCCDiv where */
end. /* for each t_sCOAMaskCC where */

/* assign blank values to real blank "" from ? */
for each t_sCOAMaskCC where 
         t_sCOAMaskCC.tc_Status <> "D":U:
    for each t_sCOAMaskCCGL where
             t_sCOAMaskCCGL.tc_Status <> "D":U and
             t_sCOAMaskCCGL.tc_ParentRowid = t_sCOAMaskCC.tc_Rowid:
        if t_sCOAMaskCCGL.COAMaskCCGLFrom = ?
        then assign t_sCOAMaskCCGL.COAMaskCCGLFrom = "":U.
        if t_sCOAMaskCCGL.COAMaskCCGLTo = ?
        then assign t_sCOAMaskCCGL.COAMaskCCGLTo = "":U.
    end. /* for each t_sCOAMaskCCGL where */

    for each t_sCOAMaskCCDiv where
             t_sCOAMaskCCDiv.tc_Status <> "D":U and
             t_sCOAMaskCCDiv.tc_ParentRowid = t_sCOAMaskCC.tc_Rowid:
        if t_sCOAMaskCCDiv.COAMaskCCDivFrom = ?
        then assign t_sCOAMaskCCDiv.COAMaskCCDivFrom = "":U.
        if t_sCOAMaskCCDiv.COAMaskCCDivTo = ?
        then assign t_sCOAMaskCCDiv.COAMaskCCDivTo = "":U.
    end. /* for each t_sCOAMaskCCDiv where */
end. /* for each t_sCOAMaskCC where */

assign oiReturnStatus = viLocalReturnStatus.