Fixed issue 19593. Current Balance field not properly updated
authorXabier Merino <xabier.merino@openbravo.com>
Wed, 29 Feb 2012 16:38:17 +0100
changeset 15666 05feefc7fd97
parent 15665 cfc4e257dc4a
child 15667 7be373a943ba
Fixed issue 19593. Current Balance field not properly updated
src-db/database/model/triggers/FIN_FINANCIAL_ACCOUNT_TRG2.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/triggers/FIN_FINANCIAL_ACCOUNT_TRG2.xml	Wed Feb 29 16:38:17 2012 +0100
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+  <database name="TRIGGER FIN_FINANCIAL_ACCOUNT_TRG2">
+    <trigger name="FIN_FINANCIAL_ACCOUNT_TRG2" table="FIN_FINANCIAL_ACCOUNT" fires="before" insert="true" update="true" delete="false" foreach="row">
+      <body><![CDATA[
+    /*************************************************************************
+    * The contents of this file are subject to the Openbravo  Public  License
+    * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+    * Version 1.1  with a permitted attribution clause; you may not  use this
+    * file except in compliance with the License. You  may  obtain  a copy of
+    * the License at http://www.openbravo.com/legal/license.html
+    * Software distributed under the License  is  distributed  on  an "AS IS"
+    * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+    * License for the specific  language  governing  rights  and  limitations
+    * 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 Rights Reserved.
+    * Contributor(s):  ______________________________________.
+    ************************************************************************/
+    TYPE RECORD IS REF CURSOR;
+BEGIN
+
+    IF AD_isTriggerEnabled()='N' THEN RETURN;
+    END IF;
+
+  IF(INSERTING) THEN
+    :NEW.currentbalance := :NEW.initialbalance;
+    
+  END IF;
+END FIN_FINANCIAL_ACCOUNT_TRG2
+]]></body>
+    </trigger>
+  </database>