project BLF > class BUser > method AdditionalUpdates

Description

This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.


Parameters


oiReturnStatusoutputinteger


Internal usage


BLF
method BUser.ApiSaveUserDomainEntityAccess
method BUser.ApiSynchronise
method BUser.LinkCompanyToDaemonUsers


program code (program/buser.p)

<ANCESTOR-CODE>


/* ================================================================= */
/* When deleting a user also delete all related violations.          */
/* This cannot be done with a cascaded delete in the data model as   */
/* this delete must also trigger a create in the SODLog table.       */
/* ================================================================= */
if can-find (first tUsr where tUsr.tc_Status = "D")
then do:
    <Q-9 assign vlFcQueryRecordsAvailable = SystSODActive (NoCache)  () in BSystem >
    if vlFcQueryRecordsAvailable
    then do:
        <I-1 {bFcAddToTransaction
             &CLASS           = "BSODViolationRule2"}>
        
        for each tUsr where tUsr.tc_Status = "D" on error undo, throw:
            <M-8 run DeleteByUserRoleCompanyCategory
               (input  tUsr.Usr_ID (iiUsrID), 
                input  0 (iiRoleID), 
                input  0 (iiDomainID), 
                input  0 (iiCompanyID), 
                input  0 (iiSODCategory1ID), 
                input  0 (iiSODCategory2ID), 
                output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule2>
            if viFcReturnSuper = -4
            then viFcReturnSuper = 0.
            else vlDeletesDone = yes.
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then do:
                <M-3 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BUser>
                return.
            end.
        end.
    
        if vlDeletesDone
        then do:
            <M-4 run DeleteFinish  (output viFcReturnSuper (oiReturnStatus)) in BSODViolationRule2>
            if viFcReturnSuper <> 0
            then oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then do:
                <M-5 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BUser>
                return.
            end.
            <I-6 {bFcCloseInstance
                 &CLASS           = "BSODViolationRule2"}>
        end.
        else do:
            <I-7 {bFcCloseAndStopInstance
                 &CLASS           = "BSODViolationRule2"}>
        end.
    end.
end.