Fixed 17635: Modified trigger to allow saving changes
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Mon, 20 Jun 2011 20:15:54 +0200
changeset 12911 195b478bc8df
parent 12910 8778d888466a
child 12914 ae387ec20eae
Fixed 17635: Modified trigger to allow saving changes
modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_PMT_CHECK_TRG.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_PMT_CHECK_TRG.xml	Mon Jun 20 19:24:52 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_PMT_CHECK_TRG.xml	Mon Jun 20 20:15:54 2011 +0200
@@ -15,7 +15,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2010 Openbravo SLU
+* All portions are Copyright (C) 2010-2011 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 *************************************************************************/
@@ -32,11 +32,18 @@
       OR(COALESCE(:OLD.DOCUMENTNO, '0') <> COALESCE(:NEW.DOCUMENTNO, '0'))
       OR(COALESCE(:OLD.C_CURRENCY_ID, '0') <> COALESCE(:NEW.C_CURRENCY_ID, '0'))
       OR(COALESCE(:OLD.C_BPARTNER_ID, '0') <> COALESCE(:NEW.C_BPARTNER_ID, '0'))
-      OR(COALESCE(:OLD.FIN_PAYMENTMETHOD_ID, '0') <> COALESCE(:NEW.FIN_PAYMENTMETHOD_ID, '0'))
-      OR(COALESCE(:OLD.FIN_FINANCIAL_ACCOUNT_ID, '0') <> COALESCE(:NEW.FIN_FINANCIAL_ACCOUNT_ID, '0'))
+      OR(COALESCE(:OLD.FIN_PAYMENTMETHOD_ID, '0') <> COALESCE(:NEW.FIN_PAYMENTMETHOD_ID, '0')
+         AND COALESCE(:OLD.STATUS, '0') <> TO_CHAR('RPAE'))
+      OR(COALESCE(:OLD.FIN_FINANCIAL_ACCOUNT_ID, '0') <> COALESCE(:NEW.FIN_FINANCIAL_ACCOUNT_ID, '0')
+         AND COALESCE(:OLD.STATUS, '0') <> TO_CHAR('RPAE'))
       OR(COALESCE(:OLD.AMOUNT, 0) <> COALESCE(:NEW.AMOUNT, 0))
       OR(COALESCE(:OLD.WRITEOFFAMT, 0) <> COALESCE(:NEW.WRITEOFFAMT, 0))
-      OR(COALESCE(:OLD.PAYMENTDATE, v_DateNull) <> COALESCE(:NEW.PAYMENTDATE, v_DateNull)))) THEN
+      OR(COALESCE(:OLD.Finacc_Txn_Amount, 0) <> COALESCE(:NEW.Finacc_Txn_Amount, 0)
+         AND COALESCE(:OLD.STATUS, '0') <> TO_CHAR('RPAE'))
+      OR(COALESCE(:OLD.Finacc_Txn_Convert_Rate, 0) <> COALESCE(:NEW.Finacc_Txn_Convert_Rate, 0)
+         AND COALESCE(:OLD.STATUS, '0') <> TO_CHAR('RPAE'))
+      OR(COALESCE(:OLD.PAYMENTDATE, v_DateNull) <> COALESCE(:NEW.PAYMENTDATE, v_DateNull)
+         AND COALESCE(:OLD.STATUS, '0') <> TO_CHAR('RPAE')))) THEN
       RAISE_APPLICATION_ERROR(-20000, '@20501@');
     END IF;
   END IF;