diff --git a/includes/utils.inc b/includes/utils.inc index dbffc2c7c..ec4ea07f7 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], diff --git a/includes/wf_crm_webform_postprocess.inc b/includes/wf_crm_webform_postprocess.inc index 306c865c8..a98e7659a 100644 --- a/includes/wf_crm_webform_postprocess.inc +++ b/includes/wf_crm_webform_postprocess.inc @@ -1768,11 +1768,11 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base { $cid = $this->findDuplicateContact($contact); } $address = [ - 'street_address' => $this->billing_params['street_address'], - 'city' => $this->billing_params['city'], - 'country_id' => $this->billing_params['country_id'], + 'street_address' => $this->billing_params['street_address'] ?? '', + 'city' => $this->billing_params['city'] ?? '', + 'country_id' => $this->billing_params['country_id'] ?? '', 'state_province_id' => wf_crm_aval($this->billing_params, 'state_province_id'), - 'postal_code' => $this->billing_params['postal_code'], + 'postal_code' => $this->billing_params['postal_code'] ?? '', 'location_type_id' => 'Billing', ]; $email = [