details: /erp/devel/pi/rev/14df8c96a8e5
changeset: 10686:14df8c96a8e5
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Feb 16 01:29:16 2011 +0100
summary: Disable derived readable check for views for now
details: /erp/devel/pi/rev/3ec064df13b5
changeset: 10687:3ec064df13b5
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Feb 16 01:30:11 2011 +0100
summary: Solved updating of parent record when child records get saved/deleted
details: /erp/devel/pi/rev/266a183f038f
changeset: 10688:266a183f038f
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Feb 16 06:43:14 2011 +0100
summary: Streamlined outfields in selector item
details: /erp/devel/pi/rev/78434f6b08ee
changeset: 10689:78434f6b08ee
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Feb 16 06:44:17 2011 +0100
summary: Merged heads
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
| 4 +
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 3 +-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
| 30 ++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 111 ++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 34 +-
modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
| 4 +-
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
| 103 +++-----
src/org/openbravo/base/structure/BaseOBObject.java
| 4 +-
8 files changed, 193 insertions(+), 100 deletions(-)
diffs (truncated from 521 to 300 lines):
diff -r 0c0137e7a99b -r 78434f6b08ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Tue Feb 15 22:35:27 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Wed Feb 16 06:44:17 2011 +0100
@@ -1014,6 +1014,10 @@
caretPosition = obj.getSelectionRange()[0];
}
setTimeout(function(){
+ // can happen when a dynamic form has already been removed
+ if (!obj.getElementValue()) {
+ return;
+ }
var inputValue = obj.getElementValue().toString();
var checkA = false; // Checks if there is a = in the beginning
var checkB = false; // Checks if any undesired = is/has to be removed
from the inputValue
diff -r 0c0137e7a99b -r 78434f6b08ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Tue Feb 15 22:35:27 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed Feb 16 06:44:17 2011 +0100
@@ -1213,7 +1213,8 @@
var recordIndex =
me.viewGrid.getRecordIndex(me.viewGrid.getSelectedRecord());
me.viewGrid.data.updateCacheData(data, req);
me.viewGrid.selectRecord(me.viewGrid.getRecord(recordIndex));
- me.viewGrid.markForRedraw();
+ me.viewGrid.refreshRow(recordIndex);
+ me.viewGrid.redraw();
}
};
diff -r 0c0137e7a99b -r 78434f6b08ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
Tue Feb 15 22:35:27 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
Wed Feb 16 06:44:17 2011 +0100
@@ -79,13 +79,41 @@
// If action is null/undefined then nothing is done and undefined is returned.
// When the action is called the result of the action is returned.
OB.Utilities.callAction = function(action){
+ function IEApplyHack(method, object, parameters) {
+ if (!object) {
+ object = window;
+ }
+ if (!parameters) {
+ parameters = [];
+ }
+
+ object.customApplyMethod = method;
+
+ var argsString = [];
+ for(var i = 0; i < parameters.length; i++) {
+ argsString[i] = 'parameters[' + i + ']';
+ }
+
+ var argsList = argsString.join(",");
+
+ var result = eval('object.customApplyMethod(' + argsList + ');');
+
+ delete object.customApplyMethod;
+
+ return result;
+ }
+
if (!action) {
return;
}
if (action.callback) {
action.callback();
} else {
- action.method.apply(action.target, action.parameters);
+ if (navigator.userAgent.toUpperCase().indexOf("MSIE") !== -1) {
+ IEApplyHack(action.method, action.target, action.parameters);
+ } else {
+ action.method.apply(action.target, action.parameters);
+ }
}
};
diff -r 0c0137e7a99b -r 78434f6b08ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Tue Feb 15 22:35:27 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Wed Feb 16 06:44:17 2011 +0100
@@ -73,7 +73,7 @@
// add the obFormProperties to ourselves, the obFormProperties
// are re-used for inline grid editing
isc.addProperties(this, this.obFormProperties);
- return this.Super('initWidget', arguments);
+ this.Super('initWidget', arguments);
},
setHasChanged: function(value) {
@@ -272,15 +272,15 @@
OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent',
allProperties, requestParams, function(response, data, request){
var editValues, editRow = me.view.viewGrid.getEditRow();
if (editRow || editRow === 0) {
- editValues =
me.view.viewGrid.getEditValues(me.view.viewGrid.getEditRow());
+ editValues = me.view.viewGrid.getEditValues(editRow);
}
- me.processFICReturn(response, data, request, editValues);
+ me.processFICReturn(response, data, request, editValues, editRow);
// remember the initial values
me.rememberValues();
});
},
- processFICReturn: function(response, data, request, editValues){
+ processFICReturn: function(response, data, request, editValues, editRow){
var modeIsNew = request.params.MODE === 'NEW';
// needs to be recomputed as for grid editing the fields
@@ -297,6 +297,23 @@
auxInputs = data.auxiliaryInputValues, prop, value, i,
dynamicCols = data.dynamicCols,
sessionAttributes = data.sessionAttributes;
+
+ // edit row has changed when returning, don't update the form anymore
+ if (this.grid && this.grid.getEditRow() !== editRow) {
+ if (columnValues) {
+ for (prop in columnValues) {
+ if (columnValues.hasOwnProperty(prop)) {
+ this.setColumnValuesInEditValues(prop, columnValues[prop],
editValues);
+ }
+ }
+ }
+ if (editValues && editValues.actionAfterFicReturn) {
+ OB.Utilities.callAction(editValues.actionAfterFicReturn);
+ delete editValues.actionAfterFicReturn;
+ }
+ return;
+ }
+
if (columnValues) {
for (prop in columnValues) {
if (columnValues.hasOwnProperty(prop)) {
@@ -333,17 +350,15 @@
this.readOnly = false;
}
- // save out the values to the grid before redrawing
- if (this.grid && this.grid.setEditValues && (this.grid.getEditRow() ||
this.grid.getEditRow() === 0)) {
- this.grid.setEditValues(this.grid.getEditRow(), this.getValues(), true);
+ // grid editing
+ if (this.grid) {
+ if (this.grid.setEditValues && this.grid.getEditRow() === editRow) {
+ this.grid.setEditValues(this.grid.getEditRow(), this.getValues(),
true);
+ this.grid.storeUpdatedEditorValue(true);
+ }
}
this.setDisabled(false);
-
- // store the new values in the edit value
- if (this.grid) {
- this.grid.storeUpdatedEditorValue(true);
- }
if (this.validateAfterFicReturn) {
delete this.validateAfterFicReturn;
@@ -367,9 +382,9 @@
delete this.callSaveAfterFICReturn;
this.saveRow(true);
}
- if (this.actionAfterFicReturn) {
- OB.Utilities.callAction(this.actionAfterFicReturn);
- delete this.actionAfterFicReturn;
+ if (editValues.actionAfterFicReturn) {
+ OB.Utilities.callAction(editValues.actionAfterFicReturn);
+ delete editValues.actionAfterFicReturn;
}
},
@@ -392,7 +407,7 @@
},
processColumnValue: function(columnName, columnValue, editValues){
- var undef, data, record, length, valuePresent, currentValue, isDate,
value, i, valueMap = {}, field = this.getFieldFromColumnName(columnName),
entries = columnValue.entries;
+ var isDate, i, valueMap = {}, field =
this.getFieldFromColumnName(columnName), entries = columnValue.entries;
// not a field on the form, probably a datasource field
var prop = this.view.getPropertyFromDBColumnName(columnName);
var id, identifier;
@@ -480,6 +495,57 @@
}
},
+ setColumnValuesInEditValues: function(columnName, columnValue, editValues){
+ var id, identifier, field = this.getFieldFromColumnName(columnName), i,
valueMap = {},
+ entries = columnValue.entries;
+ var prop = this.view.getPropertyFromDBColumnName(columnName);
+
+ // ignore the id
+ if (prop === OB.Constants.ID) {
+ return;
+ }
+
+ if (entries) {
+ for (i = 0; i < entries.length; i++) {
+ id = entries[i][OB.Constants.ID] || '';
+ identifier = entries[i][OB.Constants.IDENTIFIER] || '';
+ valueMap[id] = identifier;
+ }
+ editValues[prop + '._valueMap'] = valueMap;
+ }
+
+ if (columnValue.value && (columnValue.value === 'null' ||
columnValue.value === '')) {
+ // handle the case that the FIC returns a null value as a string
+ // should be repaired in the FIC
+ // note: do not use clearvalue as this removes the value from the form
+ editValues[prop] = null;
+ } else if (columnValue.value || columnValue.value === 0 ||
columnValue.value === false) {
+ isDate = field && field.type &&
+ (isc.SimpleType.getType(field.type).inheritsFrom === 'date' ||
+ isc.SimpleType.getType(field.type).inheritsFrom === 'datetime');
+ if (isDate) {
+ editValues[prop] = isc.Date.parseSchemaDate(columnValue.value);
+ } else {
+
+ // set the identifier/display field if the identifier is passed also
+ // note that when the field value is changed by the user the setting
+ // of the identifier field is done in the form item
+ identifier = columnValue.identifier;
+ if (!identifier && valueMap) {
+ identifier = valueMap[columnValue.value];
+ }
+ if (identifier) {
+ editValues[prop + '.' + OB.Constants.IDENTIFIER] = identifier;
+ }
+ editValues[prop] = columnValue.value;
+ }
+ } else {
+ // note: do not use clearvalue as this removes the value from the form
+ // which results it to not be sent to the server anymore
+ editValues[prop] = null;
+ }
+ },
+
// called explicitly onblur and when non-editable fields change
handleItemChange: function(item){
@@ -521,13 +587,14 @@
this.setDisabled(true);
+ var editRow = this.view.viewGrid.getEditRow();
// collect the context information
OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent',
allProperties, requestParams, function(response, data, request){
- var editValues, editRow = me.view.viewGrid.getEditRow();
+ var editValues;
if (editRow || editRow === 0) {
- editValues =
me.view.viewGrid.getEditValues(me.view.viewGrid.getEditRow());
+ editValues = me.view.viewGrid.getEditValues(editRow);
}
- me.processFICReturn(response, data, request, editValues);
+ me.processFICReturn(response, data, request, editValues, editRow);
});
},
@@ -594,6 +661,12 @@
// there the save call is done through the grid saveEditedValues
// function
saveRow: function(){
+ // store the value of the current focus item
+ if (this.getFocusItem()) {
+ this.getFocusItem().updateValue();
+ this.handleItemChange(this.getFocusItem());
+ }
+
var i, length, flds, form = this, ficCallDone;
var record = form.view.viewGrid.getSelectedRecord(), recordIndex =
form.view.viewGrid.getRecordIndex(record);
diff -r 0c0137e7a99b -r 78434f6b08ee
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Tue Feb 15 22:35:27 2011 +0100
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Wed Feb 16 06:44:17 2011 +0100
@@ -1219,23 +1219,31 @@
this.view.toolBar.updateButtonState();
}
},
-
+
+
+ // saveEdits: when saving, first check if a FIC call needs to be done to
update to the
+ // latest values. This can happen when the focus is in a field and the save
action is
+ // done, at that point first try to force a fic call (handleItemChange) and
if that
+ // indeed happens stop the saveEdit until the fic returns
saveEdits: function(editCompletionEvent, callback, rowNum, colNum,
validateOnly, ficCallDone){
if (!validateOnly && !ficCallDone) {
- if (this.getEditForm().getFocusItem() &&
this.getEditForm().handleItemChange(this.getEditForm().getFocusItem())) {
- arguments.push(true);
- this.getEditForm().actionAfterFicReturn = {
- target: this,
- method: this.saveEdits,
- parameters: arguments
- };
- } else {
- this.Super('saveEdits', arguments);
+ var editForm = this.getEditForm(), focusItem = editForm.getFocusItem();
+ if (focusItem) {
+ focusItem.updateValue();
+ editForm.handleItemChange(focusItem);
+ if (editForm.inFicCall) {
+ // use editValues object as the edit form will be re-used for a next
row
+ var editValues = this.getEditValues(rowNum || this.getEditRow());
+ editValues.actionAfterFicReturn = {
+ target: this,
+ method: this.saveEdits,
+ parameters: [editCompletionEvent, callback, this.getEditRow(),
this.getEditCol(), validateOnly, true]
+ };
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits