From 282332e5716faf28825fa5d2ffd76346252746f6 Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Mon, 14 Mar 2022 09:45:49 +0000 Subject: [PATCH] Added missing anonymous tracking condition --- src/elements/CampaignElement.php | 2 +- src/services/CampaignsService.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/elements/CampaignElement.php b/src/elements/CampaignElement.php index 57a5a4aa..d5df96dc 100644 --- a/src/elements/CampaignElement.php +++ b/src/elements/CampaignElement.php @@ -649,7 +649,7 @@ public function getStatus(): ?string */ public function hasRevisions(): bool { - return $this->getCampaignType()->enableVersioning; + return true; } /** diff --git a/src/services/CampaignsService.php b/src/services/CampaignsService.php index 45b32dc9..2230ba62 100644 --- a/src/services/CampaignsService.php +++ b/src/services/CampaignsService.php @@ -43,7 +43,10 @@ public function addContactInteraction(ContactElement $contact, SendoutElement $s } /** @var CampaignRecord|null $campaignRecord */ - $campaignRecord = CampaignRecord::findOne($sendout->campaignId); + $campaignRecord = CampaignRecord::find() + ->where(['id' => $sendout->campaignId]) + ->with('campaignType') + ->one(); if ($campaignRecord === null) { return; @@ -103,7 +106,10 @@ public function addContactInteraction(ContactElement $contact, SendoutElement $s } } - $contactCampaignRecord->save(); + // Only save is anonymous tracking is not enabled + if ($campaignRecord->campaignType->enableAnonymousTracking === false) { + $contactCampaignRecord->save(); + } $campaignRecord->save(); }