From a19eaa0c82c6d3569a69cb5dd8359a6b9885c3a3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 2 Sep 2018 13:07:21 +0200 Subject: [PATCH] IDEMPIERE-2617 Transaction closed exception while posting --- .../src/org/compiere/model/MPeriod.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MPeriod.java b/org.adempiere.base/src/org/compiere/model/MPeriod.java index b518226da9..943ed0135c 100644 --- a/org.adempiere.base/src/org/compiere/model/MPeriod.java +++ b/org.adempiere.base/src/org/compiere/model/MPeriod.java @@ -88,7 +88,7 @@ public class MPeriod extends X_C_Period */ public static MPeriod get (Properties ctx, Timestamp DateAcct) { - return get(ctx, DateAcct, 0); + return get(ctx, DateAcct, 0, null); } // get /** @@ -200,7 +200,7 @@ public class MPeriod extends X_C_Period */ public static int getC_Period_ID (Properties ctx, Timestamp DateAcct) { - MPeriod period = get (ctx, DateAcct); + MPeriod period = get (ctx, DateAcct, 0, null); if (period == null) return 0; return period.getC_Period_ID(); @@ -215,7 +215,7 @@ public class MPeriod extends X_C_Period */ public static int getC_Period_ID (Properties ctx, Timestamp DateAcct, int AD_Org_ID) { - MPeriod period = get (ctx, DateAcct, AD_Org_ID); + MPeriod period = get (ctx, DateAcct, AD_Org_ID, null); if (period == null) return 0; return period.getC_Period_ID(); @@ -254,7 +254,7 @@ public class MPeriod extends X_C_Period s_log.warning("No DocBaseType"); return false; } - MPeriod period = MPeriod.get (ctx, DateAcct, AD_Org_ID); + MPeriod period = MPeriod.get (ctx, DateAcct, AD_Org_ID, null); if (period == null) { s_log.warning("No Period for " + DateAcct + " (" + DocBaseType + ")"); @@ -398,7 +398,7 @@ public class MPeriod extends X_C_Period public static MPeriod getFirstInYear (Properties ctx, Timestamp DateAcct, int AD_Org_ID) { MPeriod retValue = null; - int C_Calendar_ID = MPeriod.get(ctx, DateAcct, AD_Org_ID).getC_Calendar_ID(); + int C_Calendar_ID = MPeriod.get(ctx, DateAcct, AD_Org_ID, null).getC_Calendar_ID(); String sql = "SELECT * " + "FROM C_Period " @@ -780,7 +780,7 @@ public class MPeriod extends X_C_Period public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType) throws PeriodClosedException { - if (!MPeriod.isOpen(ctx, dateAcct, docBaseType)) { + if (!MPeriod.isOpen(ctx, dateAcct, docBaseType, 0)) { throw new PeriodClosedException(dateAcct, docBaseType); } } @@ -815,7 +815,7 @@ public class MPeriod extends X_C_Period throws PeriodClosedException { MDocType dt = MDocType.get(ctx, C_DocType_ID); - testPeriodOpen(ctx, dateAcct, dt.getDocBaseType()); + testPeriodOpen(ctx, dateAcct, dt.getDocBaseType(), 0); } /** @@ -842,9 +842,9 @@ public class MPeriod extends X_C_Period { if (m_C_Calendar_ID == 0) { - MYear year = (MYear) getC_Year(); - if (year != null) - m_C_Calendar_ID = year.getC_Calendar_ID(); + int calId = DB.getSQLValueEx(null, "SELECT C_Calendar_ID FROM C_Year WHERE C_Year_ID=?", getC_Year_ID()); + if (calId >= 0) + m_C_Calendar_ID = calId; else log.severe("@NotFound@ C_Year_ID=" + getC_Year_ID()); }