details: https://code.openbravo.com/erp/devel/pi/rev/22f85795e81f changeset: 27083:22f85795e81f user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Jul 06 11:20:55 2015 +0200 summary: fixed bug 30297: selectors with display field property fail
They failed in case the display field property was not in the main property but in a referenced one. In this case, the property was tried to be obtained from the record object in an incorrect manner (path to the referred entity was removed). The fix preserves path to referred entity and checks for not null value before doing replacements in the string. diffstat: modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js | 11 ++++----- 1 files changed, 5 insertions(+), 6 deletions(-) diffs (29 lines): diff -r b815e49be324 -r 22f85795e81f modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js --- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Fri Jul 03 15:04:14 2015 +0200 +++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js Mon Jul 06 11:20:55 2015 +0200 @@ -752,7 +752,7 @@ var currentValue = this.getValue(), identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, valueMapObj = {}, - displayFieldValue, i; + valueToDisplay, i; this._notUpdatingManually = true; if (!record) { this.storeValue(null); @@ -799,12 +799,11 @@ } if (record[this.valueField]) { // it can be undefined in case of empty (null) entry - if (this.displayField.indexOf(OB.Constants.FIELDSEPARATOR) !== -1) { - displayFieldValue = this.displayField.substring(this.displayField.indexOf(OB.Constants.FIELDSEPARATOR) + 1, this.displayField.length); - } else { - displayFieldValue = this.displayField; + valueToDisplay = record[this.displayField]; + if (valueToDisplay) { + valueToDisplay = valueToDisplay.replace(/[\n\r]/g, ''); } - this.valueMap[record[this.valueField]] = record[displayFieldValue].replace(/[\n\r]/g, ''); + this.valueMap[record[this.valueField]] = valueToDisplay; } this.updateValueMap(); ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits