IDEMPIERE-5093 Scheduler cron pattern scheduling is always using server time zone (#1300)
Fix unit test failure
This commit is contained in:
parent
13b37c4acc
commit
321a65bd66
|
@ -105,8 +105,11 @@ public class MAcctProcessor extends X_C_AcctProcessor
|
||||||
protected boolean beforeSave(boolean newRecord)
|
protected boolean beforeSave(boolean newRecord)
|
||||||
{
|
{
|
||||||
if (newRecord || is_ValueChanged("AD_Schedule_ID")) {
|
if (newRecord || is_ValueChanged("AD_Schedule_ID")) {
|
||||||
|
MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID());
|
||||||
|
if (clientInfo == null)
|
||||||
|
clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||||
long nextWork = MSchedule.getNextRunMS(System.currentTimeMillis(), getScheduleType(), getFrequencyType(), getFrequency(), getCronPattern(),
|
long nextWork = MSchedule.getNextRunMS(System.currentTimeMillis(), getScheduleType(), getFrequencyType(), getFrequency(), getCronPattern(),
|
||||||
MClientInfo.get(getCtx(), getAD_Client_ID()).getTimeZone());
|
clientInfo.getTimeZone());
|
||||||
if (nextWork > 0)
|
if (nextWork > 0)
|
||||||
setDateNextRun(new Timestamp(nextWork));
|
setDateNextRun(new Timestamp(nextWork));
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,8 +242,11 @@ public class MRequestProcessor extends X_R_RequestProcessor
|
||||||
protected boolean beforeSave(boolean newRecord)
|
protected boolean beforeSave(boolean newRecord)
|
||||||
{
|
{
|
||||||
if (newRecord || is_ValueChanged("AD_Schedule_ID")) {
|
if (newRecord || is_ValueChanged("AD_Schedule_ID")) {
|
||||||
|
MClientInfo clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID());
|
||||||
|
if (clientInfo == null)
|
||||||
|
clientInfo = MClientInfo.get(getCtx(), getAD_Client_ID(), get_TrxName());
|
||||||
long nextWork = MSchedule.getNextRunMS(System.currentTimeMillis(), getScheduleType(), getFrequencyType(), getFrequency(), getCronPattern(),
|
long nextWork = MSchedule.getNextRunMS(System.currentTimeMillis(), getScheduleType(), getFrequencyType(), getFrequency(), getCronPattern(),
|
||||||
MClientInfo.get(getCtx(), getAD_Client_ID()).getTimeZone());
|
clientInfo.getTimeZone());
|
||||||
if (nextWork > 0)
|
if (nextWork > 0)
|
||||||
setDateNextRun(new Timestamp(nextWork));
|
setDateNextRun(new Timestamp(nextWork));
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class MSchedulerTest extends AbstractTestCase {
|
||||||
cal1.setTimeZone(tz1);
|
cal1.setTimeZone(tz1);
|
||||||
cal1.setTimeInMillis(System.currentTimeMillis());
|
cal1.setTimeInMillis(System.currentTimeMillis());
|
||||||
int hour = cal1.get(Calendar.HOUR_OF_DAY);
|
int hour = cal1.get(Calendar.HOUR_OF_DAY);
|
||||||
if (hour > 17) {
|
if (hour >= 17) {
|
||||||
cal1.add(Calendar.DAY_OF_MONTH, 1);
|
cal1.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
}
|
}
|
||||||
cal1.set(Calendar.HOUR_OF_DAY, 17);
|
cal1.set(Calendar.HOUR_OF_DAY, 17);
|
||||||
|
|
Loading…
Reference in New Issue