Hi,
I am trying to update CustTable with a credit limit from a CSV-file without any luck.
The check for the credit limit with the recalculation popup doesn't return the control and my batch job class stops.
Besides I don't get the popup at all like I did when using ttsbegin/ttscommit.
Also is it possible from my class (always, either run manually or in a batch) to NOT get the popup?
Does anyone know how the log works also, if I show something in the infolog will it be added to the job history?
This is my code. What is wrong?
//try
//{
//ttsbegin;
record = importFile.read();
while(importFile.status() == IO_Status::Ok)
{
record = importFile.read();
if(!record)
break;
custTable.clear();
custAccountNum = conPeek(record,2);
custTable = CustTable::find(custAccountNum,true);
if(custTable)
{
info(strFmt("Customer: %1", custTable.name()));
custCreditLimit = conPeek(record,4);
if(custTable.CreditMax != custCreditLimit) //Check Credit Limit
{
custTable.VATNum = conPeek(record,3);
custTable.CreditMax = custCreditLimit;
this.parmCreditLimit(custTable);
insDateTime = str2datetime(conPeek(record,5) ,321);
updDateTime = str2datetime(conPeek(record,6) ,321);
custTable.update();
}
}
else
{
info("Customer not found");
}
}
//ttscommit;
//}
//catch(Exception::Error)
//{
//Throw(Exception::Error);
//}
public void parmCreditLimit(CustTable _custTable)
{
MenuFunction salesCreditLimitCheck;
Args args;
CustCreditLimit custCreditLimit;
// CustCreditLimit custCreditLimit = new CustCreditLimit(CustTable::find(_custTable.AccountNum));
custCreditLimit = CustCreditLimit::construct(_custTable);
if (custCreditLimit.shouldCheckCreditAvailable() &&
_custTable.existOpenOrders())
{
//Updating estimated value for open sales orders related to the customer.
args = new Args();
args.parm(_custTable.AccountNum);
salesCreditLimitCheck = new MenuFunction(menuitemActionStr(salesCreditLimitCheck), MenuItemType::Action);
if (salesCreditLimitCheck.checkAccessRights())
{
salesCreditLimitCheck.run(args);
}
}
}
Regards Fredrik.