👾 bug fix: broken campaign tree for TwingleEvents
This commit is contained in:
parent
60d69f5597
commit
88fb74bd6f
1 changed files with 12 additions and 10 deletions
|
@ -27,13 +27,11 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
$this->id_custom_field = Cache::getInstance()
|
$this->id_custom_field = Cache::getInstance()
|
||||||
->getCustomFieldMapping()['twingle_event_id'];
|
->getCustomFieldMapping()['twingle_event_id'];
|
||||||
|
|
||||||
if ($id) {
|
try {
|
||||||
try {
|
$this->values['parent_id'] = $this->getParentCampaignId();
|
||||||
$this->values['parent_id'] = $this->getParentCampaignId();
|
} catch (CiviCRM_API3_Exception $e) {
|
||||||
} catch (CiviCRM_API3_Exception $e) {
|
$errorMessage = $e->getMessage();
|
||||||
$errorMessage = $e->getMessage();
|
throw new Exception("Could not identify parent Campaign: $errorMessage");
|
||||||
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.
|
* Returns _TRUE_ if creation was successful or _FALSE if it creation failed.
|
||||||
*
|
*
|
||||||
* @param bool $no_hook
|
* @param bool $no_hook
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \CiviCRM_API3_Exception
|
* @throws \CiviCRM_API3_Exception
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
|
@ -86,8 +85,10 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
/**
|
/**
|
||||||
* ## Translate values between CiviCRM Campaigns and Twingle formats
|
* ## Translate values between CiviCRM Campaigns and Twingle formats
|
||||||
* Constants for **$direction**:<br>
|
* Constants for **$direction**:<br>
|
||||||
* **TwingleProject::IN** translate array values from Twingle to CiviCRM format<br>
|
* **TwingleProject::IN** translate array values from Twingle to CiviCRM
|
||||||
* **TwingleProject::OUT** translate array values from CiviCRM to Twingle format
|
* format<br>
|
||||||
|
* **TwingleProject::OUT** translate array values from CiviCRM to Twingle
|
||||||
|
* format
|
||||||
*
|
*
|
||||||
* @param array $values
|
* @param array $values
|
||||||
* array of values to translate
|
* array of values to translate
|
||||||
|
@ -241,7 +242,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
$parentCampaign = civicrm_api3('Campaign', 'get', [
|
$parentCampaign = civicrm_api3('Campaign', 'get', [
|
||||||
'sequential' => 1,
|
'sequential' => 1,
|
||||||
$cf_project_id => $this->values['project_id'],
|
$cf_project_id => $this->values['project_id'],
|
||||||
'options' => ['limit' => 0]
|
'options' => ['limit' => 0],
|
||||||
]);
|
]);
|
||||||
if ($parentCampaign['is_error'] == 0) {
|
if ($parentCampaign['is_error'] == 0) {
|
||||||
return (int) $parentCampaign['id'];
|
return (int) $parentCampaign['id'];
|
||||||
|
@ -285,4 +286,5 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
function getEventId(): int {
|
function getEventId(): int {
|
||||||
return (int) $this->values['id'];
|
return (int) $this->values['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue