From 51b19ac68d56dd64c4db7a203e2bfce6991e885e Mon Sep 17 00:00:00 2001 From: Marc Michalsky Date: Tue, 28 Feb 2023 15:14:31 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20bug:=20cannot=20search=20f?= =?UTF-8?q?or=20TwingleForm=20by=20twingle=5Fproject=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v3/TwingleForm/Get.php | 14 ++++++++++++++ api/v3/TwingleForm/Getsingle.php | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/api/v3/TwingleForm/Get.php b/api/v3/TwingleForm/Get.php index 3e2f867..6adaf2e 100644 --- a/api/v3/TwingleForm/Get.php +++ b/api/v3/TwingleForm/Get.php @@ -14,6 +14,13 @@ use CRM_TwingleCampaign_Utils_ExtensionCache as Cache; function _civicrm_api3_twingle_form_Get_spec(array &$spec) { $spec['id'] = [ 'name' => 'id', + 'title' => E::ts('Campaign ID'), + 'type' => CRM_Utils_Type::T_INT, + 'api.required' => 0, + 'description' => E::ts('The campaign ID'), + ]; + $spec['twingle_project_id'] = [ + 'name' => 'twingle_project_id', 'title' => E::ts('TwingleProject ID'), 'type' => CRM_Utils_Type::T_INT, 'api.required' => 0, @@ -66,6 +73,13 @@ function civicrm_api3_twingle_form_Get(array $params): array { // Get custom fields $custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); + // Replace twingle_project_id key with custom field name + if (key_exists('twingle_project_id', $params)) { + $params[$custom_field_mapping['twingle_project_id']] = + $params['twingle_project_id']; + unset($params['twingle_project_id']); + } + // Replace twingle_project_type key with custom field name if (key_exists('twingle_project_type', $params)) { $params[$custom_field_mapping['twingle_project_type']] = diff --git a/api/v3/TwingleForm/Getsingle.php b/api/v3/TwingleForm/Getsingle.php index e763683..09e18d5 100644 --- a/api/v3/TwingleForm/Getsingle.php +++ b/api/v3/TwingleForm/Getsingle.php @@ -12,6 +12,13 @@ use CRM_TwingleCampaign_ExtensionUtil as E; function _civicrm_api3_twingle_form_Getsingle_spec(array &$spec) { $spec['id'] = [ 'name' => 'id', + 'title' => E::ts('Campaign ID'), + 'type' => CRM_Utils_Type::T_INT, + 'api.required' => 0, + 'description' => E::ts('The campaign ID'), + ]; + $spec['twingle_project_id'] = [ + 'name' => 'twingle_project_id', 'title' => E::ts('TwingleProject ID'), 'type' => CRM_Utils_Type::T_INT, 'api.required' => 0,