Fixes issue 32983: Generate duplicate payment plan under some circumstances
authorAtul Gaware <atul.gaware@openbravo.com>
Mon, 02 May 2016 16:58:34 +0530
changeset 28864 ebccd358e1cf
parent 28860 d386f41fa755
child 28865 8ae675ffb845
Fixes issue 32983: Generate duplicate payment plan under some circumstances

Before processing order, a check is done whether processed flag is N or not.
src-db/database/model/functions/C_ORDER_POST1.xml
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Wed Apr 27 07:03:32 2016 +0000
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Mon May 02 16:58:34 2016 +0530
@@ -357,6 +357,19 @@
        IF v_Aux=0 THEN
          RAISE_APPLICATION_ERROR(-20000, '@OrderWithoutLines@');
        END IF;
+       SELECT PROCESSED INTO v_IsProcessed
+       FROM C_ORDER WHERE C_ORDER_ID = v_Record_ID;
+       IF v_IsProcessed = 'Y' THEN
+         RAISE_APPLICATION_ERROR(-20000,'@AlreadyPosted@');
+       END IF;
+    END IF;
+
+    IF (v_DocAction='RE') THEN
+      SELECT PROCESSED INTO v_IsProcessed
+       FROM C_ORDER WHERE C_ORDER_ID = v_Record_ID;
+       IF v_IsProcessed = 'N' THEN
+         RAISE_APPLICATION_ERROR(-20000,'@ActionNotSupported@');
+       END IF;
     END IF;
 
     -- Check the cash vat flag for all the taxes matches the order one