From 322f8a2a6db70562fc8c61fa9062568daf2cec94 Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Sun, 30 Jan 2022 11:50:47 +0100 Subject: [PATCH 1/3] Fix: Exception thrown in "Search Assets" window --- .../AdminBundle/Controller/Searchadmin/SearchController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/AdminBundle/Controller/Searchadmin/SearchController.php b/bundles/AdminBundle/Controller/Searchadmin/SearchController.php index 6374dc7e7be..4b534da6dde 100644 --- a/bundles/AdminBundle/Controller/Searchadmin/SearchController.php +++ b/bundles/AdminBundle/Controller/Searchadmin/SearchController.php @@ -71,7 +71,7 @@ public function findAction(Request $request, EventDispatcherInterface $eventDisp $allParams = $filterPrepareEvent->getArgument('requestParams'); - $query = $this->filterQueryParam($allParams['query']); + $query = $this->filterQueryParam($allParams['query'] ?? ''); $types = explode(',', $allParams['type'] ?? ''); $subtypes = explode(',', $allParams['subtype'] ?? ''); @@ -440,7 +440,7 @@ protected function filterQueryParam(string $query) */ public function quicksearchAction(Request $request, EventDispatcherInterface $eventDispatcher, Config $config) { - $query = $this->filterQueryParam($request->get('query')); + $query = $this->filterQueryParam($request->get('query', '')); if (!preg_match('/[\+\-\*"]/', $query)) { // check for a boolean operator (which was not filtered by filterQueryParam()), // if present, do not add asterisk at the end of the query From df494eb728fb14e23acc8cfcd0f053d12d938d68 Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Sun, 30 Jan 2022 12:38:38 +0100 Subject: [PATCH 2/3] Set extraParam type when initializing --- .../Resources/public/js/pimcore/element/selector/asset.js | 4 +++- .../Resources/public/js/pimcore/element/selector/document.js | 4 +++- .../Resources/public/js/pimcore/element/selector/object.js | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js index aae0f7931da..79d9940425f 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js @@ -25,6 +25,9 @@ pimcore.element.selector.asset = Class.create(pimcore.element.selector.abstract, reader: { type: 'json', rootProperty: 'data' + }, + extraParams: { + 'type': 'asset' } }, fields: ["id","fullpath","type","subtype","filename"] @@ -273,7 +276,6 @@ pimcore.element.selector.asset = Class.create(pimcore.element.selector.abstract, let proxy = this.store.getProxy(); let query = Ext.util.Format.htmlEncode(formValues.query); - proxy.setExtraParam("type", "asset"); proxy.setExtraParam("query", query); proxy.setExtraParam("subtype", formValues.subtype); diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js index 8dfadc85a98..26c5063cbb7 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js @@ -25,6 +25,9 @@ pimcore.element.selector.document = Class.create(pimcore.element.selector.abstra reader: { type: 'json', rootProperty: 'data' + }, + extraParams: { + 'type': 'document' } }, fields: ["id", "fullpath", "type", "subtype", "published", "title", "description", "name", "filename"] @@ -247,7 +250,6 @@ pimcore.element.selector.document = Class.create(pimcore.element.selector.abstra let proxy = this.store.getProxy(); let query = Ext.util.Format.htmlEncode(formValues.query); - proxy.setExtraParam("type", "document"); proxy.setExtraParam("query", query); proxy.setExtraParam("subtype", formValues.subtype); diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js index 4b8b13f57d3..8363fd322e5 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js @@ -368,6 +368,9 @@ pimcore.element.selector.object = Class.create(pimcore.element.selector.abstract reader: { type: 'json', rootProperty: 'data' + }, + extraParams: { + 'type': 'object' } }, fields: ["id","fullpath","type","subtype","filename",{name:"classname",convert: function(v, rec){ @@ -578,7 +581,6 @@ pimcore.element.selector.object = Class.create(pimcore.element.selector.abstract let proxy = this.store.getProxy(); let query = Ext.util.Format.htmlEncode(formValues.query); - proxy.setExtraParam("type", "object"); proxy.setExtraParam("query", query); proxy.setExtraParam("subtype", formValues.subtype); proxy.setExtraParam("class", formValues.class); From b9c85d928f4d177151b60af87267e5ee33c1a15b Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Mon, 31 Jan 2022 08:58:56 +0100 Subject: [PATCH 3/3] Fix Code Style --- .../Resources/public/js/pimcore/element/selector/asset.js | 3 +-- .../Resources/public/js/pimcore/element/selector/document.js | 2 +- .../Resources/public/js/pimcore/element/selector/object.js | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js index 79d9940425f..f4ad6fa4223 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/asset.js @@ -27,7 +27,7 @@ pimcore.element.selector.asset = Class.create(pimcore.element.selector.abstract, rootProperty: 'data' }, extraParams: { - 'type': 'asset' + type: 'asset' } }, fields: ["id","fullpath","type","subtype","filename"] @@ -208,7 +208,6 @@ pimcore.element.selector.asset = Class.create(pimcore.element.selector.abstract, }; if (record.data.subtype in routes) { - var route = routes[record.data.subtype]; var params = { diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js index 26c5063cbb7..4462e11364a 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/document.js @@ -27,7 +27,7 @@ pimcore.element.selector.document = Class.create(pimcore.element.selector.abstra rootProperty: 'data' }, extraParams: { - 'type': 'document' + type: 'document' } }, fields: ["id", "fullpath", "type", "subtype", "published", "title", "description", "name", "filename"] diff --git a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js index 8363fd322e5..c090feccce0 100644 --- a/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js +++ b/bundles/AdminBundle/Resources/public/js/pimcore/element/selector/object.js @@ -370,7 +370,7 @@ pimcore.element.selector.object = Class.create(pimcore.element.selector.abstract rootProperty: 'data' }, extraParams: { - 'type': 'object' + type: 'object' } }, fields: ["id","fullpath","type","subtype","filename",{name:"classname",convert: function(v, rec){