CRM_Extension_System::singleton()->getManager()->refresh();
$managedItems = [
- 'OptionGroup_advanced_search_options_OptionValue_CiviGrant' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'advanced_search_options',
- 'name' => 'CiviGrant',
- ],
- ],
- 'OptionGroup_mapping_type_OptionValue_Export Grant' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'mapping_type',
- 'name' => 'Export Grant',
- ],
- ],
- 'OptionGroup_grant_status' => [
- 'entity' => 'OptionGroup',
- 'values' => [
- 'name' => 'grant_status',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Submitted' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Submitted',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Eligible' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Eligible',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Ineligible' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Ineligible',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Paid' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Paid',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Awaiting Information' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Awaiting Information',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Withdrawn' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Withdrawn',
- ],
- ],
- 'OptionGroup_grant_status_OptionValue_Approved for Payment' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'grant_status',
- 'name' => 'Approved for Payment',
- ],
- ],
- 'OptionGroup_grant_type' => [
- 'entity' => 'OptionGroup',
- 'values' => [
- 'name' => 'grant_type',
- ],
- ],
- 'OptionGroup_report_template_OptionValue_CRM_Report_Form_Grant_Detail' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'report_template',
- 'name' => 'CRM_Report_Form_Grant_Detail',
- ],
- ],
- 'OptionGroup_report_template_OptionValue_CRM_Report_Form_Grant_Statistics' => [
- 'entity' => 'OptionValue',
- 'values' => [
- 'option_group_id:name' => 'report_template',
- 'name' => 'CRM_Report_Form_Grant_Statistics',
- ],
- ],
'Navigation_Grants' => [
'entity' => 'Navigation',
'values' => [
*/
class CRM_Grant_Upgrader extends CRM_Extension_Upgrader_Base {
+ public function install() {
+ // Ensure option group exists (in case OptionGroup_grant_status.mgd.php hasn't loaded yet)
+ \Civi\Api4\OptionGroup::save(FALSE)
+ ->addRecord([
+ 'name' => 'grant_status',
+ 'title' => E::ts('Grant status'),
+ ])
+ ->setMatch(['name'])
+ ->execute();
+
+ // Create unmanaged option values. They will not be updated by the system ever,
+ // but they will be deleted on uninstall because the option group is a managed entity.
+ \Civi\Api4\OptionValue::save(FALSE)
+ ->setDefaults([
+ 'option_group_id.name' => 'grant_status',
+ ])
+ ->setRecords([
+ ['value' => 1, 'name' => 'Submitted', 'label' => E::ts('Submitted'), 'is_default' => TRUE],
+ ['value' => 2, 'name' => 'Eligible', 'label' => E::ts('Eligible')],
+ ['value' => 3, 'name' => 'Ineligible', 'label' => E::ts('Ineligible')],
+ ['value' => 4, 'name' => 'Paid', 'label' => E::ts('Paid')],
+ ['value' => 5, 'name' => 'Awaiting Information', 'label' => E::ts('Awaiting Information')],
+ ['value' => 6, 'name' => 'Withdrawn', 'label' => E::ts('Withdrawn')],
+ ['value' => 7, 'name' => 'Approved for Payment', 'label' => E::ts('Approved for Payment')],
+ ])
+ ->setMatch(['option_group_id', 'name'])
+ ->execute();
+ }
+
}
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'Navigation_Grants',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'Grants',
+ 'label' => E::ts('Grants'),
'name' => 'Grants',
'url' => NULL,
'icon' => 'crm-i fa-money',
[
'name' => 'Navigation_Grants_Navigation_Dashboard',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'Dashboard',
+ 'label' => E::ts('Dashboard'),
'name' => 'Dashboard',
'url' => 'civicrm/grant?reset=1',
'icon' => NULL,
[
'name' => 'Navigation_Grants_Navigation_New_Grant',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'New Grant',
+ 'label' => E::ts('New Grant'),
'name' => 'New Grant',
'url' => 'civicrm/grant/add?reset=1&action=add&context=standalone',
'icon' => NULL,
[
'name' => 'Navigation_Grants_Navigation_Find_Grants',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'Find Grants',
+ 'label' => E::ts('Find Grants'),
'name' => 'Find Grants',
'url' => 'civicrm/grant/search?reset=1',
'icon' => NULL,
[
'name' => 'Navigation_CiviGrant',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'CiviGrant',
+ 'label' => E::ts('CiviGrant'),
'name' => 'CiviGrant',
'url' => NULL,
'icon' => NULL,
[
'name' => 'Navigation_CiviGrant_Navigation_Grant_Types',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'Grant Types',
+ 'label' => E::ts('Grant Types'),
'name' => 'Grant Types',
'url' => 'civicrm/admin/options/grant_type?reset=1',
'icon' => NULL,
[
'name' => 'Navigation_CiviGrant_Navigation_Grant_Status',
'entity' => 'Navigation',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
- 'label' => 'Grant Status',
+ 'label' => E::ts('Grant Status'),
'name' => 'Grant Status',
'url' => 'civicrm/admin/options/grant_status?reset=1',
'icon' => NULL,
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'OptionGroup_advanced_search_options_OptionValue_CiviGrant',
'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
+ 'cleanup' => 'always',
+ 'update' => 'always',
'params' => [
'version' => 4,
'values' => [
'option_group_id.name' => 'advanced_search_options',
- 'label' => 'Grants',
+ 'label' => E::ts('Grants'),
'value' => '12',
'name' => 'CiviGrant',
'grouping' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
+ 'match' => ['option_group_id', 'name'],
],
],
];
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'OptionGroup_grant_status',
'entity' => 'OptionGroup',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'grant_status',
- 'title' => 'Grant status',
+ 'title' => E::ts('Grant status'),
'description' => NULL,
'data_type' => NULL,
'is_reserved' => TRUE,
'is_active' => TRUE,
'is_locked' => FALSE,
],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Submitted',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Submitted',
- 'value' => '1',
- 'name' => 'Submitted',
- '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,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Eligible',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Eligible',
- 'value' => '2',
- 'name' => 'Eligible',
- '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,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Ineligible',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Ineligible',
- 'value' => '3',
- 'name' => 'Ineligible',
- '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,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Paid',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Paid',
- 'value' => '4',
- 'name' => 'Paid',
- '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,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Awaiting Information',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Awaiting Information',
- 'value' => '5',
- 'name' => 'Awaiting Information',
- 'grouping' => NULL,
- 'filter' => 0,
- 'is_default' => FALSE,
- 'weight' => 5,
- 'description' => NULL,
- 'is_optgroup' => FALSE,
- 'is_reserved' => FALSE,
- 'is_active' => TRUE,
- 'icon' => NULL,
- 'color' => NULL,
- 'component_id' => NULL,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Withdrawn',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Withdrawn',
- 'value' => '6',
- 'name' => 'Withdrawn',
- 'grouping' => NULL,
- 'filter' => 0,
- 'is_default' => FALSE,
- 'weight' => 6,
- 'description' => NULL,
- 'is_optgroup' => FALSE,
- 'is_reserved' => FALSE,
- 'is_active' => TRUE,
- 'icon' => NULL,
- 'color' => NULL,
- 'component_id' => NULL,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
- ],
- ],
- [
- 'name' => 'OptionGroup_grant_status_OptionValue_Approved for Payment',
- 'entity' => 'OptionValue',
- 'cleanup' => 'unused',
- 'update' => 'unmodified',
- 'params' => [
- 'version' => 4,
- 'values' => [
- 'option_group_id.name' => 'grant_status',
- 'label' => 'Approved for Payment',
- 'value' => '7',
- 'name' => 'Approved for Payment',
- 'grouping' => NULL,
- 'filter' => 0,
- 'is_default' => FALSE,
- 'weight' => 7,
- 'description' => NULL,
- 'is_optgroup' => FALSE,
- 'is_reserved' => FALSE,
- 'is_active' => TRUE,
- 'icon' => NULL,
- 'color' => NULL,
- 'component_id' => NULL,
- 'domain_id' => NULL,
- 'visibility_id' => NULL,
- ],
+ 'match' => ['name'],
],
],
];
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'OptionGroup_grant_type',
'entity' => 'OptionGroup',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'is_active' => TRUE,
'is_locked' => FALSE,
],
+ 'match' => ['name'],
],
],
];
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'OptionGroup_mapping_type_OptionValue_Export Grant',
'entity' => 'OptionValue',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'option_group_id.name' => 'mapping_type',
- 'label' => 'Export Grant',
+ 'label' => E::ts('Export Grant'),
'value' => '13',
'name' => 'Export Grant',
'grouping' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
+ 'match' => ['option_group_id', 'name'],
],
],
];
<?php
+use CRM_Grant_ExtensionUtil as E;
+
return [
[
'name' => 'OptionGroup_report_template_OptionValue_CRM_Report_Form_Grant_Detail',
'version' => 4,
'values' => [
'option_group_id.name' => 'report_template',
- 'label' => 'Grant Report (Detail)',
+ 'label' => E::ts('Grant Report (Detail)'),
'value' => 'grant/detail',
'name' => 'CRM_Report_Form_Grant_Detail',
'grouping' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
+ 'match' => ['name'],
],
],
[
'version' => 4,
'values' => [
'option_group_id.name' => 'report_template',
- 'label' => 'Grant Report (Statistics)',
+ 'label' => E::ts('Grant Report (Statistics)'),
'value' => 'grant/statistics',
'name' => 'CRM_Report_Form_Grant_Statistics',
'grouping' => NULL,
'domain_id' => NULL,
'visibility_id' => NULL,
],
+ 'match' => ['option_group_id', 'name'],
],
],
];
[
'name' => 'SavedSearch_CiviGrant_Summary',
'entity' => 'SavedSearch',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,
[
'name' => 'SavedSearch_CiviGrant_Summary_SearchDisplay_Grant_Tab',
'entity' => 'SearchDisplay',
- 'cleanup' => 'unused',
+ 'cleanup' => 'always',
'update' => 'unmodified',
'params' => [
'version' => 4,