Fixes issue 31421: BusinessPartnerName not loaded in AddTransaction description
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Tue, 10 Nov 2015 19:05:45 +0100
changeset 28103 9e87509d3090
parent 28102 bba4162b09e1
child 28104 b2793ba35559
Fixes issue 31421: BusinessPartnerName not loaded in AddTransaction description

Add Transaction description will be loaded with Business Partner name + Bank Statement Line description, in case Business Partner name is not empty.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddTransactionFilterExpression.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddTransactionFilterExpression.java	Fri Nov 06 16:42:23 2015 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddTransactionFilterExpression.java	Tue Nov 10 19:05:45 2015 +0100
@@ -22,6 +22,7 @@
 import java.math.BigDecimal;
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -201,7 +202,17 @@
     String bankStatementLineId = context.getString("bankStatementLineId");
     FIN_BankStatementLine bankstatementline = OBDal.getInstance().get(FIN_BankStatementLine.class,
         bankStatementLineId);
-    return bankstatementline.getDescription();
+    String bpname = bankstatementline.getBpartnername();
+    String description = bankstatementline.getDescription();
+    if (StringUtils.isNotBlank(bpname)) {
+      if (StringUtils.isNotBlank(description)) {
+        return bpname + "\n" + description;
+      } else {
+        return bpname;
+      }
+    } else {
+      return description;
+    }
   }
 
   public String getDefaulDocumentCategory() {