IDEMPIERE-5093 Scheduler cron pattern scheduling is always using server time zone (#1300)

Fix unit test failure
This commit is contained in:
hengsin 2022-04-23 17:50:56 +08:00 committed by GitHub
parent 13b37c4acc
commit 321a65bd66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -105,8 +105,11 @@ public class MAcctProcessor extends X_C_AcctProcessor
protected boolean beforeSave(boolean newRecord)
{
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(),
MClientInfo.get(getCtx(), getAD_Client_ID()).getTimeZone());
clientInfo.getTimeZone());
if (nextWork > 0)
setDateNextRun(new Timestamp(nextWork));
}

View File

@ -242,8 +242,11 @@ public class MRequestProcessor extends X_R_RequestProcessor
protected boolean beforeSave(boolean newRecord)
{
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(),
MClientInfo.get(getCtx(), getAD_Client_ID()).getTimeZone());
clientInfo.getTimeZone());
if (nextWork > 0)
setDateNextRun(new Timestamp(nextWork));
}

View File

@ -79,7 +79,7 @@ public class MSchedulerTest extends AbstractTestCase {
cal1.setTimeZone(tz1);
cal1.setTimeInMillis(System.currentTimeMillis());
int hour = cal1.get(Calendar.HOUR_OF_DAY);
if (hour > 17) {
if (hour >= 17) {
cal1.add(Calendar.DAY_OF_MONTH, 1);
}
cal1.set(Calendar.HOUR_OF_DAY, 17);