👾 bug fix: broken campaign tree for TwingleEvents

This commit is contained in:
Marc Michalsky forumZFD 2021-04-06 21:29:07 +02:00
parent 60d69f5597
commit 88fb74bd6f
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -27,7 +27,6 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
$this->id_custom_field = Cache::getInstance()
->getCustomFieldMapping()['twingle_event_id'];
if ($id) {
try {
$this->values['parent_id'] = $this->getParentCampaignId();
} catch (CiviCRM_API3_Exception $e) {
@ -35,7 +34,6 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
throw new Exception("Could not identify parent Campaign: $errorMessage");
}
}
}
/**
@ -43,6 +41,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
* Returns _TRUE_ if creation was successful or _FALSE if it creation failed.
*
* @param bool $no_hook
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \Exception
@ -86,8 +85,10 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
/**
* ## Translate values between CiviCRM Campaigns and Twingle formats
* Constants for **$direction**:<br>
* **TwingleProject::IN** translate array values from Twingle to CiviCRM format<br>
* **TwingleProject::OUT** translate array values from CiviCRM to Twingle format
* **TwingleProject::IN** translate array values from Twingle to CiviCRM
* format<br>
* **TwingleProject::OUT** translate array values from CiviCRM to Twingle
* format
*
* @param array $values
* array of values to translate
@ -241,7 +242,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
$parentCampaign = civicrm_api3('Campaign', 'get', [
'sequential' => 1,
$cf_project_id => $this->values['project_id'],
'options' => ['limit' => 0]
'options' => ['limit' => 0],
]);
if ($parentCampaign['is_error'] == 0) {
return (int) $parentCampaign['id'];
@ -285,4 +286,5 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
function getEventId(): int {
return (int) $this->values['id'];
}
}