👾 bug fix: TwingleCampaign cannot find parent campaign

This commit is contained in:
Marc Michalsky forumZFD 2021-04-12 14:40:04 +02:00
parent a658190a68
commit cc6777e206
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
5 changed files with 36 additions and 9 deletions

View file

@ -32,7 +32,7 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
$this->id = $id ?? NULL;
$this->values['campaign_type_id'] = 'twingle_campaign';
if ($this->id) {
if (!isset($this->id)) {
$this->update($values);
$this->getParentProject();
$this->createCid();
@ -341,10 +341,11 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
*/
private
function update(array $values) {
$filter = ExtensionCache::getInstance()->getTemplates()['TwingleCampaign'];
$filter = ExtensionCache::getInstance()
->getTemplates()['TwingleCampaign']['campaign_data'];
foreach ($values as $key => $value) {
if (in_array($key, $filter)) {
$this->values[$key] = $values[$key];
$this->values[$key] = $value;
}
}
}

View file

@ -27,7 +27,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
$this->id_custom_field = Cache::getInstance()
->getCustomFieldMapping()['twingle_event_id'];
if (isset($this->values['parent_id'])) {
if (!isset($this->values['parent_id'])) {
try {
$this->values['parent_id'] = $this->getParentCampaignId();
} catch (CiviCRM_API3_Exception $e) {