details: https://code.openbravo.com/erp/devel/pi/rev/b368521a3d6d
changeset: 24298:b368521a3d6d
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Thu Jul 17 13:58:34 2014 +0200
summary: Fixes issue 26988: Whereclauses do not work on a field with Tree
Reference
The context info was not being sent to the datasource in the request.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js
| 12 +++++++--
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java
| 9 ++++++-
2 files changed, 17 insertions(+), 4 deletions(-)
diffs (62 lines):
diff -r 3b2473c7f544 -r b368521a3d6d
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js
Fri Aug 22 09:28:39 2014 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js
Thu Jul 17 13:58:34 2014 +0200
@@ -286,6 +286,8 @@
dsRequest.params._startRow = 0;
dsRequest.params._endRow = OB.Properties.TreeDatasourceFetchLimit;
dsRequest.params.treeReferenceId = target.treeItem.treeReferenceId;
+ var contextInfo = target.treeItem.form.view.getContextInfo(false, true);
+ isc.addProperties(dsRequest.params, contextInfo);
return this.Super('transformRequest', arguments);
};
@@ -516,11 +518,14 @@
setDataSource: function (ds, fields) {
var me = this;
ds.transformRequest = function (dsRequest) {
- var target = window[dsRequest.componentId];
+ var target = window[dsRequest.componentId],
+ contextInfo;
dsRequest.params = dsRequest.params || {};
dsRequest.params._startRow = 0;
dsRequest.params._endRow = OB.Properties.TreeDatasourceFetchLimit;
dsRequest.params.treeReferenceId = target.treeItem.treeReferenceId;
+ contextInfo = target.treeItem.form.view.getContextInfo(false, true);
+ isc.addProperties(dsRequest.params, contextInfo);
return this.Super('transformRequest', arguments);
};
@@ -674,11 +679,12 @@
isc.OBTreeFilterSelectItem.addProperties({
filterDataBoundPickList: function (requestProperties, dropCache) {
+ var contextInfo;
requestProperties = requestProperties || {};
requestProperties.params = requestProperties.params || {};
// on purpose not passing the third boolean param
- var contextInfo = this.treeWindow.treeItem.form.view.getContextInfo(false,
true);
-
+ contextInfo = this.treeWindow.treeItem.form.view.getContextInfo(false,
true);
+ isc.addProperties(requestProperties.params, contextInfo);
// also add the special ORG parameter
if (this.treeWindow.treeItem.form.getField('organization')) {
requestProperties.params[OB.Constants.ORG_PARAMETER] =
this.treeWindow.treeItem.form.getValue('organization');
diff -r 3b2473c7f544 -r b368521a3d6d
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java
---
a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java
Fri Aug 22 09:28:39 2014 +0200
+++
b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java
Thu Jul 17 13:58:34 2014 +0200
@@ -733,7 +733,14 @@
HashMap<String, String> replacements = new HashMap<String, String>();
while (matcher.find()) {
String contextPropertyName =
hqlTreeWhereClause.substring(matcher.start(), matcher.end());
- String value = parameters.get(contextPropertyName);
+ String value = null;
+ if (parameters.containsKey(contextPropertyName)) {
+ value = parameters.get(contextPropertyName);
+ } else if (parameters.containsKey(contextPropertyName.substring(1,
+ contextPropertyName.length() - 1))) {
+ // try again without the '@'
+ value = parameters.get(contextPropertyName.substring(1,
contextPropertyName.length() - 1));
+ }
replacements.put(contextPropertyName, "'" + value + "'");
}
String hqlCopy = new String(hqlTreeWhereClause);
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits