From 92eeb1a86b15cc5cbacbaecf165d4f931c63c1fe Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 22 Aug 2019 17:59:34 +0200 Subject: [PATCH] (User group) option search by identifier if dev mode is enabled Close #3052 --- .../OptionACPSearchResultProvider.class.php | 5 ++++- ...oupOptionACPSearchResultProvider.class.php | 20 +++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php index fe67ab86d3..c7ec7cfe30 100644 --- a/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php @@ -53,7 +53,7 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr } } - if (empty($optionNames) && empty($categoryNames)) { + if (empty($optionNames) && empty($categoryNames) && !(ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS)) { return []; } @@ -64,6 +64,9 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr if (!empty($optionNames)) { $conditions->add('optionName IN (?)', [$optionNames]); } + if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS) { + $conditions->add('optionName LIKE ?', ['%'.$query.'%']); + } $sql = "SELECT optionName, categoryName, options, permissions, hidden FROM wcf".WCF_N."_option diff --git a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php index b0ec201df9..01d8bfa00a 100644 --- a/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php @@ -50,12 +50,17 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc $languageItems[$itemName] = $languageItem; } - if (empty($languageItems)) { + if (empty($languageItems) && !(ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS)) { return []; } - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionName IN (?)", [array_keys($languageItems)]); + $conditions = new PreparedStatementConditionBuilder(true, 'OR'); + if (!empty($languageItems)) { + $conditions->add("optionName IN (?)", [array_keys($languageItems)]); + } + if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS) { + $conditions->add('optionName LIKE ?', ['%'.$query.'%']); + } $sql = "SELECT optionID, optionName, categoryName, permissions, options FROM wcf".WCF_N."_user_group_option @@ -85,8 +90,15 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc $categoryName = $optionCategories[$categoryName]->parentCategoryName; } + if (isset($languageItems[$userGroupOption->optionName])) { + $languageItem = $languageItems[$userGroupOption->optionName]; + } + else { + $languageItem = 'wcf.acp.group.option.' . $userGroupOption->optionName; + } + $results[] = new ACPSearchResult( - WCF::getLanguage()->getDynamicVariable($languageItems[$userGroupOption->optionName]), + WCF::getLanguage()->getDynamicVariable($languageItem), $link, WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', ['pieces' => $parentCategories]) ); -- 2.20.1