Fixes Issue 26960:Unable to merge a previously splitted bank statement line
authorAtul Gaware <atul.gaware@openbravo.com>
Fri, 25 Jul 2014 16:39:43 +0530
changeset 24127 714e8ad187a0
parent 24126 b9423e2be589
child 24128 249bccd0fb3f
Fixes Issue 26960:Unable to merge a previously splitted bank statement line
modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_BNKSTM_LINE_CHECK_TRG.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_BNKSTM_LINE_CHECK_TRG.xml	Fri Jul 25 10:40:49 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/triggers/APRM_FIN_BNKSTM_LINE_CHECK_TRG.xml	Fri Jul 25 16:39:43 2014 +0530
@@ -16,7 +16,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-2014 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 *************************************************************************/
@@ -79,7 +79,9 @@
       OR(COALESCE(:OLD.DRAMOUNT, 0) <> COALESCE(:NEW.DRAMOUNT, 0))
       OR(COALESCE(:OLD.REFERENCENO, '0') <> COALESCE(:NEW.REFERENCENO, '0'))
       )) THEN
-      RAISE_APPLICATION_ERROR(-20000, '@APRM_BSTLine_Matched@');
+      IF (:NEW.FIN_FINACC_TRANSACTION_ID IS NOT NULL) THEN
+	RAISE_APPLICATION_ERROR(-20000, '@APRM_BSTLine_Matched@');
+      END IF;
     END IF;
 
   	END IF;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Fri Jul 25 10:40:49 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Fri Jul 25 16:39:43 2014 +0530
@@ -11,7 +11,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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2010-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -871,9 +871,6 @@
     OBContext.setAdminMode();
     try {
       bsline = OBDal.getInstance().get(FIN_BankStatementLine.class, bsline.getId());
-      // merge if the bank statement line was split before
-      mergeBankStatementLine(bsline);
-
       FIN_FinaccTransaction finTrans = bsline.getFinancialAccountTransaction();
       if (finTrans == null) {
         String strTransactionId = vars.getStringParameter("inpFinancialTransactionId_"
@@ -894,6 +891,9 @@
       OBDal.getInstance().save(bsline);
       // OBDal.getInstance().flush();
 
+      // merge if the bank statement line was split before
+      mergeBankStatementLine(bsline);
+
       if (finTrans != null) {
         if (finTrans.getFinPayment() != null) {
           finTrans.getFinPayment().setStatus(