From 361ae4e8babb4d51e5f7000ea5524af55b211ac3 Mon Sep 17 00:00:00 2001 From: tspc Date: Sun, 4 Oct 2009 13:11:29 +0000 Subject: [PATCH] Integrate Rev:10324,10325 into trunk http://adempiere.svn.sourceforge.net/viewvc/adempiere?view=rev&revision=10324 http://adempiere.svn.sourceforge.net/viewvc/adempiere?view=rev&revision=10325 Fix [2864105] - Initial client setup is throwing errors when creating standa https://sourceforge.net/tracker/?func=detail&aid=2864105&group_id=176962&atid=879332 --- base/src/org/compiere/model/MPeriod.java | 22 +++++++++++++++++----- base/src/org/compiere/model/MYear.java | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/base/src/org/compiere/model/MPeriod.java b/base/src/org/compiere/model/MPeriod.java index 41b9a5a81c..4797a89b01 100644 --- a/base/src/org/compiere/model/MPeriod.java +++ b/base/src/org/compiere/model/MPeriod.java @@ -116,9 +116,21 @@ public class MPeriod extends X_C_Period * @param DateAcct * @param C_Calendar_ID * @return MPeriod + * @deprecated */ - public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, - int C_Calendar_ID) { + public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID) { + return findByCalendar(ctx, DateAcct, C_Calendar_ID, null); + } + + /** + * + * @param ctx + * @param DateAcct + * @param C_Calendar_ID + * @param trxName + * @return MPeriod + */ + public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID, String trxName) { int AD_Client_ID = Env.getAD_Client_ID(ctx); // Search in Cache first @@ -144,7 +156,7 @@ public class MPeriod extends X_C_Period ResultSet rs = null; try { - pstmt = DB.prepareStatement(sql, null); + pstmt = DB.prepareStatement(sql, trxName); pstmt.setInt (1, C_Calendar_ID); pstmt.setTimestamp (2, TimeUtil.getDay(DateAcct)); pstmt.setString(3, "Y"); @@ -152,7 +164,7 @@ public class MPeriod extends X_C_Period rs = pstmt.executeQuery(); while (rs.next()) { - MPeriod period = new MPeriod(ctx, rs, null); + MPeriod period = new MPeriod(ctx, rs, trxName); Integer key = new Integer(period.getC_Period_ID()); s_cache.put (key, period); if (period.isStandardPeriod()) @@ -169,7 +181,7 @@ public class MPeriod extends X_C_Period rs = null; pstmt = null; } if (retValue == null) - s_log.warning("No Standard Period for " + DateAcct + s_log.info("No Standard Period for " + DateAcct + " (AD_Client_ID=" + AD_Client_ID + ")"); return retValue; } diff --git a/base/src/org/compiere/model/MYear.java b/base/src/org/compiere/model/MYear.java index 101deacb69..9f38e73dce 100644 --- a/base/src/org/compiere/model/MYear.java +++ b/base/src/org/compiere/model/MYear.java @@ -244,7 +244,7 @@ public class MYear extends X_C_Year cal.add(Calendar.DAY_OF_YEAR, -1); Timestamp end = new Timestamp(cal.getTimeInMillis()); // - MPeriod period = MPeriod.findByCalendar(getCtx(), start, getC_Calendar_ID()); + MPeriod period = MPeriod.findByCalendar(getCtx(), start, getC_Calendar_ID(), get_TrxName()); if (period == null) { period = new MPeriod (this, month+1, name, start, end);