(User group) option search by identifier if dev mode is enabled
authorMatthias Schmidt <gravatronics@live.com>
Thu, 22 Aug 2019 15:59:34 +0000 (17:59 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 22 Aug 2019 15:59:34 +0000 (17:59 +0200)
Close #3052

wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php
wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php

index fe67ab86d36250bf4a79db5370f74cc8036e8283..c7ec7cfe30d0993cb9aad638b5dd5969e7a4f3e0 100644 (file)
@@ -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
index b0ec201df9df7cc6d8b762c55caedae00957d5ed..01d8bfa00af9ed0e4a0a0dc804af93ab0fbf0833 100644 (file)
@@ -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])
                        );