Fixes issue 27064: Default Value for Payment Date in Add Details popup in Payment In/Out is incorrect
authorUnai Martirena <unai.martirena@openbravo.com>
Fri, 18 Jul 2014 12:49:36 +0200
changeset 24174 f2e505b2c964
parent 24173 068ce411734f
child 24175 8c5e2f247bdf
Fixes issue 27064: Default Value for Payment Date in Add Details popup in Payment In/Out is incorrect
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Fri Jul 18 12:49:36 2014 +0200
@@ -19,7 +19,6 @@
 package org.openbravo.advpaymentmngt.filterexpression;
 
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -31,7 +30,6 @@
 import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
 import org.openbravo.advpaymentmngt.utility.FIN_Utility;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.common.businesspartner.BusinessPartner;
 import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount;
@@ -68,6 +66,8 @@
 
   abstract String getOrganization(Map<String, String> requestMap) throws JSONException;
 
+  abstract String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException;
+
   protected abstract long getSeq();
 
   String getDefaultCurrencyTo(Map<String, String> requestMap) throws JSONException {
@@ -143,10 +143,6 @@
     return null;
   }
 
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
-    return OBDateUtils.formatDate(new Date());
-  }
-
   String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     if (context.has("inpfinPaymentmethodId")
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -26,6 +26,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.financialmgmt.payment.FIN_Payment;
 
 @ComponentProvider.Qualifier(APRMConstants.PAYMENT_IN_WINDOW_ID)
@@ -143,4 +144,10 @@
     return getPayment(requestMap).getOrganization().getId();
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    // Payment Date of the current payment
+    return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -26,6 +26,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.financialmgmt.payment.FIN_Payment;
 
 @ComponentProvider.Qualifier(APRMConstants.PAYMENT_OUT_WINDOW_ID)
@@ -154,4 +155,10 @@
     return getPayment(requestMap).getOrganization().getId();
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    // Payment Date of the current payment
+    return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.advpaymentmngt.filterexpression;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Map;
 
 import org.codehaus.jettison.json.JSONException;
@@ -26,6 +27,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.common.invoice.Invoice;
 
 @ComponentProvider.Qualifier(APRMConstants.PURCHASE_INVOICE_WINDOW_ID)
@@ -127,4 +129,9 @@
     return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    return OBDateUtils.formatDate(new Date());
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.advpaymentmngt.filterexpression;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Map;
 
 import org.codehaus.jettison.json.JSONException;
@@ -26,6 +27,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.common.order.Order;
 
 @ComponentProvider.Qualifier(APRMConstants.PURCHASE_ORDER_WINDOW_ID)
@@ -131,4 +133,9 @@
     return OBDal.getInstance().get(Order.class, context.getString("inpcOrderId"));
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    return OBDateUtils.formatDate(new Date());
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.advpaymentmngt.filterexpression;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Map;
 
 import org.codehaus.jettison.json.JSONException;
@@ -26,6 +27,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.common.invoice.Invoice;
 
 @ComponentProvider.Qualifier(APRMConstants.SALES_INVOICE_WINDOW_ID)
@@ -127,4 +129,9 @@
     return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    return OBDateUtils.formatDate(new Date());
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Mon Jul 21 10:18:17 2014 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Fri Jul 18 12:49:36 2014 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.advpaymentmngt.filterexpression;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Map;
 
 import org.codehaus.jettison.json.JSONException;
@@ -26,6 +27,7 @@
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.model.common.order.Order;
 
 @ComponentProvider.Qualifier(APRMConstants.SALES_ORDER_WINDOW_ID)
@@ -131,4 +133,9 @@
     return OBDal.getInstance().get(Order.class, context.getString("inpcOrderId"));
   }
 
+  @Override
+  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+    return OBDateUtils.formatDate(new Date());
+  }
+
 }