Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038518Openbravo ERPA. Platformpublic2018-05-10 17:492018-08-30 14:12
vmromanos 
caristu 
normalminoralways
closedfixed 
5
 
3.0PR18Q3 
alostale
Core
No
0038518: Ability of compiling subreports with HttpSecureAppServlet.renderJR
When a jrxml has a parameter that starts with SUBREP_<subreportfilename> the system should automatically compile the subreport on the fly.

This feature is not working when called from HttpSecureAppServlet.renderJR().

HttpSecureAppServlet.renderJR() line 1274 calls ReportingUtils.exportJR() that calls another implementation of ReportingUtils.exportJR():

exportJR(jasperFilePath, expType, parameters, target, addProcessDefinitionParameters,
        connectionProvider, data, additionalExportParameters, false);

The last parameter (false) controls the subreport compilation process. Since it's hardcoded to false, the subreports are never compiled.

There is no renderJR method in HttpSecureAppServlet that ends calling ReportingUtils.exportJR() to force compiling subreports
This can be reproduced in core with a hack.

Open RptM_Requisition.jrxml and add a SUBREP_RptM_Requisition_Lines parameter.
Open RptM_Requisition.java and remove subreport compilation lines:
JasperReport jasperReportLines;
    try {
      jasperReportLines = ReportingUtils.compileReport(strBaseDesign
          + "/org/openbravo/erpReports/RptM_Requisition_Lines.jrxml");
    } catch (JRException e) {
      e.printStackTrace();
      throw new ServletException(e.getMessage());
    }

    parameters.put("SR_LINES", jasperReportLines);

Try to print a requisition from the UI. No lines will be printed
No tags attached.
related to design defect 0034796 closed caristu Openbravo ERP Not possible to compile subreports automatically in process definition reports 
related to feature request 0037741 closed caristu Openbravo ERP Ability to keep in cache the compiled Jasper Reports 
related to feature request 0032329 closed platform Openbravo ERP Overload the renderJr method on HttpSecureAppServlet to allow specify to compile the subreports 
related to defect 0038647 closed caristu Retail Modules Do not compile the subreport of the CashUp report manually 
blocks defect 0038340 closed vmromanos Modules There is no possibility to put a report template for Distribution Orders in the Document Type 
blocks feature request 0038588 new Triage Omni OMS Openbravo ERP Refactor reports based on HttpSecureAppServlet.renderJR to avoid manual subreport compilation 
causes defect 0039859 closed AugustoMauch Openbravo ERP Reconciliation reports not generated 
Issue History
2018-05-10 17:49vmromanosNew Issue
2018-05-10 17:49vmromanosAssigned To => platform
2018-05-10 17:49vmromanosModules => Core
2018-05-10 17:49vmromanosTriggers an Emergency Pack => No
2018-05-10 17:49vmromanosRelationship addedrelated to 0034796
2018-05-10 17:50vmromanosRelationship addedblocks 0038340
2018-05-10 17:52caristuAssigned Toplatform => caristu
2018-05-11 09:36caristuSeveritymajor => minor
2018-05-11 15:03hgbotCheckin
2018-05-11 15:03hgbotNote Added: 0104484
2018-05-11 15:03hgbotStatusnew => resolved
2018-05-11 15:03hgbotResolutionopen => fixed
2018-05-11 15:03hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4fa9879b96470c16006ec8658000e44990752375 [^]
2018-05-11 15:32hgbotCheckin
2018-05-11 15:32hgbotNote Added: 0104485
2018-05-11 15:33caristuReview Assigned To => alostale
2018-05-11 15:34caristuTypedefect => feature request
2018-05-11 15:34caristuSummarySubreports with SUBREP_ parameter are not compiled from HttpSecureAppServlet.renderJR => Ability of compiling subreports with HttpSecureAppServlet.renderJR
2018-05-14 08:50hgbotCheckin
2018-05-14 08:50hgbotNote Added: 0104490
2018-05-14 13:09hudsonbotCheckin
2018-05-14 13:09hudsonbotNote Added: 0104499
2018-05-14 13:09hudsonbotCheckin
2018-05-14 13:09hudsonbotNote Added: 0104500
2018-05-14 13:09hudsonbotCheckin
2018-05-14 13:09hudsonbotNote Added: 0104501
2018-05-18 10:17alostaleNote Added: 0104588
2018-05-18 10:17alostaleStatusresolved => new
2018-05-18 10:17alostaleResolutionfixed => open
2018-05-18 10:20alostaleNote Edited: 0104588bug_revision_view_page.php?bugnote_id=0104588#r17159
2018-05-18 12:50hgbotCheckin
2018-05-18 12:50hgbotNote Added: 0104590
2018-05-18 12:50hgbotStatusnew => resolved
2018-05-18 12:50hgbotResolutionopen => fixed
2018-05-18 12:50hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/4fa9879b96470c16006ec8658000e44990752375 [^] => http://code.openbravo.com/erp/devel/pi/rev/3404760330bcfea180a7869095eefbabf5e760e0 [^]
2018-05-18 12:51caristuRelationship addedrelated to 0037441
2018-05-18 12:51caristuRelationship deletedrelated to 0037441
2018-05-18 12:51caristuRelationship addedrelated to 0037741
2018-05-18 13:36hgbotCheckin
2018-05-18 13:36hgbotNote Added: 0104591
2018-05-21 11:03hgbotCheckin
2018-05-21 11:03hgbotNote Added: 0104616
2018-05-21 13:58vmromanosRelationship addedblocks 0038588
2018-05-21 18:36hudsonbotCheckin
2018-05-21 18:36hudsonbotNote Added: 0104621
2018-05-21 18:36hudsonbotCheckin
2018-05-21 18:36hudsonbotNote Added: 0104622
2018-05-25 09:56alostaleNote Added: 0104702
2018-05-25 09:56alostaleStatusresolved => closed
2018-05-25 09:56alostaleFixed in Version => 3.0PR18Q3
2018-05-29 11:22caristuRelationship addedrelated to 0038647
2018-08-30 14:12caristuRelationship addedrelated to 0032329
2018-12-27 17:07SandrahuguetRelationship addedrelated to 0039859
2018-12-28 14:11AugustoMauchRelationship replacedcauses 0039859

Notes
(0104484)
hgbot   
2018-05-11 15:03   
Repository: erp/devel/pi
Changeset: 4fa9879b96470c16006ec8658000e44990752375
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri May 11 15:03:03 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4fa9879b96470c16006ec8658000e44990752375 [^]

fixes issue 38518: Ability of compiling subreports with HttpSecureAppServlet.renderJR

---
M src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
---
(0104485)
hgbot   
2018-05-11 15:32   
Repository: erp/devel/pi
Changeset: 0c8d2174716f6ff7046f70981bdb95811141a382
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri May 11 15:30:31 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/0c8d2174716f6ff7046f70981bdb95811141a382 [^]

related to issue 38518: use renderJR to compile the subreport

  Refactored the report generation to demonstrate how renderJR method can be used to compile the sub-reports.

---
M src/org/openbravo/erpReports/RptM_Requisition.java
M src/org/openbravo/erpReports/RptM_Requisition.jrxml
---
(0104490)
hgbot   
2018-05-14 08:50   
Repository: erp/devel/pi
Changeset: d96625ebe1ee34b6f5c1a045d4780fcc7ebffe29
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon May 14 08:50:07 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d96625ebe1ee34b6f5c1a045d4780fcc7ebffe29 [^]

related to issue 38518: use diamond operator

---
M src/org/openbravo/erpReports/RptM_Requisition.java
---
(0104499)
hudsonbot   
2018-05-14 13:09   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/ed385e0e027b [^]
Maturity status: Test
(0104500)
hudsonbot   
2018-05-14 13:09   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/ed385e0e027b [^]
Maturity status: Test
(0104501)
hudsonbot   
2018-05-14 13:09   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/ed385e0e027b [^]
Maturity status: Test
(0104588)
alostale   
2018-05-18 10:17   
(edited on: 2018-05-18 10:20)
Reopening after discussing current solutions:

The option not to compile subreports is available only through HSAS and BaseReportActionHandler. Originally subreports had to be manually compiled, there were to options two do so:

1. compile programatically when the report is requested
2. compile at development time and include the pre-compiled .jasper in the sources

Option 2 shouldn't be used as it skips the translation part, so subreports implemented in this way are not translatable.

In practice only option 1 is acceptable, so reports implemented in this way require developer to write code to compile all subreports to include them as parameter. This should not be necessary, only main report should be used in the API and this API should be smart enough to compile all what's needed to finally render correctly the report, so the proposal is to do in this way allways.

Not to break existent code, we'll continue allowing developers to compile subreports before main report although it will now be unnecessary and redundant. In any case as now compiled reports are now cached (0037741), this operation will not have impact on performance.

(0104590)
hgbot   
2018-05-18 12:50   
Repository: erp/devel/pi
Changeset: 3404760330bcfea180a7869095eefbabf5e760e0
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri May 18 12:42:38 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/3404760330bcfea180a7869095eefbabf5e760e0 [^]

fixes issue 38518: Compile subreports with HttpSecureAppServlet.renderJR

  It has been deprecate the ability of specifying to the reporting API if the sub-reports should be compiled or not. Instead the API is smart enough to find the subreports (if any) and compile them. Besides, note that this subreport search will be performed just once per report, because the compilation results are cached since[1].

  With this change, reports generated both with HttpSecureAppServlet and BaseReportActionHandler will compile the subreports in a transparent way, i.e., without the need of explicitly specifying it.


[1] https://issues.openbravo.com/view.php?id=37741 [^]

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/report/CompiledReportManager.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportCompiler.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java
M src/org/openbravo/base/secureApp/HttpSecureAppServlet.java
M src/org/openbravo/common/actionhandler/CashflowForecastReportActionHandler.java
M src/org/openbravo/erpCommon/utility/reporting/ReportManager.java
M src/org/openbravo/erpReports/RptM_Requisition.java
---
(0104591)
hgbot   
2018-05-18 13:36   
Repository: erp/devel/pi
Changeset: 4d0349cd40a0c47fa6216ae17c11e0f13cbf490d
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri May 18 13:36:23 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4d0349cd40a0c47fa6216ae17c11e0f13cbf490d [^]

related to issue 38518: improve javadoc

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportCompiler.java
---
(0104616)
hgbot   
2018-05-21 11:03   
Repository: retail/api-checks-retail
Changeset: 71947bc42142dc10db43616bbd839f151e8985fe
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon May 21 11:02:56 2018 +0200
URL: http://code.openbravo.com/retail/api-checks-retail/rev/71947bc42142dc10db43616bbd839f151e8985fe [^]

related to issue 38518: remove false API change

---
M java/reference/java.japi.gz
---
(0104621)
hudsonbot   
2018-05-21 18:36   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/915bf19e1d5b [^]
Maturity status: Test
(0104622)
hudsonbot   
2018-05-21 18:36   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/915bf19e1d5b [^]
Maturity status: Test
(0104702)
alostale   
2018-05-25 09:56   
reviewed + tested