src-db/database/model/triggers/M_PRODUCTION_TRG.xml
changeset 1928 34cae22c29f7
parent 1605 8a0fe0193bef
child 2078 cf88ca44cdd2
--- a/src-db/database/model/triggers/M_PRODUCTION_TRG.xml	Tue Nov 11 17:38:48 2008 +0000
+++ b/src-db/database/model/triggers/M_PRODUCTION_TRG.xml	Wed Nov 12 12:36:56 2008 +0000
@@ -24,12 +24,17 @@
     ************************************************************************/
 v_DateNull DATE := TO_DATE('01-01-1900', 'DD-MM-YYYY');
 BEGIN
-  IF (:old.PROCESSED = 'Y' AND(
+  IF (:old.PROCESSED = 'Y') THEN 
+   IF (DELETING) THEN
+      RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
+    END IF;
+    IF (UPDATING) AND(
      (COALESCE(:old.MOVEMENTDATE, v_DateNull) <> COALESCE(:new.MOVEMENTDATE, v_DateNull))
      OR (COALESCE(:old.AD_ORGTRX_ID, '0') <> COALESCE(:new.AD_ORGTRX_ID, '0'))
-     OR (COALESCE(:old.DOCUMENTNO, '0') <> COALESCE(:new.DOCUMENTNO, '0')))) THEN
-    RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
-  END IF;
+     OR (COALESCE(:old.DOCUMENTNO, '0') <> COALESCE(:new.DOCUMENTNO, '0'))) THEN
+        RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
+    END IF;
+ END IF;    
 END M_PRODUCTION_TRG
 ]]></body>
     </trigger>