project QadFinancials > class BEmployee > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bemployee.p)

MAIN_BLOCK:
do on error undo, leave:

    <ANCESTOR-CODE>
    if oiReturnStatus < 0 then leave MAIN_BLOCK.
    
    /* =========================================================================== *
     * Replicate data to operational                                               *
     * =========================================================================== */
    if viBMfgEmployeeID <> 0 and viBMfgEmployeeID <> ?
    then do:
        <I-1 {bFcStartAndOpenInstance
                    &ADD-TO-TRANSACTION = "yes"
                    &CLASS              = "BMfgEmployee"}>
    end.
    else if not valid-handle(vhBMfgEmployeeInst)
    then do:
        <I-50 {bFcOpenInstance
             &CLASS           = "BMfgEmployee"}>
    end.                
    
    <M-88 run ApiReplicateFromFinancials
       (input  tEmployee (tMfgEmployee), 
        input  vlIsKeepInstOpenBEmp (ilIsKeepInstancesOpen), 
        output viFcReturnSuper (oiReturnStatus)) in BMfgEmployee>
    if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
    if oiReturnStatus < 0 then leave MAIN_BLOCK.
    
    
    /*
     * Note that processing of e-mail notifications must occur after any
     * other processing, such as replication to MFG/PRO tables, since
     * e-mails should only be sent if there were not errors encountered
     * (oiReturnStatus >= 0).
     */
    /* Send e-mail notfications */
    <I-10 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "no"
            &CLASS              = "MfgNotification"}>
    for each tEmployee where 
             tEmployee.tc_Status='N':U:
             
        <M-11 run ProcessMfgNotification
           (input  tEmployee.Company_ID (iiComponentCompanyID), 
            input  'EMPLOYEE':U (icComponentType), 
            input  tEmployee.EmployeeCode (icBusinessKeys), 
            output viLocalReturnStatus (oiReturnStatus)) in MfgNotification>
        if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
        if oiReturnStatus < 0 then leave MAIN_BLOCK.
    end.
    
    CATCH eSysError AS Progress.Lang.SysError:
        assign oiReturnStatus = -98.
    END CATCH.
    
    FINALLY:
        /* Close and stop external components */
        if valid-handle(vhMfgNotificationInst)
        then do:
            <I-33 {bFcCloseAndStopInstance
                 &CLASS           = "MfgNotification"}>
        end.
     
        if not vlIsKeepInstOpenBEmp
        then do:
            <M-41 run CloseExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
            if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
        end.
        
        if oiReturnStatus < 0
        then do:
            <M-18 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        end.
    END FINALLY.
end. /* OF MAIN_BLOCK */