# HG changeset patch # User Augusto Mauch # Date 1419874498 -3600 # Mon Dec 29 18:34:58 2014 +0100 # Node ID bfe6bcb03fa3a68f8056193a3de1fcf8fb8ac089 # Parent fbc674d56f047b43b679e4092bd57a0c13b81385 Fixes issue 24577: Direct link works properly in grids with implicit filters When a view was open by pasting a URL link (either in the address bar or in the quick view), the implicit filter of the header grid was always applied, even if the filters had been clea red before obtaining the link. This has been fixed by storing in the URL info about the grid filter clause state when the link is obtained. Then, when opening a view from that link, if there were no filter clauses wh en the link was obtained, the grid will be initialized without them. diff --git a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js @@ -469,6 +469,13 @@ }; } + if (this.view.isRootView && this.view.standardWindow.emptyFilterClause) { + // this.view.standardWindow.emptyFilterClause will be true if the grid is being built based on + // an URL that was obtained from a grid that either did not have originally a filterClause or + // whose filters had been cleared + delete this.filterClause; + } + var ret = this.Super('initWidget', arguments); // only show summary rows if there are summary functions diff --git a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js @@ -745,6 +745,11 @@ })) + '&'; } } + if (!this.viewGrid.filterClause) { + // if the grid does not currently have a filterClause (i.e. because the filters have been cleared), make it explicit in the URL + // this way the filter clause can be removed when building a grid based on this URL (see issue https://issues.openbravo.com/view.php?id=24577) + url = url + '&emptyFilterClause=true'; + } } return url; diff --git a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js @@ -385,6 +385,10 @@ } } + if (urlParams.emptyFilterClause) { + view.emptyFilterClause = urlParams.emptyFilterClause; + } + if (urlParams.replaceDefaultFilter) { view.replaceDefaultFilter = urlParams.replaceDefaultFilter; }