tspc 2009-10-04 13:11:29 +00:00
parent 6e37f61bbd
commit 361ae4e8ba
2 changed files with 18 additions and 6 deletions

View File

@ -116,9 +116,21 @@ public class MPeriod extends X_C_Period
* @param DateAcct * @param DateAcct
* @param C_Calendar_ID * @param C_Calendar_ID
* @return MPeriod * @return MPeriod
* @deprecated
*/ */
public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID) {
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); int AD_Client_ID = Env.getAD_Client_ID(ctx);
// Search in Cache first // Search in Cache first
@ -144,7 +156,7 @@ public class MPeriod extends X_C_Period
ResultSet rs = null; ResultSet rs = null;
try try
{ {
pstmt = DB.prepareStatement(sql, null); pstmt = DB.prepareStatement(sql, trxName);
pstmt.setInt (1, C_Calendar_ID); pstmt.setInt (1, C_Calendar_ID);
pstmt.setTimestamp (2, TimeUtil.getDay(DateAcct)); pstmt.setTimestamp (2, TimeUtil.getDay(DateAcct));
pstmt.setString(3, "Y"); pstmt.setString(3, "Y");
@ -152,7 +164,7 @@ public class MPeriod extends X_C_Period
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) 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()); Integer key = new Integer(period.getC_Period_ID());
s_cache.put (key, period); s_cache.put (key, period);
if (period.isStandardPeriod()) if (period.isStandardPeriod())
@ -169,7 +181,7 @@ public class MPeriod extends X_C_Period
rs = null; pstmt = null; rs = null; pstmt = null;
} }
if (retValue == 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 + ")"); + " (AD_Client_ID=" + AD_Client_ID + ")");
return retValue; return retValue;
} }

View File

@ -244,7 +244,7 @@ public class MYear extends X_C_Year
cal.add(Calendar.DAY_OF_YEAR, -1); cal.add(Calendar.DAY_OF_YEAR, -1);
Timestamp end = new Timestamp(cal.getTimeInMillis()); 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) if (period == null)
{ {
period = new MPeriod (this, month+1, name, start, end); period = new MPeriod (this, month+1, name, start, end);