From 86ab7616125c9cc30f79818e9ca385f5e7b8ad6f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 22 Jun 2022 11:39:42 +1200 Subject: [PATCH] Move creating of nav & menu items to legacycustomsearches extension --- CRM/Core/xml/Menu/Contact.xml | 7 ----- .../legacycustomsearches.php | 30 ++++++++++++------- ext/legacycustomsearches/xml/Menu/Search.xml | 7 +++++ sql/test_data_second_domain.mysql | 8 +---- xml/templates/civicrm_navigation.tpl | 8 +---- 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/CRM/Core/xml/Menu/Contact.xml b/CRM/Core/xml/Menu/Contact.xml index 5f70ed8a3ef2..ed81f2bc8273 100644 --- a/CRM/Core/xml/Menu/Contact.xml +++ b/CRM/Core/xml/Menu/Contact.xml @@ -59,13 +59,6 @@ 1 14 - - civicrm/contact/search/custom/list - Custom Searches - CRM_Contact_Page_CustomSearch - 1 - 16 - civicrm/contact/add New Contact diff --git a/ext/legacycustomsearches/legacycustomsearches.php b/ext/legacycustomsearches/legacycustomsearches.php index 2213da60d38b..c880228d2378 100644 --- a/ext/legacycustomsearches/legacycustomsearches.php +++ b/ext/legacycustomsearches/legacycustomsearches.php @@ -95,14 +95,22 @@ function legacycustomsearches_civicrm_entityTypes(&$entityTypes) { * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu */ -//function legacycustomsearches_civicrm_navigationMenu(&$menu) { -// _legacycustomsearches_civix_insert_navigation_menu($menu, 'Mailings', array( -// 'label' => E::ts('New subliminal message'), -// 'name' => 'mailing_subliminal_message', -// 'url' => 'civicrm/mailing/subliminal', -// 'permission' => 'access CiviMail', -// 'operator' => 'OR', -// 'separator' => 0, -// )); -// _legacycustomsearches_civix_navigationMenu($menu); -//} +function legacycustomsearches_civicrm_navigationMenu(&$menu) { + _legacycustomsearches_civix_insert_navigation_menu($menu, 'Search', [ + 'label' => E::ts('Custom Searches'), + 'name' => 'Custom Searches', + 'url' => 'civicrm/contact/search/custom/list?reset=1', + 'permission' => NULL, + 'operator' => 'OR', + 'separator' => 0, + ]); + _legacycustomsearches_civix_insert_navigation_menu($menu, 'Administer/Customize Data and Screens', [ + 'label' => E::ts('Manage Custom Searches'), + 'name' => 'Manage Custom Searches', + 'url' => 'civicrm/admin/options/custom_search?reset=1', + 'permission' => 'administer CiviCRM', + 'operator' => 'OR', + 'separator' => 0, + ]); + _legacycustomsearches_civix_navigationMenu($menu); +} diff --git a/ext/legacycustomsearches/xml/Menu/Search.xml b/ext/legacycustomsearches/xml/Menu/Search.xml index f46c9f40f4ca..747357a2bd24 100644 --- a/ext/legacycustomsearches/xml/Menu/Search.xml +++ b/ext/legacycustomsearches/xml/Menu/Search.xml @@ -9,4 +9,11 @@ 10 1 + + civicrm/contact/search/custom/list + Custom Searches + CRM_Contact_Page_CustomSearch + 1 + 16 + diff --git a/sql/test_data_second_domain.mysql b/sql/test_data_second_domain.mysql index 3d32359fb29a..e98b1f637242 100644 --- a/sql/test_data_second_domain.mysql +++ b/sql/test_data_second_domain.mysql @@ -92,11 +92,6 @@ VALUES ( @domainID, 'civicrm/pledge/search&reset=1', 'Find Pledges', 'Find Pledges', 'access CiviPledge', '', @searchlastID, '1', NULL, 10 ), ( @domainID, 'civicrm/activity/search&reset=1', 'Find Activities', 'Find Activities', NULL, '', @searchlastID, '1', '1', 11 ); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -VALUES - ( @domainID, 'civicrm/contact/search/custom/list&reset=1', 'Custom Searches', 'Custom Searches', NULL, '', @searchlastID, '1', NULL, 12 ); - INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) VALUES @@ -287,8 +282,7 @@ VALUES ( @domainID, 'civicrm/admin/setting/preferences/display&reset=1', 'Display Preferences', 'Display Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 9 ), ( @domainID, 'civicrm/admin/setting/search&reset=1', 'Search Preferences', 'Search Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 10 ), ( @domainID, 'civicrm/admin/menu&reset=1', 'Navigation Menu', 'Navigation Menu', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 11 ), - ( @domainID, 'civicrm/admin/options/wordreplacements&reset=1','Word Replacements','Word Replacements', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 12 ), - ( @domainID, 'civicrm/admin/options/custom_search&reset=1&group=custom_search', 'Manage Custom Searches', 'Manage Custom Searches', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 13 ); + ( @domainID, 'civicrm/admin/options/wordreplacements&reset=1','Word Replacements','Word Replacements', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 12 ); INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 75a61abb8a53..e8c87929a750 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -64,11 +64,6 @@ VALUES ( @domainID, 'civicrm/pledge/search?reset=1', '{ts escape="sql" skip="true"}Find Pledges{/ts}', 'Find Pledges', 'access CiviPledge', '', @searchlastID, '1', NULL, 10 ), ( @domainID, 'civicrm/activity/search?reset=1', '{ts escape="sql" skip="true"}Find Activities{/ts}', 'Find Activities', NULL, '', @searchlastID, '1', '1', 11 ); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -VALUES - ( @domainID, 'civicrm/contact/search/custom/list?reset=1', '{ts escape="sql" skip="true"}Custom Searches{/ts}', 'Custom Searches', NULL, '', @searchlastID, '1', NULL, 12 ); - INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight, icon ) VALUES @@ -285,8 +280,7 @@ VALUES ( @domainID, 'civicrm/admin/setting/search?reset=1', '{ts escape="sql" skip="true"}Search Preferences{/ts}', 'Search Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 10 ), ( @domainID, 'civicrm/admin/setting/preferences/date?reset=1', '{ts escape="sql" skip="true"}Date Preferences{/ts}', 'Date Preferences', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 11 ), ( @domainID, 'civicrm/admin/menu?reset=1', '{ts escape="sql" skip="true"}Navigation Menu{/ts}', 'Navigation Menu', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 12 ), - ( @domainID, 'civicrm/admin/options/wordreplacements?reset=1','{ts escape="sql" skip="true"}Word Replacements{/ts}','Word Replacements', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 13 ), - ( @domainID, 'civicrm/admin/options/custom_search?reset=1', '{ts escape="sql" skip="true"}Manage Custom Searches{/ts}', 'Manage Custom Searches', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 14 ); + ( @domainID, 'civicrm/admin/options/wordreplacements?reset=1','{ts escape="sql" skip="true"}Word Replacements{/ts}','Word Replacements', 'administer CiviCRM', '', @CustomizelastID, '1', NULL, 13 ); INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )