project QadFinancials > class BUserRole > method CreateUsrRoleFromRoleCIApproveRole


Parameters


tExtUsrRoleinputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BRole.ApiCreateCIApproveRole


program code (program1/buserrole.p)

If oiReturnStatus = 0 
Then Assign oiReturnStatus = -98.

If Not Can-find(First tExtUsrRole)
Then Do: 
    Assign oiReturnStatus = 0. 
    Return.
End.

<M-2 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BUserRole>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0 
Then Return.

For Each tExtUsrRole:

    <M-3 run AddDetailLine (input  'UsrRole':U (icTable), 
                        input  ? (icParentRowid), 
                        output viFcReturnSuper (oiReturnStatus)) in BUserRole>   
    if viFcReturnSuper <> 0
    then do:
        assign vcMessage = trim(substitute(#T-1'Cannot create a record for table &1.':200(3646)t-1#, trim('UsrRole':U) ))
               oiReturnStatus = -3.
        <M-4 run SetMessage (input  vcMessage (icMessage), 
                     input  '':U (icArguments), 
                     input  '':U (icFieldName), 
                     input  '':U (icFieldValue), 
                     input  'S':U (icType), 
                     input  3 (iiSeverity), 
                     input  '':U (icRowid), 
                     input  'QadFin-4951':U (icFcMsgNumber), 
                     input  '':U (icFcExplanation), 
                     input  '':U (icFcIdentification), 
                     input  '':U (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BUserRole>            
        return.
    end.

    assign tUsrRole.tcUsrLogin               = tExtUsrRole.tcUsrLogin
           tUsrRole.tcRoleName               = tExtUsrRole.tcRoleName
           tUsrRole.UsrRoleIsDefaultRole     = false.

End. /*For Each tExtUsrRole:*/

<M-5 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BUserRole>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0 
Then Return.

<M-6 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BUserRole>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0 
Then Return.

<M-7 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BUserRole>
If viFcReturnSuper <> 0
Then Assign oiReturnStatus = viFcReturnSuper.
If viFcReturnSuper < 0 
Then Return.

If oiReturnStatus = -98
Then Assign oiReturnStatus = 0.