let API call not overwrite campaign_type_id

This commit is contained in:
Marc Michalsky forumZFD 2020-12-17 10:30:54 +01:00
parent e843d8827c
commit 682ba5e7e2
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 13 additions and 31 deletions

View file

@ -54,14 +54,6 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
'api.required' => 0,
'description' => E::ts('Twingle ID for this Event'),
];
$spec['campaign_type_id'] = [
'name' => 'campaign_type_id',
'title' => E::ts('Campaign Type'),
'type' => CRM_Utils_Type::T_STRING,
'api.required' => 0,
'description' => E::ts('Campaign Type ID. Implicit FK to
cicicrm_option_value where option_group = campaign_type'),
];
$spec['last_modified_id'] = [
'name' => 'last_modified_id',
'title' => E::ts('Campaign Modified By'),
@ -101,15 +93,16 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
* @return array
* API result descriptor
*
* @throws CiviCRM_API3_Exception|API_Exception
* @see civicrm_api3_create_success
*
* @throws API_Exception
*/
function civicrm_api3_twingle_event_Get($params) {
function civicrm_api3_twingle_event_Get(array $params): array {
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
$query = ['sequential' => 1, 'campaign_type_id' => 'twingle_event'];
$params['campaign_type_id'] = 'twingle_event';
$query = [];
foreach ($params as $key => $value) {
if ( $key != 'id' &&
@ -160,7 +153,6 @@ function civicrm_api3_twingle_event_Get($params) {
return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get');
}
else {
return $result;
}