Fixes issue 35575: "Adjustment Period" not used when posting a GL Journal
authorMark <markmm82@gmail.com>
Mon, 20 Mar 2017 13:14:16 -0400
changeset 32128 6688edca1b60
parent 31683 273c24deef8f
child 32129 cb0c63b0096e
Fixes issue 35575: "Adjustment Period" not used when posting a GL Journal

In case Adjustment Period was defined for a calendar and user tries to post gl journal document in that period it was not properly done.

It was fixed re-structuring the affected queries using the C_PERIOD_ID column of GL_JOURNAL and C_PERIOD tables, always retrieving this value as C_PERIOD_ID instead of "period" alias
src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql	Mon Mar 13 11:02:48 2017 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocGLJournal_data.xsql	Mon Mar 20 13:14:16 2017 -0400
@@ -12,7 +12,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2015 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2017 Openbravo S.L.U.
  ******************************************************************************
 -->
 
@@ -29,7 +29,7 @@
         SELECT G.AD_CLIENT_ID, G.AD_ORG_ID, G.DOCUMENTNO, G.DATEACCT, G.DATEDOC,
         G.C_CURRENCY_ID, G.C_DOCTYPE_ID, G.POSTED, G.POSTINGTYPE, G.ISOPENING,
         G.C_CAMPAIGN_ID, G.C_PROJECT_ID, G.USER1_ID, G.USER2_ID, G.C_COSTCENTER_ID,
-        G.A_ASSET_ID, G.C_BPARTNER_ID, G.M_PRODUCT_ID, G.C_PERIOD_ID AS PERIOD, 
+        G.A_ASSET_ID, G.C_BPARTNER_ID, G.M_PRODUCT_ID, G.C_PERIOD_ID, 
         '' AS FININVCOUNT,'' AS FINACCTCOUNT, G.MULTI_GL
         FROM GL_JOURNAL G
         WHERE AD_CLIENT_ID=?
@@ -56,7 +56,7 @@
       <SqlMethodComment></SqlMethodComment>
       <Sql>
       <![CDATA[
-      select max(c_period.c_period_id) as period
+      select max(c_period.c_period_id) as c_period_id
       from c_period, c_periodcontrol
       where c_period.c_period_id = c_periodcontrol.c_period_id
       and c_periodcontrol.docbasetype = 'GLJ'