From e2fb91f90d478b82b4f5383d4614f738afc2c9fc Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Sun, 6 Mar 2022 15:32:58 +0530 Subject: [PATCH] check for grant in the ext --- includes/utils.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/utils.inc b/includes/utils.inc index a8f118c87..38d22a370 100644 --- a/includes/utils.inc +++ b/includes/utils.inc @@ -544,6 +544,17 @@ function wf_crm_get_fields($var = 'fields') { 'activity' => ['entity_type' => 'activity', 'label' => t('Activity'), 'max_instances' => 99, 'attachments' => TRUE], 'relationship' => ['entity_type' => 'contact', 'label' => t('Relationship'), 'help_text' => TRUE, 'custom_fields' => 'combined'], ]; + $civicrm_version = wf_crm_apivalues('System', 'get')[0]['version']; + // Grant is moved to extension after > 5.47.0. + if (version_compare($civicrm_version, '5.47') >= 0) { + $components = array_diff($components, ['CiviGrant']); + $grantStatus = wf_crm_apivalues('Extension', 'get', [ + 'full_name' => 'civigrant' + ], 'status'); + if (array_pop($grantStatus) == 'installed') { + $components[] = 'CiviGrant'; + } + } $conditional_sets = [ 'CiviCase' => ['entity_type' => 'case', 'label' => t('Case'), 'max_instances' => 30], 'CiviEvent' => ['entity_type' => 'participant', 'label' => t('Participant'), 'max_instances' => 9],