src/org/openbravo/erpCommon/ad_reports/ReportPendingProductionJr_data.xsql
author Asier Lostalé <asier.lostale@openbravo.com>
Thu, 26 Mar 2020 12:25:43 +0100
changeset 37227 0ef412c29220
parent 22050 c3bb94a4b13f
permissions -rw-r--r--
fixed BUG-43532: jrxml translate build step fails if using jasperreport.dtd

Translate makes use of a custom EntityResolver to handle jasperreport.dtd
resolving it locally instead of getting it from Internet. This local
resolution is implemented making use of Class.getResourceAsStream
method. The class the method was invoked from was java.lang.System.

Starting from JDK 9, getResourceAsStream invoked in classes within named
Modules looks for the resources only in those modules rather than in the
whole classpath [1]:

> If this class is in a named Module then this method will attempt to find
> the resource in the module. This is done by delegating to the module's class
> loader findResource(String,String) method, invoking it with the module name
> and the absolute name of the resource. Resources in named modules are subject
> to the rules for encapsulation specified in the Module getResourceAsStream
> method and so this method returns null when the resource is a non-".class"
> resource in a package that is not open to the caller's module.
>
> Otherwise, if this class is not in a named module then the rules for searching
> resources associated with a given class are implemented by the defining class
> loader of the class. This method delegates to this object's class loader. If
> this object was loaded by the bootstrap class loader, the method delegates to
> ClassLoader.getSystemResourceAsStream(java.lang.String).

As java.lang.System is in a named Module, dtd's resource was tried to be found within
it and not found.

Fixed by invoking getResourceAsStream on LocalEntityResolver.class which
is not in a named module.

[1] https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String)
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
 * All portions are Copyright (C) 2001-2010 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->




<SqlClass name="ReportPendingProductionJrData" package="org.openbravo.erpCommon.ad_reports">
   <SqlClassComment></SqlClassComment>
   <SqlMethod name="select" type="preparedStatement" return="multiple">
      <SqlMethodComment></SqlMethodComment>
      <Sql>
      <![CDATA[
        SELECT C_ORDER.DOCUMENTNO AS DOCNO, C_ORDER.DATEORDERED AS ORDERED, C_ORDER.DATEPROMISED AS PROMISED,
             C_BPARTNER.NAME AS BPNAME, C_REGION.NAME AS RNAME, M_PRODUCT.VALUE, M_PRODUCT.NAME AS PNAME,
             C_ORDERLINE.QTYORDERED, STORAGE_DETAIL.QTYONHAND, STORAGE_DETAIL.PREQTYONHAND,
              CASE  WHEN C_ORDERLINE.QTYORDERED - STORAGE_DETAIL.QTYONHAND - STORAGE_DETAIL.PREQTYONHAND>0 THEN 'Color' ELSE 'Bordes' END AS NEGATIVE
         FROM C_ORDER, C_ORDERLINE, C_BPARTNER, M_PRODUCT, C_BPARTNER_LOCATION, C_LOCATION, C_REGION,
            (SELECT M_PRODUCT_ID, SUM(QTYONHAND) AS QTYONHAND, SUM(PREQTYONHAND) AS PREQTYONHAND  
             FROM M_STORAGE_DETAIL GROUP BY M_STORAGE_DETAIL.M_PRODUCT_ID) STORAGE_DETAIL 
         WHERE C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
           AND C_ORDER.C_BPARTNER_ID = C_BPARTNER.C_BPARTNER_ID
           AND C_ORDERLINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
           AND STORAGE_DETAIL.M_PRODUCT_ID = C_ORDERLINE.M_PRODUCT_ID
           AND C_BPARTNER_LOCATION.C_BPARTNER_LOCATION_ID = C_ORDER.C_BPARTNER_LOCATION_ID
           AND C_BPARTNER_LOCATION.C_LOCATION_ID = C_LOCATION.C_LOCATION_ID
           AND C_LOCATION.C_REGION_ID = C_REGION.C_REGION_ID
           AND C_ORDER.DOCSTATUS='CO'
           AND C_ORDER.C_ORDER_ID IN (SELECT C_Order_ID FROM M_InOut_Candidate_v)
           AND C_ORDER.ISSOTRX='Y' 
           AND C_ORDER.AD_CLIENT_ID IN ('1')
           AND C_ORDER.AD_ORG_ID IN ('1')
         ORDER BY C_ORDER.DATEORDERED
      ]]>
      </Sql>
    <Parameter name="adUserClient" type="replace" optional="true" after="AND C_ORDER.AD_CLIENT_ID IN (" text="'1'"/>  
    <Parameter name="adUserOrg" type="replace" optional="true" after="AND C_ORDER.AD_ORG_ID IN (" text="'1'"/>
   </SqlMethod>

</SqlClass>