From 69550d14217c076152727a740871e1e84aae0a48 Mon Sep 17 00:00:00 2001 From: benjamin Date: Fri, 25 Oct 2024 10:36:58 +0100 Subject: [PATCH] fix hook crash if custom fields enabled for option values --- src/Fields.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Fields.php b/src/Fields.php index 56ee791ad..88a788f50 100644 --- a/src/Fields.php +++ b/src/Fields.php @@ -260,11 +260,13 @@ protected function wf_crm_get_fields($var = 'fields') { 'type' => 'select', 'default_value' => $this->utils->wf_crm_get_civi_setting('lcMessages', 'en_US'), ]; - $default_communication_style = $this->utils->wf_crm_apivalues('OptionValue', 'get', [ - 'sequential' => 1, - 'option_group_id' => "communication_style", - 'is_default' => 1, - ], 'value')[0] ?? NULL; + $default_communication_style = $this->utils->wf_civicrm_api4('OptionValue', 'get', [ + 'where' => [ + ['option_group_id.name', '=', 'communication_style'], + ['is_default', '=', TRUE], + ], + 'select' => ['value'], + ])->first()['value'] ?? NULL; $fields['contact_communication_style_id'] = [ 'name' => t('Communication Style'), 'type' => 'select',