Skip to content

Commit 5de30bf

Browse files
authored
Added a configuration flag to disable global search in adminhtml (#2443)
1 parent cc051f2 commit 5de30bf

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,16 @@ Most important changes will be listed here, all other changes since `19.4.0` can
103103
### Between Magento 1.9.4.5 and OpenMage 19.x
104104

105105
- bug fixes and PHP 7.x and 8.0 compatibility
106-
- added config cache for system.xml #1916
106+
- added config cache for system.xml [#1916](https://github.com/OpenMage/magento-lts/pull/1916)
107107

108108
### Between OpenMage 19.x and 20.x
109109

110110
Do not use 20.x.x if you need IE support.
111111

112-
- removed IE conditional comments, IE styles, IE scripts and IE eot files #1073
113-
- removed frontend default themes (default, modern, iphone, german, french, blank, blue) #1600
114-
- fixed incorrect datetime in customer block (`$useTimezone` parameter) #1525
115-
- add redis as a valid option for `global/session_save` #1513
116-
- possibility to disable global search in backend #1532
112+
- removed IE conditional comments, IE styles, IE scripts and IE eot files [#1073](https://github.com/OpenMage/magento-lts/pull/1073)
113+
- removed frontend default themes (default, modern, iphone, german, french, blank, blue) [#1600](https://github.com/OpenMage/magento-lts/pull/1600)
114+
- fixed incorrect datetime in customer block (`$useTimezone` parameter) [#1525](https://github.com/OpenMage/magento-lts/pull/1525)
115+
- add redis as a valid option for `global/session_save` [#1513](https://github.com/OpenMage/magento-lts/pull/1513)
117116

118117
For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0).
119118

app/code/core/Mage/Adminhtml/controllers/IndexController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function globalSearchAction()
9898
$searchModules = Mage::getConfig()->getNode("adminhtml/global_search");
9999
$items = array();
100100

101-
if (!Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) {
101+
if (!Mage::getStoreConfigFlag('admin/global_search/enable') || !Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) {
102102
$items[] = array(
103103
'id' => 'error',
104104
'type' => Mage::helper('adminhtml')->__('Error'),

app/code/core/Mage/Adminhtml/etc/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@
231231
<design>
232232
<use_legacy_theme>0</use_legacy_theme>
233233
</design>
234+
<global_search>
235+
<enable>1</enable>
236+
</global_search>
234237
</admin>
235238
</default>
236239
<stores>

app/code/core/Mage/Core/etc/system.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,25 @@
10631063
</fields>
10641064
</design>
10651065

1066+
<global_search>
1067+
<label>Global Search</label>
1068+
<show_in_default>1</show_in_default>
1069+
<show_in_website>0</show_in_website>
1070+
<show_in_store>0</show_in_store>
1071+
<sort_order>6</sort_order>
1072+
<fields>
1073+
<enable translate="label">
1074+
<label>Enable global search</label>
1075+
<frontend_type>select</frontend_type>
1076+
<source_model>adminhtml/system_config_source_yesno</source_model>
1077+
<sort_order>1</sort_order>
1078+
<show_in_default>1</show_in_default>
1079+
<show_in_website>0</show_in_website>
1080+
<show_in_store>0</show_in_store>
1081+
</enable>
1082+
</fields>
1083+
</global_search>
1084+
10661085
<emails translate="label">
10671086
<label>Admin User Emails</label>
10681087
<sort_order>10</sort_order>

app/design/adminhtml/default/default/template/page/header.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<p class="super">
2727
<?php echo $this->__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())) ?><span class="separator">|</span><a href="<?php echo $this->getLogoutLink() ?>" class="link-logout"><?php echo $this->__('Log Out') ?></a>
2828
</p>
29-
<?php if ( Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ): ?>
29+
<?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
3030
<fieldset>
3131
<legend>Search</legend>
3232
<span id="global_search_indicator" class="autocomplete-indicator" style="display: none">

app/design/adminhtml/default/openmage/template/page/header.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</ul>
4343
</li>
4444
</ul>
45-
<?php if ( Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ): ?>
45+
<?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
4646
<fieldset>
4747
<legend>Search</legend>
4848
<span id="global_search_indicator" class="autocomplete-indicator" style="display: none">

0 commit comments

Comments
 (0)