src-db/database/model/functions/M_INOUT_POST.xml
changeset 18808 a3cfaac930ae
parent 18807 0c021a2f2c49
child 18829 40d9ac596602
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Thu Sep 20 12:10:09 2012 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Thu Sep 20 12:39:59 2012 +0200
@@ -226,12 +226,15 @@
     END IF;
         -- Process Shipments
   
-     -- Set org lines like the header
-       UPDATE M_INOUTLINE
-        SET AD_ORG_ID = (SELECT AD_ORG_ID FROM M_INOUT WHERE M_INOUT_ID = v_Record_ID),
-        Updated=now(),
-        UpdatedBy=v_User
-      WHERE M_INOUT_ID = v_Record_ID;
+      SELECT COUNT(*)
+        INTO v_Count
+      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@') ;
+      END IF;
       
       -- Check the header belongs to a organization where transactions are posible and ready to use
       SELECT AD_Org.IsReady, Ad_OrgType.IsTransactionsAllowed