Fixed issue 23994
authorSandra Huguet <sandra.huguet@openbravo.com>
Tue, 29 Jul 2014 12:31:47 +0200
changeset 24141 6b960d4ca8bb
parent 24140 687d91cddde8
child 24142 c08c6475d0c5
Fixed issue 23994
src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateMatchInvoice.class
src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateMatchInvoiceData.class
src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice.java
src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice_data.xsql
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateMatchInvoice.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/DeleteDuplicateMatchInvoiceData.class has changed
--- a/src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice.java	Wed Jul 30 15:33:11 2014 +0200
+++ b/src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice.java	Tue Jul 29 12:31:47 2014 +0200
@@ -27,9 +27,10 @@
     try {
       ConnectionProvider cp = getConnectionProvider();
       DeleteDuplicateMatchInvoiceData.deletePurchase(cp);
-      DeleteDuplicateMatchInvoiceData.deleteSales(cp);
+      DeleteDuplicateMatchInvoiceData.deleteSalesFirstPart(cp);
+      DeleteDuplicateMatchInvoiceData.deleteSalesSecondPart(cp);
     } catch (Exception e) {
       handleError(e);
     }
   }
-}
\ No newline at end of file
+}
--- a/src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice_data.xsql	Wed Jul 30 15:33:11 2014 +0200
+++ b/src-util/modulescript/src/org/openbravo/modulescript/DeleteDuplicateMatchInvoice_data.xsql	Tue Jul 29 12:31:47 2014 +0200
@@ -41,7 +41,7 @@
       ]]>
     </Sql>
   </SqlMethod>
-  <SqlMethod name="deleteSales" type="preparedStatement" return="rowcount">
+  <SqlMethod name="deleteSalesFirstPart" type="preparedStatement" return="rowcount">
     <SqlMethodComment></SqlMethodComment>
     <Sql><![CDATA[
       DELETE FROM m_matchinv WHERE m_matchinv_id IN (SELECT m_matchinv_id FROM m_matchinv minv
@@ -50,8 +50,15 @@
             FROM m_matchinv m 
             LEFT JOIN m_inoutline ml on m.m_inoutline_id = ml.m_inoutline_id 
             LEFT JOIN m_inout mi on mi.m_inout_id = ml.m_inout_id 
-            WHERE mi.issotrx = 'Y' AND m.m_matchinv_id = minv.m_matchinv_id)
-        OR EXISTS (
+            WHERE mi.issotrx = 'Y' AND m.m_matchinv_id = minv.m_matchinv_id))
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="deleteSalesSecondPart" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+      DELETE FROM m_matchinv WHERE m_matchinv_id IN (SELECT m_matchinv_id FROM m_matchinv minv
+        WHERE EXISTS (
             SELECT 1
             FROM m_matchinv m 
             LEFT JOIN c_invoiceline ci on m.c_invoiceline_id = ci.c_invoiceline_id