Fixes issue 29722: Payment navigation from Transaction tab is working wrong
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Tue, 28 Apr 2015 17:08:24 +0200
changeset 26663 f75a30df3225
parent 26662 d0523944abf6
child 26664 5350a1553674
Fixes issue 29722: Payment navigation from Transaction tab is working wrong

Issotrx auxiliary input query in Transaction tab has been changed to get into account related payment isreceipt field, when navigating from it to Payment In/Out window
Also, SE_Payment_Transaction and SE_Trxtype_Transaction callouts have been changed to overwrite issotrx session value when updating payment or transactiontype fields
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
src/org/openbravo/erpCommon/ad_callouts/SE_Payment_Transaction.java
src/org/openbravo/erpCommon/ad_callouts/SE_Trxtype_Transaction.java
--- a/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Tue Apr 28 12:07:49 2015 +0200
+++ b/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Tue Apr 28 17:08:24 2015 +0200
@@ -3680,7 +3680,7 @@
 <!--DCA04CBCB2454C7690E5F131326F06EF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--DCA04CBCB2454C7690E5F131326F06EF-->  <AD_TAB_ID><![CDATA[23691259D1BD4496BCC5F32645BCA4B9]]></AD_TAB_ID>
 <!--DCA04CBCB2454C7690E5F131326F06EF-->  <NAME><![CDATA[IsSOTrx]]></NAME>
-<!--DCA04CBCB2454C7690E5F131326F06EF-->  <CODE><![CDATA[@SQL=select case when trxtype = 'BPW' then 'N' else 'Y' end from fin_finacc_transaction where fin_finacc_transaction_id = @fin_finacc_transaction_id@]]></CODE>
+<!--DCA04CBCB2454C7690E5F131326F06EF-->  <CODE><![CDATA[@SQL=select case when t.fin_payment_id is not null then case when p.isreceipt = 'Y' then 'Y' else 'N' end else case when t.trxtype = 'BPW' then 'N' else 'Y' end end from fin_finacc_transaction t left join fin_payment p on t.fin_payment_id = p.fin_payment_id where t.fin_finacc_transaction_id = @fin_finacc_transaction_id@]]></CODE>
 <!--DCA04CBCB2454C7690E5F131326F06EF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--DCA04CBCB2454C7690E5F131326F06EF--></AD_AUXILIARINPUT>
 
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Payment_Transaction.java	Tue Apr 28 12:07:49 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Payment_Transaction.java	Tue Apr 28 17:08:24 2015 +0200
@@ -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) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -49,6 +49,12 @@
         info.addResult("inpdepositamt", BigDecimal.ZERO);
         info.addResult("inppaymentamt", payment.getFinancialTransactionAmount().abs());
       }
+      String strWindowId = info.getStringParameter("inpwindowId", null);
+      if (payment.isReceipt()) {
+        info.vars.setSessionValue(strWindowId + "|IsSOTrx", "Y");
+      } else {
+        info.vars.setSessionValue(strWindowId + "|IsSOTrx", "N");
+      }
       if (payment.getBusinessPartner() != null) {
         info.addResult("inpcBpartnerId", payment.getBusinessPartner().getId());
       }
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_Trxtype_Transaction.java	Tue Apr 28 12:07:49 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_Trxtype_Transaction.java	Tue Apr 28 17:08:24 2015 +0200
@@ -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) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -30,20 +30,24 @@
   protected void execute(CalloutInfo info) throws ServletException {
     try {
       final String strTrxType = info.getStringParameter("inptrxtype", null);
+      String strWindowId = info.getStringParameter("inpwindowId", null);
       if ("BF".equals(strTrxType)) {
         info.addResult("inpfinPaymentId", null);
         info.addResult("inpcGlitemId", null);
         info.addResult("inpdepositamt", BigDecimal.ZERO);
         info.addResult("inppaymentamt", BigDecimal.ZERO);
         info.addResult("inpissotrx", "Y");
+        info.vars.setSessionValue(strWindowId + "|IsSOTrx", "Y");
       } else if ("BPW".equals(strTrxType)) {
         info.addResult("inpfinPaymentId", null);
         info.addResult("inpdepositamt", BigDecimal.ZERO);
         info.addResult("inpissotrx", "N");
+        info.vars.setSessionValue(strWindowId + "|IsSOTrx", "N");
       } else if ("BPD".equals(strTrxType)) {
         info.addResult("inpfinPaymentId", null);
         info.addResult("inppaymentamt", BigDecimal.ZERO);
         info.addResult("inpissotrx", "Y");
+        info.vars.setSessionValue(strWindowId + "|IsSOTrx", "Y");
       }
     } catch (Exception e) {
       return;