Openbravo Issue Tracking System - Modules
View Issue Details
0056219ModulesReportingpublic2024-08-08 20:212024-08-09 13:56
ivazquez 
AtulOpenbravo 
normalminoralways
newopen 
5
 
 
0056219: Add parameter to generate the report
Add language parameter to generate the report with the function generateJasperPrint

Add new parameter and control if we dont have the parameter
1 - Generate a report.
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java 2024-06-06 08:30:24.718413000 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java 2024-08-08 15:36:32.978050000 +0200
@@ -944,16 +944,30 @@
 
   /**
    * Generates a compiled, translated and filled report into a JasperPrint object.
+ *
+ * @deprecated The compileSubreports parameter has no effect. Therefore, use
+ * {@link ReportingUtils#generateJasperPrint(String, Map, ConnectionProvider, JRDataSource, String)}
+ * instead.
+ */
+ @Deprecated
+ public static JasperPrint generateJasperPrint(String jasperFilePath,
+ Map<String, Object> parameters,
+ ConnectionProvider connectionProvider, JRDataSource data) throws OBException {
+ return generateJasperPrint(jasperFilePath, parameters, connectionProvider, data, null);
+ }
+
+ /**
+ * Generates a compiled, translated and filled report into a JasperPrint object.
    *
    * @deprecated The compileSubreports parameter has no effect. Therefore, use
- * {@link ReportingUtils#generateJasperPrint(String, Map, ConnectionProvider, JRDataSource)}
+ * {@link ReportingUtils#generateJasperPrint(String, Map, ConnectionProvider, JRDataSource, String)}
    * instead.
    */
   @Deprecated
   public static JasperPrint generateJasperPrint(String jasperFilePath,
       Map<String, Object> parameters, boolean compileSubreports,
       ConnectionProvider connectionProvider, JRDataSource data) throws OBException {
- return generateJasperPrint(jasperFilePath, parameters, connectionProvider, data);
+ return generateJasperPrint(jasperFilePath, parameters, connectionProvider, data, null);
   }
 
   /**
@@ -967,13 +981,15 @@
    * A connection provider in case the report needs it.
    * @param data
    * The data to be used in the report, if required.
+ * @param language
+ * The language to be used in the report, if required.
    * @return A JasperPrint object with the compiled, translated and filled report.
    * @throws OBException
    * In case there is any error processing the report an exception is thrown with the
    * error message.
    */
   public static JasperPrint generateJasperPrint(String jasperFilePath,
- Map<String, Object> parameters, ConnectionProvider connectionProvider, JRDataSource data)
+ Map<String, Object> parameters, ConnectionProvider connectionProvider, JRDataSource data, String language)
       throws OBException {
     long t1 = System.currentTimeMillis();
     try {
@@ -990,7 +1006,9 @@
       if (parameters.get("REPORT_QUALIFIER") != null) {
         language = getReportLanguage(parameters);
       } else {
- language = OBContext.getOBContext().getLanguage().getLanguage();
+ if (language == null) {
+ language = OBContext.getOBContext().getLanguage().getLanguage();
+ }
         log.debug(
             "The context language will be used because \"REPORT_QUALIFIER\" was not found into report parameters: {}",
             parameters, new Exception("stack trace"));
No tags attached.
Issue History
2024-08-08 20:21ivazquezNew Issue
2024-08-08 20:21ivazquezAssigned To => Triage Omni WMS
2024-08-08 21:43PracticsIssue Monitored: Practics
2024-08-09 13:56ruben_jimenezAssigned ToTriage Omni WMS => AtulOpenbravo

There are no notes attached to this issue.