details: /erp/devel/pi/rev/116849a2c4b4
changeset: 11434:116849a2c4b4
user: Antonio Moreno <antonio.moreno <at> openbravo.com>
date: Fri Apr 01 16:29:43 2011 +0200
summary: Related to issue 16582. When a callout returns a combo, its values
will be used even if no row is selected.
In that case, the first element will be selected by default.
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
| 35 ++-------
1 files changed, 10 insertions(+), 25 deletions(-)
diffs (54 lines):
diff -r 2bae90f9419d -r 116849a2c4b4
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Fri Apr 01 15:41:35 2011 +0200
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Fri Apr 01 16:29:43 2011 +0200
@@ -942,40 +942,25 @@
entry.put(JsonConstants.ID, subelement.get(0, null));
entry.put(JsonConstants.IDENTIFIER,
subelement.get(1, null));
comboEntries.add(entry);
- if (subelement.get(2,
null).toString().equalsIgnoreCase("True")) {
+ if (j == 0 || subelement.get(2,
null).toString().equalsIgnoreCase("True")) {
+ // We always initially select the first element
returned by the callout,
+ // and after that, we select the one which is
marke as selected "true"
UIDefinition uiDef =
UIDefinitionController.getInstance()
.getUIDefinition(col.getId());
String newValue = subelement.get(0,
null).toString();
jsonobject.put("value", newValue);
jsonobject.put("classicValue",
uiDef.convertToClassicString(newValue));
log.debug("Column: " + col.getDBColumnName() + "
Value: " + newValue);
- String oldValue = rq.getRequestParameter(colId);
- if (uiDef.getDomainType() instanceof
PrimitiveDomainType) {
- String classicValue =
uiDef.convertToClassicString(newValue);
- if (classicValue != null &&
classicValue.equals("null")) {
- classicValue = null;
- }
- rq.setRequestParameter(colId, classicValue);
- } else {
- rq.setRequestParameter(colId, newValue == null
- || newValue.equals("null") ? null :
newValue.toString());
- }
- if ((oldValue == null && newValue != null)
- || (oldValue != null && newValue == null)
- || (oldValue != null && newValue != null &&
!oldValue
- .equals(newValue))) {
- columnValues.put(colId, jsonobject);
- changed = true;
- if (dynamicCols.contains(colId)) {
- changedCols.add(col.getDBColumnName());
- }
- } else {
- log
- .debug("Column value didn't change. We do
not attempt to execute any additional callout");
- }
}
}
}
+ // If the callout returns a combo, we in any case set
the new value with what
+ // the callout returned
+ columnValues.put(colId, jsonobject);
+ changed = true;
+ if (dynamicCols.contains(colId)) {
+ changedCols.add(col.getDBColumnName());
+ }
jsonobject.put("entries", new JSONArray(comboEntries));
} else {
// Normal data
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits