From fdda031dcfd46c96e8df9ed4fd02a93c53f432d8 Mon Sep 17 00:00:00 2001 From: bencroker Date: Fri, 29 Nov 2024 13:33:35 -0600 Subject: [PATCH] Reset duplicate campaign stats --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- src/elements/CampaignElement.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 104c1c8b..4c51a3bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes for Campaign +## 2.17.8 - 2024-11-29 + +### Fixed + +- Fixed a bug in which duplicating campaigns was not resetting the new campaign’s stats. + ## 2.17.7 - 2024-10-31 ### Changed diff --git a/composer.json b/composer.json index 4d1bbfcc..8fa66f01 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-campaign", "description": "Send and manage email campaigns, contacts and mailing lists.", - "version": "2.17.7", + "version": "2.17.8", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/elements/CampaignElement.php b/src/elements/CampaignElement.php index 6ddff4c4..efec72db 100755 --- a/src/elements/CampaignElement.php +++ b/src/elements/CampaignElement.php @@ -887,7 +887,7 @@ protected function statusFieldHtml(): string public function beforeSave(bool $isNew): bool { // Reset stats if this is a duplicate of a non-draft campaign. - if ($this->firstSave && $this->duplicateOf !== null) { + if ($isNew && $this->getIsCanonical() && $this->duplicateOf !== null) { $this->recipients = 0; $this->opened = 0; $this->clicked = 0;