details:   https://code.openbravo.com/erp/devel/pi/rev/e89e03ffdf0d
changeset: 22753:e89e03ffdf0d
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Fri Mar 21 18:01:47 2014 +0530
summary:   Fixes Issue 24876 Accounting background process considers org used 
to define it

details:   https://code.openbravo.com/erp/devel/pi/rev/9818828e8835
changeset: 22754:9818828e8835
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Fri Mar 21 16:54:45 2014 +0530
summary:   Fixes Issue 25680 Sales Quotations are taken into account in a 
Purchasing Plan

diffstat:

 src-db/database/model/functions/MRP_RUN_INITIALIZE.xml                         
                  |    5 +-
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrg.class
     |    0 
 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrgData.class
 |    0 
 
src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg.java
                |   41 +++++++
 
src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg_data.xsql
           |   56 ++++++++++
 src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java                  
                  |    8 +-
 src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql             
                  |   13 ++-
 7 files changed, 118 insertions(+), 5 deletions(-)

diffs (199 lines):

diff -r 720966e88dd2 -r 9818828e8835 
src-db/database/model/functions/MRP_RUN_INITIALIZE.xml
--- a/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml    Fri Mar 21 
14:58:51 2014 +0000
+++ b/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml    Fri Mar 21 
16:54:45 2014 +0530
@@ -52,7 +52,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-2012 Openbravo SLU
+* All portions are Copyright (C) 2001-2014 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -234,6 +234,7 @@
               o.issotrx
          FROM c_orderline ol
               JOIN c_order o ON o.c_order_id = ol.c_order_id
+              JOIN c_doctype dt ON o.c_doctypetarget_id = dt.c_doctype_id
               LEFT JOIN (SELECT c_orderline_id, sum(qty) AS qty 
                         FROM m_matchpo
                         WHERE m_inoutline_id IS NOT NULL
@@ -258,7 +259,7 @@
                                        (CASE o.issotrx WHEN 'Y' THEN 'SO' ELSE 
'PO' END),
                                        to_number(COALESCE(ol.datepromised, 
ol.dateordered, o.dateordered) - p_planningdate), p_timehorizon) <> -1
            AND ((o.issotrx = 'N' AND ol.qtyordered - COALESCE(matchpo.qty,0) > 
COALESCE(preres.reservedqty, 0))
-               OR (o.issotrx = 'Y' AND ol.qtyordered - 
COALESCE(ol.qtydelivered, 0) > COALESCE(res.reservedqty,0) - 
COALESCE(res.releasedqty, 0)))
+               OR (o.issotrx = 'Y' AND (dt.docsubtypeso <> 'OB') AND 
ol.qtyordered - COALESCE(ol.qtydelivered, 0) > COALESCE(res.reservedqty,0) - 
COALESCE(res.releasedqty, 0)))
            AND AD_ISORGINCLUDED(o.ad_org_id, p_org_id, p_client_id) > -1
            -- Only orders of warehouses in p_org_id and its childs
            AND AD_ISORGINCLUDED(w.ad_org_id, p_org_id, p_client_id) > -1
diff -r 720966e88dd2 -r 9818828e8835 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrg.class
Binary file 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrg.class
 has changed
diff -r 720966e88dd2 -r 9818828e8835 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrgData.class
Binary file 
src-util/modulescript/build/classes/org/openbravo/modulescript/UpdateRequestProcessOrgData.class
 has changed
diff -r 720966e88dd2 -r 9818828e8835 
src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg.java
 Fri Mar 21 16:54:45 2014 +0530
@@ -0,0 +1,41 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.modulescript;
+
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.modulescript.ModuleScript;
+/**
+ * 
+ * @author
+ */
+public class UpdateRequestProcessOrg extends ModuleScript {
+
+  @Override
+  public void execute() {
+    try {      
+         ConnectionProvider cp = getConnectionProvider();
+         if("P".equals(UpdateRequestProcessOrgData.getModuleStatus(cp))) {
+           UpdateRequestProcessOrgData.createPreference(cp);
+         }        
+        }catch (Exception e) {
+             handleError(e);
+        }
+  }
+}
diff -r 720966e88dd2 -r 9818828e8835 
src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg_data.xsql
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ 
b/src-util/modulescript/src/org/openbravo/modulescript/UpdateRequestProcessOrg_data.xsql
    Fri Mar 21 16:54:45 2014 +0530
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<SqlClass name="UpdateRequestProcessOrgData" 
package="org.openbravo.modulescript">
+   <SqlClassComment></SqlClassComment>
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        select 1 as name from dual
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="createPreference" type="preparedStatement" 
return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        INSERT INTO ad_preference (
+          ad_preference_id, ad_client_id, ad_org_id, isactive,
+          createdby, created, updatedby, updated,
+          attribute
+        ) VALUES (
+          get_uuid(), '0', '0', 'Y',
+          '0', NOW(), '0', NOW(),
+          'UseRequestOrganizationExecutingRequestProcess'
+        )
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="getModuleStatus" type="preparedStatement" return="String">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT status
+        FROM ad_module
+        WHERE ad_module_id = '0'        
+      ]]>
+    </Sql>
+  </SqlMethod>
+</SqlClass>
\ No newline at end of file
diff -r 720966e88dd2 -r 9818828e8835 
src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java
--- a/src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java     Fri Mar 
21 14:58:51 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/AcctServerProcess.java     Fri Mar 
21 16:54:45 2014 +0530
@@ -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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2009-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -83,7 +83,6 @@
   private void processClient(VariablesSecureApp vars, ProcessBundle bundle) 
throws ServletException {
     final String processId = bundle.getProcessId();
     final String pinstanceId = bundle.getPinstanceId();
-
     final ProcessContext ctx = bundle.getContext();
     isDirect = bundle.getChannel() == Channel.DIRECT;
 
@@ -143,6 +142,11 @@
       strDateFrom = AcctServerProcessData.selectDateFrom(connection, 
pinstanceId);
       strDateTo = AcctServerProcessData.selectDateTo(connection, pinstanceId);
     }
+    // If UseRequestOrganizationExecutingRequestProcess preference exists
+    // use process Organization
+    if (AcctServerProcessData.useRequestProcessOrg(connection)) {
+      strOrg = vars.getOrg();
+    }
     if (!strTable.equals("")) {
       tables = new String[1];
       tables[0] = new String(strTable);
diff -r 720966e88dd2 -r 9818828e8835 
src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql
--- a/src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql        
Fri Mar 21 14:58:51 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/AcctServerProcess_data.xsql        
Fri Mar 21 16:54:45 2014 +0530
@@ -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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2001-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -99,4 +99,15 @@
      ]]></Sql>
      <Parameter name="adPinstanceId"/>
    </SqlMethod>
+   <SqlMethod name="useRequestProcessOrg" type="preparedStatement" 
return="boolean">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT count(*) as exist
+        FROM DUAL
+        WHERE EXISTS (SELECT 1 FROM ad_preference
+                      WHERE attribute = 
'UseRequestOrganizationExecutingRequestProcess')
+      ]]>
+    </Sql>
+  </SqlMethod>
 </SqlClass>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to