details:   https://code.openbravo.com/erp/devel/pi/rev/3c5c9d991b1e
changeset: 35724:3c5c9d991b1e
user:      Nono Carballo <nonofce <at> gmail.com>
date:      Tue May 07 13:26:05 2019 +0200
summary:   Fixes issue 40698: Filters accounting reports by organization.

Prior this fix, when selecting accounting reports, organizations the role has
access were not considered.
This fix retrieves accounting reports considering organizations the current
role has access.

diffstat:

 src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java      |  2 
+-
 src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql |  8 
+++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 804489012532 -r 3c5c9d991b1e 
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java      
Tue May 07 12:58:29 2019 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java      
Tue May 07 13:26:05 2019 +0200
@@ -694,7 +694,7 @@
     }
     xmlDocument.setParameter("orgs", Utility.arrayDobleEntrada("arrOrgs", new 
FieldProvider[0]));
     xmlDocument.setParameter("accountingReports", 
Utility.arrayDobleEntrada("arrAccountingReports",
-        GeneralAccountingReportsData.selectRptDouble(readOnlyCP)));
+        GeneralAccountingReportsData.selectRptDouble(readOnlyCP, 
OBContext.getOBContext().getRole().getId())));
     xmlDocument.setParameter("years", Utility.arrayDobleEntrada("arrYears", 
new FieldProvider[0]));
     response.setContentType("text/html; charset=UTF-8");
     PrintWriter out = response.getWriter();
diff -r 804489012532 -r 3c5c9d991b1e 
src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql 
Tue May 07 12:58:29 2019 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports_data.xsql 
Tue May 07 13:26:05 2019 +0200
@@ -12,7 +12,7 @@
  * 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-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -46,12 +46,14 @@
    </SqlMethod>
    <SqlMethod name="selectRptDouble" type="preparedStatement" 
return="multiple">
       <SqlMethodComment></SqlMethodComment>
-      <Sql>
+      <Sql><![CDATA[
                SELECT C_ACCT_RPT.C_ACCTSCHEMA_ID AS PADRE, 
COALESCE(REPORTTYPE,'N') || C_ACCT_RPT.C_ACCT_RPT_ID AS ID, C_ACCT_RPT.NAME AS 
NAME 
                FROM C_ACCT_RPT
                WHERE C_ACCT_RPT.ISACTIVE = 'Y'
+               AND EXISTS (SELECT 1 FROM AD_ROLE_ORGACCESS WHERE 
AD_ROLE_ORGACCESS.AD_ORG_ID = C_ACCT_RPT.AD_ORG_ID AND 
AD_ROLE_ORGACCESS.ISACTIVE = 'Y' AND AD_ROLE_ID = ?)   
                ORDER BY NAME
-      </Sql>
+      ]]></Sql>
+      <Parameter name="roleId"/>
    </SqlMethod>
       
     <SqlMethod name="selectGroups" type="preparedStatement" return="multiple">


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to