Fixes Issue 25731 Trigger Mutating when deleting trxns from financial account
authorAtul Gaware <atul.gaware@openbravo.com>
Tue, 11 Mar 2014 10:29:27 +0530
changeset 22740 c6e0222a04cd
parent 22738 a3e91c862ccc
child 22741 18e0d8ef18ce
Fixes Issue 25731 Trigger Mutating when deleting trxns from financial account
src-db/database/model/triggers/FIN_FINANCIAL_ACCOUNT_TRG.xml
--- a/src-db/database/model/triggers/FIN_FINANCIAL_ACCOUNT_TRG.xml	Fri Mar 21 00:04:15 2014 +0100
+++ b/src-db/database/model/triggers/FIN_FINANCIAL_ACCOUNT_TRG.xml	Tue Mar 11 10:29:27 2014 +0530
@@ -14,7 +14,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-2012 Openbravo SLU
+    * All portions are Copyright (C) 2010-2014 Openbravo SLU
     * All Rights Reserved.
     * Contributor(s):  ______________________________________.
     ************************************************************************/
@@ -66,8 +66,10 @@
 
     END LOOP;
   ELSIF (UPDATING) THEN
-    UPDATE fin_financial_account_acct SET AD_ORG_ID = :new.AD_ORG_ID
-    WHERE fin_financial_account_id = :new.fin_financial_account_id;
+		IF (:OLD.AD_ORG_ID <> :NEW.AD_ORG_ID) THEN
+			UPDATE fin_financial_account_acct SET AD_ORG_ID = :new.AD_ORG_ID
+			WHERE fin_financial_account_id = :new.fin_financial_account_id;
+		END IF;
   END IF;
 END FIN_FINANCIAL_ACCOUNT_TRG
 ]]></body>