details:   https://code.openbravo.com/erp/devel/pi/rev/2cea82959e2d
changeset: 32203:2cea82959e2d
user:      Mark <markmm82 <at> gmail.com>
date:      Mon May 22 10:24:17 2017 -0400
summary:   Fixes issue 35872: Fixed Payment Report performance problems

We have changed following condition:
where (fpd is not null or invps is not null)
with this one:
where (fpsd.paymentDetails is not null or fpsd.invoicePaymentSchedule is not 
null)
in order to use fin_payment_scheduledetail table and avoid join with
fin_payment_detail and fin_payment_schedule tables when both have null values.

Also was removed duplicated filter by organization.

diffstat:

 
modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
 |  12 +++++----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 78f84b2b36fc -r 2cea82959e2d 
modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
--- 
a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
        Thu May 25 10:32:49 2017 +0200
+++ 
b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java
        Mon May 22 10:24:17 2017 -0400
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2009-2016 Openbravo SL 
+ * All portions are Copyright (C) 2009-2017 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -298,12 +298,14 @@
       } else if (StringUtils.isNotEmpty(strFinancialAccountId)) {
         hsqlScript.append(" left join inv.businessPartner as invbp");
       }
-      hsqlScript.append(" where (fpd is not null or invps is not null)");
-      hsqlScript.append(" and fpsd.organization.id in ");
-      
hsqlScript.append(concatOrganizations(OBContext.getOBContext().getReadableOrganizations()));
+      hsqlScript
+          .append(" where (fpsd.paymentDetails is not null or 
fpsd.invoicePaymentSchedule is not null)");
 
       // organization + include sub-organization
-      if (!strOrg.isEmpty()) {
+      if (StringUtils.isEmpty(strOrg) || StringUtils.equals(strOrg, "0")) {
+        hsqlScript.append(" and fpsd.organization.id in ");
+        
hsqlScript.append(concatOrganizations(OBContext.getOBContext().getReadableOrganizations()));
+      } else {
         if (!strInclSubOrg.equalsIgnoreCase("include")) {
           hsqlScript.append(" and fpsd.");
           hsqlScript.append(FIN_PaymentScheduleDetail.PROPERTY_ORGANIZATION);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to