diff --git a/CRM/Upgrade/Incremental/php/FiveFortySix.php b/CRM/Upgrade/Incremental/php/FiveFortySix.php index 3d20676715a2..a865c5ad8bb7 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortySix.php +++ b/CRM/Upgrade/Incremental/php/FiveFortySix.php @@ -203,6 +203,63 @@ public static function migrateCiviGrant(CRM_Queue_TaskContext $ctx): bool { 'name' => 'CRM_Report_Form_Grant_Statistics', ], ], + 'Navigation_Grants' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Grants', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_Grants_Navigation_Dashboard' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Dashboard', + 'url' => 'civicrm/grant?reset=1', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_Grants_Navigation_New_Grant' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'New Grant', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_Grants_Navigation_Find_Grants' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Find Grants', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_CiviGrant' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Grants', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_CiviGrant_Navigation_Grant_Types' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Grant Types', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_CiviGrant_Navigation_Grant_Status' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Grant Status', + 'domain_id' => 'current_domain', + ], + ], + 'Navigation_Grants_Navigation_Grant_Reports' => [ + 'entity' => 'Navigation', + 'values' => [ + 'name' => 'Grant Reports', + 'domain_id' => 'current_domain', + ], + ], ]; // Create an entry in civicrm_managed for each existing record that will be managed by the extension foreach ($managedItems as $name => $item) { diff --git a/Civi/Api4/Navigation.php b/Civi/Api4/Navigation.php index ecf14ffe4165..bb58f75533ae 100644 --- a/Civi/Api4/Navigation.php +++ b/Civi/Api4/Navigation.php @@ -19,7 +19,10 @@ * @package Civi\Api4 */ class Navigation extends Generic\DAOEntity { +<<<<<<< HEAD use Generic\Traits\SortableEntity; +======= +>>>>>>> CiviGrant - Migrate navigation menu to extension use Generic\Traits\ManagedEntity; } diff --git a/ext/civigrant/managed/Navigation_Grants.mgd.php b/ext/civigrant/managed/Navigation_Grants.mgd.php new file mode 100644 index 000000000000..fe1d40e93d15 --- /dev/null +++ b/ext/civigrant/managed/Navigation_Grants.mgd.php @@ -0,0 +1,175 @@ + 'Navigation_Grants', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grants', + 'name' => 'Grants', + 'url' => NULL, + 'icon' => 'crm-i fa-money', + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'is_active' => TRUE, + 'weight' => 90, + 'parent_id' => NULL, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Dashboard', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Dashboard', + 'name' => 'Dashboard', + 'url' => 'civicrm/grant?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_New_Grant', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'New Grant', + 'name' => 'New Grant', + 'url' => 'civicrm/grant/add?reset=1&action=add&context=standalone', + 'icon' => NULL, + 'permission' => 'access CiviGrant,edit grants', + 'permission_operator' => 'AND', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Find_Grants', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Find Grants', + 'name' => 'Find Grants', + 'url' => 'civicrm/grant/search?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => '1', + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_CiviGrant', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'CiviGrant', + 'name' => 'CiviGrant', + 'url' => NULL, + 'icon' => NULL, + 'permission' => 'access CiviGrant,administer CiviCRM', + 'permission_operator' => 'AND', + 'parent_id.name' => 'Administer', + 'is_active' => TRUE, + 'weight' => 13, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_CiviGrant_Navigation_Grant_Types', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grant Types', + 'name' => 'Grant Types', + 'url' => 'civicrm/admin/options/grant_type?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant,administer CiviCRM', + 'permission_operator' => 'AND', + 'parent_id.name' => 'CiviGrant', + 'is_active' => TRUE, + 'weight' => 1, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_CiviGrant_Navigation_Grant_Status', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grant Status', + 'name' => 'Grant Status', + 'url' => 'civicrm/admin/options/grant_status?reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant,administer CiviCRM', + 'permission_operator' => 'AND', + 'parent_id.name' => 'CiviGrant', + 'is_active' => TRUE, + 'weight' => 2, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], + [ + 'name' => 'Navigation_Grants_Navigation_Grant_Reports', + 'entity' => 'Navigation', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'label' => 'Grant Reports', + 'name' => 'Grant Reports', + 'url' => 'civicrm/report/list?compid=5&reset=1', + 'icon' => NULL, + 'permission' => 'access CiviGrant', + 'permission_operator' => '', + 'parent_id.name' => 'Grants', + 'is_active' => TRUE, + 'has_separator' => NULL, + 'domain_id' => 'current_domain', + ], + ], + ], +]; diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 601f16d38d0b..1666f753cf35 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -248,20 +248,6 @@ VALUES ( @domainID, 'civicrm/case/search?reset=1', '{ts escape="sql" skip="true"}Find Cases{/ts}', 'Find Cases', 'access my cases and activities,access all cases and activities', 'OR', @caselastID, '1', 1, 3 ), ( @domainID, 'civicrm/report/list?compid=7&reset=1', '{ts escape="sql" skip="true"}Case Reports{/ts}', 'Case Reports', 'access my cases and activities,access all cases and activities,administer CiviCase', 'OR', @caselastID, '1', 0, 4 ); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight, icon ) -VALUES - ( @domainID, NULL, '{ts escape="sql" skip="true"}Grants{/ts}', 'Grants', 'access CiviGrant', '', NULL, '1', NULL, 90, 'crm-i fa-money' ); - -SET @grantlastID:=LAST_INSERT_ID(); -INSERT INTO civicrm_navigation - ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) -VALUES - ( @domainID, 'civicrm/grant?reset=1', '{ts escape="sql" skip="true"}Dashboard{/ts}', 'Dashboard', 'access CiviGrant', '', @grantlastID, '1', NULL, 1 ), - ( @domainID, 'civicrm/grant/add?reset=1&action=add&context=standalone', '{ts escape="sql" skip="true"}New Grant{/ts}', 'New Grant', 'access CiviGrant,edit grants', 'AND', @grantlastID, '1', NULL, 2 ), - ( @domainID, 'civicrm/grant/search?reset=1', '{ts escape="sql" skip="true"}Find Grants{/ts}', 'Find Grants', 'access CiviGrant', '', @grantlastID, '1', 1, 3 ), - ( @domainID, 'civicrm/report/list?compid=5&reset=1', '{ts escape="sql" skip="true"}Grant Reports{/ts}', 'Grant Reports', 'access CiviGrant', '', @grantlastID, '1', 0, 4 ); - INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight, icon ) VALUES