Skip to content

Commit

Permalink
Merge pull request #22913 from colemanw/civiGrantTypes2
Browse files Browse the repository at this point in the history
CiviGrant - Don't auto-create any grant types
  • Loading branch information
colemanw authored Mar 9, 2022
2 parents 3af32cd + 39a3f9f commit 540ac54
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 142 deletions.
28 changes: 0 additions & 28 deletions CRM/Upgrade/Incremental/php/FiveFortySeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
3 changes: 3 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.48.beta1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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_%";
112 changes: 0 additions & 112 deletions ext/civigrant/managed/OptionGroup_grant_type.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
],
];
11 changes: 9 additions & 2 deletions ext/civigrant/tests/phpunit/api/v3/GrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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,
]);
}

/**
Expand Down

0 comments on commit 540ac54

Please sign in to comment.