From 3271dd3c8b7c54f14ce157d9ce5f2650f12b08b9 Mon Sep 17 00:00:00 2001 From: bencroker Date: Mon, 12 Jun 2023 08:13:44 +0200 Subject: [PATCH] Fix dashboard widget date range exception --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/widgets/CampaignStatsWidget.php | 4 ++-- src/widgets/MailingListStatsWidget.php | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b211dc3c..0506c74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Campaign +## 2.8.2 - 2023-06-12 +### Fixed +Fixed a bug in which Campaign dashboard widgets were throwing exceptions when a date range was set ([#396](https://github.com/putyourlightson/craft-campaign/issues/396)). + ## 2.8.1 - 2023-06-08 ### Fixed Fixed a bug in which Feed Me imports were not working when the queue was being run via console requests ([#395](https://github.com/putyourlightson/craft-campaign/issues/395)). diff --git a/composer.json b/composer.json index 2b08b69d..8bc07cf5 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.8.1", + "version": "2.8.2", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/widgets/CampaignStatsWidget.php b/src/widgets/CampaignStatsWidget.php index 12f29a7e..e4d48e22 100755 --- a/src/widgets/CampaignStatsWidget.php +++ b/src/widgets/CampaignStatsWidget.php @@ -110,8 +110,8 @@ public function getBodyHtml(): ?string $endDate = Db::prepareDateForDb($endDate); $campaignQuery->andWhere(['and', - ['>=', 'dateCreated', $startDate], - ['<', 'dateCreated', $endDate], + ['>=', '[[elements.dateCreated]]', $startDate], + ['<', '[[elements.dateCreated]]', $endDate], ]); $sendoutQuery->andWhere(['and', ['>=', 'sendDate', $startDate], diff --git a/src/widgets/MailingListStatsWidget.php b/src/widgets/MailingListStatsWidget.php index 388af591..6ce0d78c 100755 --- a/src/widgets/MailingListStatsWidget.php +++ b/src/widgets/MailingListStatsWidget.php @@ -106,8 +106,8 @@ public function getBodyHtml(): ?string $endDate = Db::prepareDateForDb($endDate); $mailingListQuery->andWhere(['and', - ['>=', 'dateCreated', $startDate], - ['<', 'dateCreated', $endDate], + ['>=', '[[elements.dateCreated]]', $startDate], + ['<', '[[elements.dateCreated]]', $endDate], ]); $contactMailingListQuery->andWhere(['and', ['>=', 'subscribed', $startDate],