project BLF > class BNumber > method CommitNumber

Description

Commit a previously claimed number.
This method must be called inside the transaction that creates the object that is identified by this number.


Parameters


iiCompanyIDinputintegerEntity ID
iiNumbrYearinputintegerNumbrYear
icNumbrTypeinputcharacterNumbrType
iiNumbrinputintegerNumbr
iiInstanceIdinputinteger
icClassNameinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBill.PostSave
method BCCollection.PostSave
method BCDocument.PostSave
method BCInvoice.PostSave
method BDCollection.PostSave
method BDDocument.PostSave
method BDInvoice.PostSave
method BDomainProperty.ValidateComponentPostNumbers
method BExpenseNote.PostSave
method BFixedAssetAsset.PostSave
method BPosting.PostSave
method BRevaluation.PostSave
method BWithholdingTax.PostSave


program code (program1/bnumber.p)

if oiReturnStatus = 0
then oiReturnStatus = -98.

assign vcWhere = "for each Numbr where Numbr.Company_ID = ":U + string(iiCompanyId)
               + " and Numbr.NumbrYear = ":U + string(iiNumbrYear)
               + " and Numbr.NumbrType = '":U + icNumbrType
               + "' and Numbr.Numbr = ":U + string(iiNumbr).

<M-1 run StartPersistence
   (output vhFcComponent (ohPersistence), 
    output viFcReturnSuper (oiReturnStatus)) in BNumber>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-4 run DeleteNumber
   (input  iiInstanceId (iiInstanceId), 
    input  icClassName (icClassName), 
    input  string(iiCompanyId) + ',' + string(iiNumbrYear) + ',' + icNumbrType + ',' + string(iiNumbr) (icNumberData)) in persistence>

<M-3 run WriteDirect
       (input  'Numbr':U (icTableName), 
        input  vcWhere (icPrepare), 
        input  '' (icFieldList), 
        input  '' (icFieldListDataTypes), 
        input  '' (icAbsolute), 
        input  '' (icIncremental), 
        input  {&TARGETPROCEDURE} (ihClass), 
        input  vcUserLogin (icUserLogin), 
        output viFcReturnSuper (oiReturnStatus)) in persistence>

/* allow multiple commit of the same number */
if viFcReturnSuper = -4
then viFcReturnSuper = 0.

if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

if oiReturnStatus = -98
then oiReturnStatus = 0.