Fixes issue 15400: Transaction duplicated when running process in parallel
authorMikel Irurita <mikel.irurita@openbravo.com>
Thu, 16 Dec 2010 17:17:34 +0100
changeset 9229 b1c69dc8f7d1
parent 9228 25fbf154672c
child 9230 ffab787bf3a9
Fixes issue 15400: Transaction duplicated when running process in parallel
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.java
src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml
src-db/database/sourcedata/AD_MESSAGE.xml
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.java	Thu Dec 16 16:34:39 2010 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.java	Thu Dec 16 17:17:34 2010 +0100
@@ -243,7 +243,9 @@
       }
 
     } catch (Exception e) {
-      throw new OBException(e);
+      OBError newError = Utility.translateError(this, vars, vars.getLanguage(), FIN_Utility
+          .getExceptionMessage(e));
+      throw new OBException(newError.getMessage());
     } finally {
       OBContext.restorePreviousMode();
     }
--- a/src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml	Thu Dec 16 16:34:39 2010 +0100
+++ b/src-db/database/model/tables/FIN_FINACC_TRANSACTION.xml	Thu Dec 16 17:17:34 2010 +0100
@@ -147,5 +147,8 @@
       <foreign-key foreignTable="FIN_PAYMENT" name="FIN_PAYMENT_TRANSACTION">
         <reference local="FIN_PAYMENT_ID" foreign="FIN_PAYMENT_ID"/>
       </foreign-key>
+      <unique name="FIN_FINACC_TRANSACTION_UN">
+        <unique-column name="FIN_PAYMENT_ID"/>
+      </unique>
     </table>
   </database>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Dec 16 16:34:39 2010 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Dec 16 17:17:34 2010 +0100
@@ -29542,6 +29542,18 @@
 <!--01C801B95D4A44E2956F9057C7E38A6A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--01C801B95D4A44E2956F9057C7E38A6A--></AD_MESSAGE>
 
+<!--01E9E568C781498CB5FB53035B47CB14--><AD_MESSAGE>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <AD_MESSAGE_ID><![CDATA[01E9E568C781498CB5FB53035B47CB14]]></AD_MESSAGE_ID>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <VALUE><![CDATA[FIN_FINACC_TRANSACTION_UN]]></VALUE>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <MSGTEXT><![CDATA[<br/>You are trying to add a transaction for a payment that was already added by another user/process.
+<br/>No transaction has been created. Please click on close button, refresh the window and try it again.]]></MSGTEXT>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--01E9E568C781498CB5FB53035B47CB14-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--01E9E568C781498CB5FB53035B47CB14--></AD_MESSAGE>
+
 <!--02758CBBA66D42108380E648EF7C026E--><AD_MESSAGE>
 <!--02758CBBA66D42108380E648EF7C026E-->  <AD_MESSAGE_ID><![CDATA[02758CBBA66D42108380E648EF7C026E]]></AD_MESSAGE_ID>
 <!--02758CBBA66D42108380E648EF7C026E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>