Skip to content

Commit

Permalink
Added a configuration flag to disable global search in adminhtml (#2443)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Aug 17, 2022
1 parent cc051f2 commit 5de30bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,16 @@ Most important changes will be listed here, all other changes since `19.4.0` can
### Between Magento 1.9.4.5 and OpenMage 19.x

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

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function globalSearchAction()
$searchModules = Mage::getConfig()->getNode("adminhtml/global_search");
$items = array();

if (!Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) {
if (!Mage::getStoreConfigFlag('admin/global_search/enable') || !Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) {
$items[] = array(
'id' => 'error',
'type' => Mage::helper('adminhtml')->__('Error'),
Expand Down
3 changes: 3 additions & 0 deletions app/code/core/Mage/Adminhtml/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@
<design>
<use_legacy_theme>0</use_legacy_theme>
</design>
<global_search>
<enable>1</enable>
</global_search>
</admin>
</default>
<stores>
Expand Down
19 changes: 19 additions & 0 deletions app/code/core/Mage/Core/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,25 @@
</fields>
</design>

<global_search>
<label>Global Search</label>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
<sort_order>6</sort_order>
<fields>
<enable translate="label">
<label>Enable global search</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</enable>
</fields>
</global_search>

<emails translate="label">
<label>Admin User Emails</label>
<sort_order>10</sort_order>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<p class="super">
<?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>
</p>
<?php if ( Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ): ?>
<?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
<fieldset>
<legend>Search</legend>
<span id="global_search_indicator" class="autocomplete-indicator" style="display: none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ul>
</li>
</ul>
<?php if ( Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ): ?>
<?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
<fieldset>
<legend>Search</legend>
<span id="global_search_indicator" class="autocomplete-indicator" style="display: none">
Expand Down

0 comments on commit 5de30bf

Please sign in to comment.