From 3a5dd7dbeb844aef564948412f9138928608411f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= <p.mueller@pcsg.de> Date: Tue, 20 Oct 2020 10:26:22 +0200 Subject: [PATCH] fix: do not reset search settings after each setup quiqqer/productsearch#3 --- locale.xml | 5 ++++ settings.xml | 2 +- src/QUI/ERP/Products/EventHandling.php | 40 -------------------------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/locale.xml b/locale.xml index d562ebc7..77b2e643 100644 --- a/locale.xml +++ b/locale.xml @@ -299,6 +299,11 @@ <de><![CDATA[Standard Sortierung]]></de> <en><![CDATA[Default sorting]]></en> </locale> + + <locale name="settings.window.fieldsearch.freetext.sort.title"> + <de><![CDATA[Produkt-Sortierung]]></de> + <en><![CDATA[Product sorting]]></en> + </locale> <locale name="fieldtype"> <de><![CDATA[Feld-Typ]]></de> diff --git a/settings.xml b/settings.xml index 2cb28eb3..c9786ca6 100644 --- a/settings.xml +++ b/settings.xml @@ -343,7 +343,7 @@ <settings title="freetext" name="freetext"> <title> - <locale group="quiqqer/products" var="settings.window.fieldsearch.freetext.title"/> + <locale group="quiqqer/products" var="settings.window.fieldsearch.freetext.sort.title"/> </title> <input conf="products.sortFields" diff --git a/src/QUI/ERP/Products/EventHandling.php b/src/QUI/ERP/Products/EventHandling.php index ad5458e9..65b197ac 100644 --- a/src/QUI/ERP/Products/EventHandling.php +++ b/src/QUI/ERP/Products/EventHandling.php @@ -36,7 +36,6 @@ public static function onPackageSetup(Package $Package) QUI\ERP\Products\Handler\Manufacturers::registerManufacturerUrlPaths(); - self::setDefaultSearchSettings(); self::patchProductTypes(); try { @@ -1097,45 +1096,6 @@ public static function onRequest(QUI\Rewrite $Rewrite, $url) } } - /** - * Set default search settings if none are set - * - * @return void - * @throws QUI\Exception - */ - protected static function setDefaultSearchSettings() - { - try { - $Conf = QUI::getPackage('quiqqer/products')->getConfig(); - } catch (\Exception $Exception) { - QUI\System\Log::writeException($Exception); - - return; - } - - $search = $Conf->getSection('search'); - - // Backend search fields - if (empty($search['backend'])) { - $search['backend'] = implode(',', [ - Fields::FIELD_PRODUCT_NO, - Fields::FIELD_TITLE - ]); - } - - if (empty($search['freetext'])) { - $search['freetext'] = implode(',', [ - Fields::FIELD_PRODUCT_NO, - Fields::FIELD_TITLE, - Fields::FIELD_SHORT_DESC, - Fields::FIELD_KEYWORDS - ]); - } - - $Conf->setSection('search', $search); - $Conf->save(); - } - /** * events: frontend cache clearing */ -- GitLab