details:   https://code.openbravo.com/erp/devel/pi/rev/db69b5dae58e
changeset: 24459:db69b5dae58e
user:      Atul Gaware <atul.gaware <at> openbravo.com>
date:      Mon Sep 15 14:22:18 2014 +0530
summary:   Fixes Issue 27161: Relationship between good receipt and purchase 
order should
not exist when grouping several orders in one receipt

diffstat:

 src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java               |   
8 ++++-
 src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql |  
15 +++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r c07844c04c0d -r db69b5dae58e 
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java       Mon Sep 
22 22:25:30 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java       Mon Sep 
15 14:22:18 2014 +0530
@@ -1884,8 +1884,12 @@
         if (!strPO.equals("")) {
           try {
             final int total = CreateFromShipmentData.deleteC_Order_ID(conn, 
this, strKey, strPO);
-            if (total == 0)
-              CreateFromShipmentData.updateC_Order_ID(conn, this, strPO, 
strKey);
+            if (total == 0) {
+              int noOfOrders = 
Integer.valueOf(CreateFromShipmentData.countOrders(conn, this, strKey));
+              if (noOfOrders == 1) {
+                CreateFromShipmentData.updateC_Order_ID(conn, this, strPO, 
strKey);
+              }
+            }
           } catch (final ServletException ex) {
             myMessage = Utility.translateError(this, vars, vars.getLanguage(), 
ex.getMessage());
             releaseRollbackConnection(conn);
diff -r c07844c04c0d -r db69b5dae58e 
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql 
Mon Sep 22 22:25:30 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment_data.xsql 
Mon Sep 15 14:22:18 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):  ______________________________________.
  ************************************************************************
@@ -829,4 +829,17 @@
     </Sql>
     <Parameter name="mProductUomId"/>
   </SqlMethod>
+  <SqlMethod name="countOrders" type="preparedStatement" connection="true" 
return="String">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT COUNT(DISTINCT OL.C_ORDER_ID) AS COUNT
+        FROM M_INOUTLINE MIOL
+            LEFT JOIN C_ORDERLINE OL ON OL.C_ORDERLINE_ID = MIOL.C_ORDERLINE_ID
+        WHERE MIOL.M_INOUT_ID = ?
+        ]]>
+    </Sql>
+    <Field name="rownum" value="count"/>
+    <Parameter name="mInoutId"/>
+    </SqlMethod>
 </SqlClass>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to