details:   https://code.openbravo.com/erp/devel/pi/rev/5fd88ad2aa0f
changeset: 28055:5fd88ad2aa0f
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Wed Nov 25 14:35:30 2015 +0100
summary:   Fixes bug 31265:AcctServer background should only consider valid 
GeneralLedgers

When Acct Server Process is executed from a process request for a organization 
different than *, tables to be posted will only be taken from General Ledgers 
which apply to organization being considered by Acct Server background process.
To be considered, these tables should also be as disable for background = 'N' 
in every general ledger that apply to organization being considered by Acct 
Server background process.

diffstat:

 src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java      |  10 ++-
 src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql |  27 
+++++++++-
 2 files changed, 33 insertions(+), 4 deletions(-)

diffs (73 lines):

diff -r e3c7ca8c584f -r 5fd88ad2aa0f 
src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java
--- a/src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java     Thu Nov 
26 15:50:49 2015 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java     Wed Nov 
25 14:35:30 2015 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2014 Openbravo SLU
+ * All portions are Copyright (C) 2009-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -115,10 +115,14 @@
     }
     try {
       final AcctServerProcessData[] data;
-      if ("0".equals(ctx.getClient()))
+      if ("0".equals(ctx.getClient())) {
         data = AcctServerProcessData.selectAcctTable(connection);
-      else
+      } else if ("0".equals(ctx.getOrganization())) {
         data = AcctServerProcessData.selectAcctTable(connection, 
ctx.getClient());
+      } else {
+        data = AcctServerProcessData.selectAcctTable(connection, 
ctx.getClient(),
+            ctx.getOrganization());
+      }
       final ArrayList<Object> vTableIds = new ArrayList<Object>();
       for (int i = 0; i < data.length; i++) {
         vTableIds.add(data[i].adTableId);
diff -r e3c7ca8c584f -r 5fd88ad2aa0f 
src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql
--- a/src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql        
Thu Nov 26 15:50:49 2015 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql        
Wed Nov 25 14:35:30 2015 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2001-2014 Openbravo SLU
+ * All portions are Copyright (C) 2001-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -59,6 +59,31 @@
     ]]></Sql>
     <Parameter name="client"/>
    </SqlMethod>
+   <SqlMethod name="selectAcctTable" type="preparedStatement" 
return="multiple">
+      <SqlMethodComment></SqlMethodComment>
+      <Sql><![CDATA[
+      SELECT at.ad_table_id
+      FROM c_acctschema_table at
+      WHERE at.isactive = 'Y'
+      AND at.ad_client_id = ?
+      AND EXISTS (
+        SELECT 1
+        FROM c_acctschema a
+        JOIN ad_org_acctschema oa
+        ON a.c_acctschema_id = oa.c_acctschema_id
+        WHERE at.c_acctschema_id = a.c_acctschema_id
+        AND (ad_org_isinnaturaltree(?, oa.ad_org_id, oa.ad_client_id) = 'Y')
+        AND a.isactive = 'Y'
+        AND oa.isactive = 'Y'
+      )
+      GROUP BY at.ad_table_id
+      HAVING sum(case when at.isBackgroundDisabled = 'N' then 1 else 0 end) > 0
+      AND sum(case when at.isBackgroundDisabled = 'Y' then 1 else 0 end) = 0
+      ORDER BY at.ad_table_id
+    ]]></Sql>
+    <Parameter name="client"/>
+    <Parameter name="org"/>
+   </SqlMethod>
    <SqlMethod name="selectDescription" type="preparedStatement" 
return="string">
       <SqlMethodComment></SqlMethodComment>
       <Sql><![CDATA[

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to