IDEMPIERE-3675:Create new AD_Session Record for Scheduler run. (#193)
Co-authored-by: Deepak Pansheriya <deepakpansheriya@gmail.com>
This commit is contained in:
parent
937eaaa6ce
commit
5af5ee2b90
|
@ -42,6 +42,7 @@ import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MScheduler;
|
import org.compiere.model.MScheduler;
|
||||||
import org.compiere.model.MSchedulerLog;
|
import org.compiere.model.MSchedulerLog;
|
||||||
import org.compiere.model.MSchedulerPara;
|
import org.compiere.model.MSchedulerPara;
|
||||||
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.print.MPrintFormat;
|
import org.compiere.print.MPrintFormat;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -117,6 +118,8 @@ public class Scheduler extends AdempiereServer
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
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);
|
MProcess process = new MProcess(getCtx(), scheduler.getAD_Process_ID(), null);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -136,6 +139,9 @@ public class Scheduler extends AdempiereServer
|
||||||
{
|
{
|
||||||
if (m_trx != null)
|
if (m_trx != null)
|
||||||
m_trx.close();
|
m_trx.close();
|
||||||
|
|
||||||
|
session.logout();
|
||||||
|
getCtx().remove("#AD_Session_ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue