IDEMPIERE-3675:Create new AD_Session Record for Scheduler run. (#193)

Co-authored-by: Deepak Pansheriya <deepakpansheriya@gmail.com>
This commit is contained in:
Carlos Ruiz 2020-07-30 17:17:12 +02:00 committed by GitHub
parent 937eaaa6ce
commit 5af5ee2b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import org.compiere.model.MRole;
import org.compiere.model.MScheduler;
import org.compiere.model.MSchedulerLog;
import org.compiere.model.MSchedulerPara;
import org.compiere.model.MSession;
import org.compiere.model.MUser;
import org.compiere.print.MPrintFormat;
import org.compiere.process.ProcessInfo;
@ -117,6 +118,8 @@ public class Scheduler extends AdempiereServer
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
//Create new Session and set #AD_Session_ID to context
MSession session = MSession.get(getCtx(), true);
MProcess process = new MProcess(getCtx(), scheduler.getAD_Process_ID(), null);
try
{
@ -136,6 +139,9 @@ public class Scheduler extends AdempiereServer
{
if (m_trx != null)
m_trx.close();
session.logout();
getCtx().remove("#AD_Session_ID");
}
//