project BLF > class BResource > method CreateResource

Description

temporairy solution


Parameters


tResourcesInputinputtemp-table
ocResourceIdsoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BBusinessComponent.AdditionalUpdates

QadFinancials
method BBusinessComponent.ApiSynchronise


program code (program1/bresource.p)

for each tResourcesInput:
    vcFreeForm   = (if vcFreeForm = ""
                    then "for each Resources where "
                    else vcFreeForm + " or ")
                 + "Resources.ResourceURI = '" + tResourcesInput.ResourceURI + "'".
    viInputCount = viInputCount + 1.
    if viInputCount > 50
    then do:
        vcFreeForm = "".
        leave.
    end.
end.
if viInputCount = 0
then return.

<M-11 run DataLoad
   (input  '' (icRowids), 
    input  '' (icPkeys), 
    input  '' (icObjectIds), 
    input  vcFreeForm (icFreeform), 
    input  no (ilKeepPrevious), 
    output viFcReturnSuper (oiReturnStatus)) in BResource>
if viFcReturnSuper = -4
then viFcReturnSuper = 0.
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

for each tResourcesInput on error undo, throw:

    find first tResources where tResources.ResourceURI = tResourcesInput.ResourceURI no-error.
    if not available tResources
    then do:
        if tResourcesInput.tc_Status = "D"
        then next.

        <M-6 run AddDetailLine
           (input  'Resources' (icTable), 
            input  ? (icParentRowid), 
            output viFcReturnSuper (oiReturnStatus)) in BResource>
        if viFcReturnSuper <> 0
        then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
    end.

    if tResourcesInput.tc_Status = "D"
    then assign tResources.tc_Status = "D".
    else do:
        buffer-copy tResourcesInput 
             except Resource_ID
                    LastModifiedDate
                    LastModifiedTime
                    LastModifiedUser
                    tc_ParentRowid
                    tc_Rowid
                    tc_Status
                 to tResources.

        if tResources.tc_Status = ""
        then assign tResources.tc_Status = "C".
    end.
    
    if ocResourceIds <> ""
    then assign ocResourceIds = ocResourceIds + ",".

    assign ocResourceIds = ocResourceIds + string(tResources.Resource_ID).
end.

<M-3 run ValidateBC  (output viFcReturnSuper (oiReturnStatus)) in BResource>

if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.

if viFcReturnSuper < 0
then return.

<M-4 run AdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BResource>

if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.

if viFcReturnSuper < 0
then return.

<M-5 run DataSave  (output viFcReturnSuper (oiReturnStatus)) in BResource>

if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.

if viFcReturnSuper < 0
then return.