diff --git a/CRM/Upgrade/Incremental/php/FiveFortySeven.php b/CRM/Upgrade/Incremental/php/FiveFortySeven.php index fa47928b1516..ff2204c8c8f0 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveFortySeven.php @@ -213,34 +213,6 @@ public static function migrateCiviGrant(CRM_Queue_TaskContext $ctx): bool { 'name' => 'grant_type', ], ], - 'OptionGroup_grant_type_OptionValue_Emergency' => [ - 'entity' => 'OptionValue', - 'values' => [ - 'option_group_id:name' => 'grant_type', - 'name' => 'Emergency', - ], - ], - 'OptionGroup_grant_type_OptionValue_Family Support' => [ - 'entity' => 'OptionValue', - 'values' => [ - 'option_group_id:name' => 'grant_type', - 'name' => 'Family Support', - ], - ], - 'OptionGroup_grant_type_OptionValue_General Protection' => [ - 'entity' => 'OptionValue', - 'values' => [ - 'option_group_id:name' => 'grant_type', - 'name' => 'General Protection', - ], - ], - 'OptionGroup_grant_type_OptionValue_Impunity' => [ - 'entity' => 'OptionValue', - 'values' => [ - 'option_group_id:name' => 'grant_type', - 'name' => 'Impunity', - ], - ], 'OptionGroup_report_template_OptionValue_CRM_Report_Form_Grant_Detail' => [ 'entity' => 'OptionValue', 'values' => [ diff --git a/CRM/Upgrade/Incremental/sql/5.48.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.48.beta1.mysql.tpl index acba8b0a9c56..6583c67b02b2 100644 --- a/CRM/Upgrade/Incremental/sql/5.48.beta1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.48.beta1.mysql.tpl @@ -2,3 +2,6 @@ -- Remove entry for Grant Reports since grant is not a component anymore so this url just shows an empty list DELETE FROM civicrm_navigation WHERE url='civicrm/report/list?compid=5&reset=1'; + +DELETE FROM civicrm_managed WHERE module = "civigrant" AND entity_type = "OptionValue" +AND name LIKE "OptionGroup_grant_type_%"; diff --git a/ext/civigrant/managed/OptionGroup_grant_type.mgd.php b/ext/civigrant/managed/OptionGroup_grant_type.mgd.php index 8c98381b9a9f..4f1ccf826bea 100644 --- a/ext/civigrant/managed/OptionGroup_grant_type.mgd.php +++ b/ext/civigrant/managed/OptionGroup_grant_type.mgd.php @@ -18,116 +18,4 @@ ], ], ], - [ - 'name' => 'OptionGroup_grant_type_OptionValue_Emergency', - 'entity' => 'OptionValue', - 'cleanup' => 'unused', - 'update' => 'unmodified', - 'params' => [ - 'version' => 4, - 'values' => [ - 'option_group_id.name' => 'grant_type', - 'label' => 'Emergency', - 'value' => '1', - 'name' => 'Emergency', - 'grouping' => NULL, - 'filter' => 0, - 'is_default' => TRUE, - 'weight' => 1, - 'description' => NULL, - 'is_optgroup' => FALSE, - 'is_reserved' => FALSE, - 'is_active' => TRUE, - 'icon' => NULL, - 'color' => NULL, - 'component_id' => NULL, - 'visibility_id' => NULL, - 'domain_id' => 'current_domain', - ], - ], - ], - [ - 'name' => 'OptionGroup_grant_type_OptionValue_Family Support', - 'entity' => 'OptionValue', - 'cleanup' => 'unused', - 'update' => 'unmodified', - 'params' => [ - 'version' => 4, - 'values' => [ - 'option_group_id.name' => 'grant_type', - 'label' => 'Family Support', - 'value' => '2', - 'name' => 'Family Support', - 'grouping' => NULL, - 'filter' => 0, - 'is_default' => FALSE, - 'weight' => 2, - 'description' => NULL, - 'is_optgroup' => FALSE, - 'is_reserved' => FALSE, - 'is_active' => TRUE, - 'icon' => NULL, - 'color' => NULL, - 'component_id' => NULL, - 'visibility_id' => NULL, - 'domain_id' => 'current_domain', - ], - ], - ], - [ - 'name' => 'OptionGroup_grant_type_OptionValue_General Protection', - 'entity' => 'OptionValue', - 'cleanup' => 'unused', - 'update' => 'unmodified', - 'params' => [ - 'version' => 4, - 'values' => [ - 'option_group_id.name' => 'grant_type', - 'label' => 'General Protection', - 'value' => '3', - 'name' => 'General Protection', - 'grouping' => NULL, - 'filter' => 0, - 'is_default' => FALSE, - 'weight' => 3, - 'description' => NULL, - 'is_optgroup' => FALSE, - 'is_reserved' => FALSE, - 'is_active' => TRUE, - 'icon' => NULL, - 'color' => NULL, - 'component_id' => NULL, - 'visibility_id' => NULL, - 'domain_id' => 'current_domain', - ], - ], - ], - [ - 'name' => 'OptionGroup_grant_type_OptionValue_Impunity', - 'entity' => 'OptionValue', - 'cleanup' => 'unused', - 'update' => 'unmodified', - 'params' => [ - 'version' => 4, - 'values' => [ - 'option_group_id.name' => 'grant_type', - 'label' => 'Impunity', - 'value' => '4', - 'name' => 'Impunity', - 'grouping' => NULL, - 'filter' => 0, - 'is_default' => FALSE, - 'weight' => 4, - 'description' => NULL, - 'is_optgroup' => FALSE, - 'is_reserved' => FALSE, - 'is_active' => TRUE, - 'icon' => NULL, - 'color' => NULL, - 'component_id' => NULL, - 'visibility_id' => NULL, - 'domain_id' => 'current_domain', - ], - ], - ], ]; diff --git a/ext/civigrant/tests/phpunit/api/v3/GrantTest.php b/ext/civigrant/tests/phpunit/api/v3/GrantTest.php index bf4dfd34d0d6..c48c579770f7 100644 --- a/ext/civigrant/tests/phpunit/api/v3/GrantTest.php +++ b/ext/civigrant/tests/phpunit/api/v3/GrantTest.php @@ -16,11 +16,10 @@ * @subpackage API_Grant * @group headless */ -class api_v3_GrantTest extends \PHPUnit\Framework\TestCase implements \Civi\Test\HeadlessInterface { +class api_v3_GrantTest extends \PHPUnit\Framework\TestCase implements \Civi\Test\HeadlessInterface, \Civi\Test\TransactionalInterface { use \Civi\Test\Api3TestTrait; use \Civi\Test\ContactTestTrait; - protected $_apiversion = 3; protected $params; protected $ids = []; @@ -48,6 +47,14 @@ public function setUp(): void { 'currency' => 'USD', 'grant_type_id' => 1, ]; + // Create a sample grant type + \CRM_Core_BAO_OptionValue::ensureOptionValueExists([ + 'option_group_id' => 'grant_type', + 'label' => 'Emergency', + 'name' => 'Emergency', + 'value' => 1, + 'is_active' => 1, + ]); } /**