let API call not overwrite campaign_type_id
This commit is contained in:
parent
e843d8827c
commit
682ba5e7e2
3 changed files with 13 additions and 31 deletions
|
@ -54,14 +54,6 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
|
||||||
'api.required' => 0,
|
'api.required' => 0,
|
||||||
'description' => E::ts('Twingle ID for this Event'),
|
'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'] = [
|
$spec['last_modified_id'] = [
|
||||||
'name' => 'last_modified_id',
|
'name' => 'last_modified_id',
|
||||||
'title' => E::ts('Campaign Modified By'),
|
'title' => E::ts('Campaign Modified By'),
|
||||||
|
@ -101,15 +93,16 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) {
|
||||||
* @return array
|
* @return array
|
||||||
* API result descriptor
|
* API result descriptor
|
||||||
*
|
*
|
||||||
|
* @throws CiviCRM_API3_Exception|API_Exception
|
||||||
* @see civicrm_api3_create_success
|
* @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 = Cache::getInstance()->getCustomFieldMapping();
|
||||||
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
|
$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) {
|
foreach ($params as $key => $value) {
|
||||||
if ( $key != 'id' &&
|
if ( $key != 'id' &&
|
||||||
|
@ -160,7 +153,6 @@ function civicrm_api3_twingle_event_Get($params) {
|
||||||
|
|
||||||
return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get');
|
return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get');
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ function _civicrm_api3_twingle_form_Get_spec(array &$spec) {
|
||||||
* @see civicrm_api3_create_success
|
* @see civicrm_api3_create_success
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function civicrm_api3_twingle_form_Get(array $params) {
|
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();
|
||||||
|
@ -66,11 +66,10 @@ function civicrm_api3_twingle_form_Get(array $params) {
|
||||||
unset($params['twingle_project_type']);
|
unset($params['twingle_project_type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = [
|
$params['campaign_type_id'] = "twingle_project";
|
||||||
'sequential' => 1,
|
$params['is_active'] = 1;
|
||||||
'is_active' => 1,
|
$request = [];
|
||||||
'campaign_type_id' => "twingle_project"
|
|
||||||
];
|
|
||||||
foreach($params as $key => $param) {
|
foreach($params as $key => $param) {
|
||||||
$request[$key] = $param;
|
$request[$key] = $param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,6 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) {
|
||||||
'api.required' => 0,
|
'api.required' => 0,
|
||||||
'description' => E::ts('Twingle ID for this project'),
|
'description' => E::ts('Twingle ID for this project'),
|
||||||
];
|
];
|
||||||
$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'] = [
|
$spec['last_modified_id'] = [
|
||||||
'name' => 'last_modified_id',
|
'name' => 'last_modified_id',
|
||||||
'title' => E::ts('Campaign Modified By'),
|
'title' => E::ts('Campaign Modified By'),
|
||||||
|
@ -109,17 +101,17 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) {
|
||||||
* @return array
|
* @return array
|
||||||
* API result descriptor
|
* API result descriptor
|
||||||
*
|
*
|
||||||
* @throws \CiviCRM_API3_Exception|\CiviCRM_API3_Exception
|
* @throws \CiviCRM_API3_Exception
|
||||||
* @throws \API_Exception
|
* @throws \API_Exception
|
||||||
* @see civicrm_api3_create_success
|
* @see civicrm_api3_create_success
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function civicrm_api3_twingle_project_Get($params) {
|
function civicrm_api3_twingle_project_Get(array $params): array {
|
||||||
|
|
||||||
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
||||||
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
|
$custom_field_mapping_reverse = array_flip($custom_field_mapping);
|
||||||
|
|
||||||
$query = ['sequential' => 1, 'campaign_type_id' => 'twingle_project'];
|
$params['campaign_type_id'] = 'twingle_project';
|
||||||
|
$query = [];
|
||||||
|
|
||||||
foreach ($params as $key => $value) {
|
foreach ($params as $key => $value) {
|
||||||
if ( $key != 'id' &&
|
if ( $key != 'id' &&
|
||||||
|
@ -168,7 +160,6 @@ function civicrm_api3_twingle_project_Get($params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get');
|
return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue