details: https://code.openbravo.com/erp/devel/pi/rev/c066615ff473 changeset: 33034:c066615ff473 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue Nov 21 16:21:53 2017 +0100 summary: related to issue 36778: Clean up unused variables
details: https://code.openbravo.com/erp/devel/pi/rev/2a22d8f5a9db changeset: 33035:2a22d8f5a9db user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue Nov 21 13:43:40 2017 +0100 summary: fixes bug 36778: Wrong message shown in tree selector when reaching fetch limit Added the ability to show an error message in the drop-down of an tree form item when the request fetches a number of nodes higher than the established limit. diffstat: modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml | 12 +++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js | 31 ++++++--- modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.css | 13 +++- modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.js | 3 +- modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-tree-grid-styles.js | 3 +- modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js | 5 +- 6 files changed, 49 insertions(+), 18 deletions(-) diffs (222 lines): diff -r 34f3cf610264 -r 2a22d8f5a9db modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml Tue Nov 21 13:43:40 2017 +0100 @@ -336,6 +336,18 @@ <!--16EF30EF95D94CB2A93129015A363315--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> <!--16EF30EF95D94CB2A93129015A363315--></AD_MESSAGE> +<!--1A0108DBD48D4F3496569E662C7475CE--><AD_MESSAGE> +<!--1A0108DBD48D4F3496569E662C7475CE--> <AD_MESSAGE_ID><![CDATA[1A0108DBD48D4F3496569E662C7475CE]]></AD_MESSAGE_ID> +<!--1A0108DBD48D4F3496569E662C7475CE--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--1A0108DBD48D4F3496569E662C7475CE--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--1A0108DBD48D4F3496569E662C7475CE--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--1A0108DBD48D4F3496569E662C7475CE--> <VALUE><![CDATA[OBUIAPP_TooManyResults]]></VALUE> +<!--1A0108DBD48D4F3496569E662C7475CE--> <MSGTEXT><![CDATA[Your search returned too many results. Please refine your search terms.]]></MSGTEXT> +<!--1A0108DBD48D4F3496569E662C7475CE--> <MSGTYPE><![CDATA[E]]></MSGTYPE> +<!--1A0108DBD48D4F3496569E662C7475CE--> <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID> +<!--1A0108DBD48D4F3496569E662C7475CE--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> +<!--1A0108DBD48D4F3496569E662C7475CE--></AD_MESSAGE> + <!--1B783EC678E644E385778D2D7D25A97B--><AD_MESSAGE> <!--1B783EC678E644E385778D2D7D25A97B--> <AD_MESSAGE_ID><![CDATA[1B783EC678E644E385778D2D7D25A97B]]></AD_MESSAGE_ID> <!--1B783EC678E644E385778D2D7D25A97B--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 34f3cf610264 -r 2a22d8f5a9db 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 Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-tree.js Tue Nov 21 13:43:40 2017 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2013-2016 Openbravo SLU + * All portions are Copyright (C) 2013-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -112,8 +112,7 @@ }, openTreeWindow: function () { - var selectedValue = this.getValue(), - criteria, innerCriteria; + var selectedValue = this.getValue(); if (this.treeWindow.treeGrid) { //If there is a record selected in the item, use it to filter the tree // check if the value is present in the value map to ensure it is the id of the selected item @@ -166,8 +165,7 @@ setValueFromRecord: function (record) { var currentValue = this.getValue(), - identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, - i; + identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER; if (!record) { this.storeValue(null); this.form.setValue(this.name + OB.Constants.FIELDSEPARATOR + this.displayField, null); @@ -228,6 +226,7 @@ init: function () { OB.Datasource.get(this.treeItem.dataSourceId, this, null, true); this.Super('init', arguments); + this.originalEmptyMessage = this.emptyMessage; }, dataArrived: function () { @@ -244,17 +243,29 @@ me.scrollRecordIntoView(rowNum, true); }, 100); } + // Restore the empty message of the tree grid + // It may have been changed with the showErrorMessageInPicker() function in previous DS requests + this.emptyMessage = this.originalEmptyMessage; }, show: function (explicitCriteria) { this.updatePosition(); + this.emptyMessage = this.originalEmptyMessage; this.fetchData(explicitCriteria); this._pageClickID = this.ns.Page.setEvent('mouseDown', this, null, 'clickOutsideTree'); return this.Super('show', arguments); }, + showErrorMessageInPicker: function (message) { + if (!this.isVisible()) { + return; + } + this.emptyMessage = '<span class="' + this.errorMessageStyle + '">' + message + '</span>'; + this.body.markForRedraw(); + }, + clickOutsideTree: function () { - var target, event, eventInfo; + var target, eventInfo; if (!this.isVisible()) { return; } @@ -271,8 +282,7 @@ }, updatePosition: function () { - var me = this, - interval, treeItemWidth; + var treeItemWidth; if (this.treeItem) { treeItemWidth = this.treeItem.getVisibleWidth(); if (treeItemWidth && treeItemWidth > this.getWidth()) { @@ -337,8 +347,6 @@ //Select the record rowDoubleClick: function (record, recordNum, fieldNum) { - var id = record[OB.Constants.ID], - identifier = record[OB.Constants.IDENTIFIER]; if (!this.treeItem.parentSelectionAllowed && this.data.hasChildren(record)) { return; } @@ -478,8 +486,7 @@ }, dataArrived: function () { - var record, rowNum, i, selectedRecords = [], - ds, ids, me = this; + var record, rowNum, me = this; this.Super('dataArrived', arguments); if (this.treeItem.targetRecordId) { record = this.data.find(OB.Constants.ID, this.treeItem.targetRecordId); diff -r 34f3cf610264 -r 2a22d8f5a9db modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.css --- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.css Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.css Tue Nov 21 13:43:40 2017 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2013 Openbravo SLU + * All portions are Copyright (C) 2010-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -343,14 +343,23 @@ text-decoration: underline; } -.OBGridNotificationText { +.OBGridNotificationText, +.OBGridNotificationTextError { font-family: 'lucida sans', sans-serif; font-size: 12px; vertical-align: middle; background: transparent; +} + +.OBGridNotificationText { padding: 5px 0px 5px 0px; } +.OBGridNotificationTextError { + color: #CC6600; + padding: 5px 10px 5px 10px; +} + .OBGridNotificationTextLink, .OBGridNotificationTextLinkOver, .OBGridNotificationTextLinkDown, diff -r 34f3cf610264 -r 2a22d8f5a9db modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.js --- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.js Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-grid-styles.js Tue Nov 21 13:43:40 2017 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2013 Openbravo SLU + * All portions are Copyright (C) 2010-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -33,6 +33,7 @@ headerTitleStyle: 'OBGridHeaderCellTitle', emptyMessageStyle: 'OBGridNotificationText', emptyMessageLinkStyle: 'OBGridNotificationTextLink', + errorMessageStyle: 'OBGridNotificationTextError', cellPadding: 0, /* Set in the CSS */ cellAlign: 'center', diff -r 34f3cf610264 -r 2a22d8f5a9db modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-tree-grid-styles.js --- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-tree-grid-styles.js Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/org.openbravo.client.application/ob-tree-grid-styles.js Tue Nov 21 13:43:40 2017 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2014 Openbravo SLU + * All portions are Copyright (C) 2014-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -33,6 +33,7 @@ headerTitleStyle: 'OBGridHeaderCellTitle', emptyMessageStyle: 'OBGridNotificationText', emptyMessageLinkStyle: 'OBGridNotificationTextLink', + errorMessageStyle: 'OBGridNotificationTextError', cellPadding: 0, /* Set in the CSS */ cellAlign: 'center', diff -r 34f3cf610264 -r 2a22d8f5a9db modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js --- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Mon Nov 13 13:52:55 2017 +0100 +++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js Tue Nov 21 13:43:40 2017 +0100 @@ -103,6 +103,9 @@ if (target && target.view) { target.view.messageBar.setMessage('error', null, OB.I18N.getLabel('OBUIAPP_TooManyNodes')); } + if (target && target.treeItem && target.treeItem.tree) { + target.treeItem.tree.showErrorMessageInPicker(OB.I18N.getLabel('OBUIAPP_TooManyResults')); + } return; } @@ -274,9 +277,7 @@ operator: 'and', criteria: [] }, - crit = result.criteria, valueParts = [], - allowEx = true, ds = isc.DS.get(this.form.expressionDataSource || this.form.dataSource); if (!value) { ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits