details:   https://code.openbravo.com/erp/devel/pi/rev/ae1c846b6f3f
changeset: 19151:ae1c846b6f3f
user:      Pandeeswari Ramakrishnan <pandeeswari.ramakrishnan <at> 
openbravo.com>
date:      Thu Jan 03 12:02:52 2013 +0530
summary:   Fixes Issue 22665 : Wrong error when completing the shipment without 
lines

details:   https://code.openbravo.com/erp/devel/pi/rev/f6193ba3eb10
changeset: 19152:f6193ba3eb10
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Thu Jan 03 10:42:10 2013 +0100
summary:   Related to issue 22665 Code Review

diffstat:

 src-db/database/model/functions/M_INOUT_POST.xml |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (50 lines):

diff -r a0b3c498d406 -r f6193ba3eb10 
src-db/database/model/functions/M_INOUT_POST.xml
--- a/src-db/database/model/functions/M_INOUT_POST.xml  Wed Jan 02 20:00:23 
2013 +0100
+++ b/src-db/database/model/functions/M_INOUT_POST.xml  Thu Jan 03 10:42:10 
2013 +0100
@@ -22,7 +22,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2012 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2013 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -235,15 +235,20 @@
       END IF;
     END IF;
         -- Process Shipments
-  
-      SELECT COUNT(*)
+      SELECT COUNT(*) INTO v_Aux
+      FROM M_InOutLine
+      WHERE M_InOut_ID = v_Record_ID;
+
+      IF v_Aux > 0 THEN  
+        SELECT COUNT(*)
         INTO v_Count
-      FROM M_INOUT IO, M_INOUTLINE IOL
-      WHERE IO.M_INOUT_ID = IOL.M_INOUT_ID
+        FROM M_INOUT IO, M_INOUTLINE IOL
+        WHERE IO.M_INOUT_ID = IOL.M_INOUT_ID
         AND AD_ISORGINCLUDED(IOL.AD_Org_ID, IO.AD_Org_ID, IO.AD_Client_ID) <> 
-1
         AND IO.M_INOUT_ID = v_Record_ID;
-      IF (v_Count=0) THEN
-        RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgLines@') ;
+        IF (v_Count=0) THEN
+          RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgLines@') ;
+        END IF;
       END IF;
       
       -- Check the header belongs to a organization where transactions are 
posible and ready to use
@@ -304,9 +309,7 @@
           IF(Cur_InOut.Processed='N' AND Cur_InOut.DocStatus='DR' AND 
Cur_InOut.DocAction='CO') THEN
             -- For all active shipment lines
             v_ResultStr:='HeaderLoop-1';
-            SELECT COUNT(*) INTO v_Aux
-        FROM M_InOutLine
-        WHERE M_InOut_ID = v_Record_ID;
+            
         IF v_Aux=0 THEN
         RAISE_APPLICATION_ERROR(-20000, '@ReceiptWithoutLines@');
         END IF;

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to