🐛 fix bug: cannot search for TwingleForm by twingle_project_id

This commit is contained in:
Marc Michalsky 2023-02-28 15:14:31 +01:00
parent 6476a163fc
commit 51b19ac68d
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 21 additions and 0 deletions

View file

@ -14,6 +14,13 @@ use CRM_TwingleCampaign_Utils_ExtensionCache as Cache;
function _civicrm_api3_twingle_form_Get_spec(array &$spec) { function _civicrm_api3_twingle_form_Get_spec(array &$spec) {
$spec['id'] = [ $spec['id'] = [
'name' => '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'), 'title' => E::ts('TwingleProject ID'),
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'api.required' => 0, 'api.required' => 0,
@ -66,6 +73,13 @@ function civicrm_api3_twingle_form_Get(array $params): array {
// Get custom fields // Get custom fields
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); $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 // Replace twingle_project_type key with custom field name
if (key_exists('twingle_project_type', $params)) { if (key_exists('twingle_project_type', $params)) {
$params[$custom_field_mapping['twingle_project_type']] = $params[$custom_field_mapping['twingle_project_type']] =

View file

@ -12,6 +12,13 @@ use CRM_TwingleCampaign_ExtensionUtil as E;
function _civicrm_api3_twingle_form_Getsingle_spec(array &$spec) { function _civicrm_api3_twingle_form_Getsingle_spec(array &$spec) {
$spec['id'] = [ $spec['id'] = [
'name' => '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'), 'title' => E::ts('TwingleProject ID'),
'type' => CRM_Utils_Type::T_INT, 'type' => CRM_Utils_Type::T_INT,
'api.required' => 0, 'api.required' => 0,