Wednesday 20 May 2015

Display Stack Trace Based on Current user

Related to Info logs get user call stack.. and limit it


Classes\Info\add -  at end before Return Statmenet.

 container   callStack;
    int         counter;

    // To display the stack trace based on current user
    if(SysUserInfo::find(curUserId()).StackTrace == NoYes::Yes)
    {
        callStack = xSession::xppCallStack();
        _txt += '\n';
        for(counter = 1; counter <= conlen(callStack); counter++)
        {
            _txt += conpeek(callStack, counter);
            if((counter mod 2) == 0)
            {
                _txt += '\n';
            }
            else
            {
               _txt += ' ';
            }
        }
    }
  
Classes Info\CloseInfoDeleayed

if (this.browser() != null && this.browser().canClose())


Classes info\View Build

int                  infoLogLimit;

 // To display the stack trace based on current user
    /* if (enum.length() > #maxerrors)
      {
        enum.delete(#maxerrors);
        enum.add(Exception::Warning, strfmt("@SYS86217", #maxerrors));
      }*/
    infoLogLimit = Sysuserinfo::find(curUserId()).ErrorLimit;

    if(infoLogLimit == 0)
    {
        infoLogLimit = #maxerrors;
    }

    if (enum.length() > infoLogLimit)
    {
        enum.delete(infoLogLimit);
enum.add(Exception::Warning, strfmt("@SYS86217", infoLogLimit));
      }

Before startLengthyOperation();
        

Monday 18 May 2015

Reservation - Qty for a salesline

Reserve quantity for a salesline can be retrieved from Invent Transactions.

Real ReserveQty;


_salesline  =   SalesLine::findRecId(_salesparmline.SalesLineRecId);
                _inventtransorigin  =  InventTransOrigin::findByInventTransId(_salesline.InventTransId);
                select _inventTrans where _inventTrans.InventTransOrigin   ==  _inventtransorigin.RecId
                    && _inventTrans.StatusIssue ==  StatusIssue::ReservOrdered;
              ReserveQty = _inventTrans.Qty