details: /erp/devel/pi/rev/ee94070649ad
changeset: 11569:ee94070649ad
user: Iván Perdomo <ivan.perdomo <at> openbravo.com>
date: Tue Apr 12 20:26:57 2011 +0200
summary: Fixes issue 16769: Filter the warehouses based on the -natural tree-
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
| 11 +++++----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (32 lines):
diff -r 5976e82afd0b -r ee94070649ad
modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
Tue Apr 12 16:31:51 2011 +0200
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
Tue Apr 12 20:26:57 2011 +0200
@@ -42,6 +42,7 @@
import org.openbravo.client.kernel.StaticResourceComponent;
import org.openbravo.dal.core.DalUtil;
import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.security.OrganizationStructureProvider;
import org.openbravo.dal.service.OBCriteria;
import org.openbravo.dal.service.OBDal;
import org.openbravo.dal.service.OBQuery;
@@ -190,15 +191,15 @@
private JSONArray getWarehouses(String clientId) throws JSONException {
List<JSONObject> orgWarehouseArray = new ArrayList<JSONObject>();
+ final OrganizationStructureProvider osp = OBContext.getOBContext()
+ .getOrganizationStructureProvider(clientId);
OBCriteria<Organization> orgs =
OBDal.getInstance().createCriteria(Organization.class);
for (Organization org : orgs.list()) {
JSONObject orgWarehouse = new JSONObject();
orgWarehouse.put("orgId", org.getId());
- final OBQuery<Warehouse> warehouses = OBDal
- .getInstance()
- .createQuery(Warehouse.class,
- "ad_isorgincluded(organization.id, :orgId, :clientId)<>-1 and
client.id=:clientId order by name");
- warehouses.setNamedParameter("orgId", org.getId());
+ final OBQuery<Warehouse> warehouses =
OBDal.getInstance().createQuery(Warehouse.class,
+ "organization.id in (:orgList) and client.id=:clientId order by
name");
+ warehouses.setNamedParameter("orgList", osp.getNaturalTree(org.getId()));
warehouses.setNamedParameter("clientId", clientId);
warehouses.setFilterOnReadableClients(false);
warehouses.setFilterOnReadableOrganization(false);
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits