diff --git a/org.adempiere.base/src/org/compiere/model/MAcctProcessor.java b/org.adempiere.base/src/org/compiere/model/MAcctProcessor.java index a90eb62da9..ad22956b13 100644 --- a/org.adempiere.base/src/org/compiere/model/MAcctProcessor.java +++ b/org.adempiere.base/src/org/compiere/model/MAcctProcessor.java @@ -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)); } diff --git a/org.adempiere.base/src/org/compiere/model/MRequestProcessor.java b/org.adempiere.base/src/org/compiere/model/MRequestProcessor.java index 201535644e..496993664b 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequestProcessor.java +++ b/org.adempiere.base/src/org/compiere/model/MRequestProcessor.java @@ -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)); } diff --git a/org.idempiere.test/src/org/idempiere/test/model/MSchedulerTest.java b/org.idempiere.test/src/org/idempiere/test/model/MSchedulerTest.java index 5cf069b6b1..fc427196a0 100644 --- a/org.idempiere.test/src/org/idempiere/test/model/MSchedulerTest.java +++ b/org.idempiere.test/src/org/idempiere/test/model/MSchedulerTest.java @@ -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);