diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd4a22..8fc9bba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## Changelog +5.0.1 - 2025-10-10 +- Fix markReportAsSent method was missing + 5.0.0 - 2025-09-29 - Initial release to send scheduled reports and Custom Alerts to a Slack channel diff --git a/Slack.php b/Slack.php index 3f45e19..0965a4c 100644 --- a/Slack.php +++ b/Slack.php @@ -319,7 +319,9 @@ public function sendReport( $subject = Piwik::translate('Slack_PleaseFindYourReport', [$periods[$report['period']], $reportSubject]); $channelId = $report['parameters'][self::SLACK_CHANNEL_ID_PARAMETER]; $scheduleReportSlack = new ScheduleReportSlack($subject, $filename, $contents, $channelId, $token); - $scheduleReportSlack->send(); + if ($scheduleReportSlack->send() && !$force) { + $this->markReportAsSent($report, $period); + } } /** @@ -503,6 +505,13 @@ private function reportAlreadySent($report, Period $period) return $previousDate === $period->getRangeString(); } + private function markReportAsSent($report, Period $period) + { + $key = ScheduledReports::OPTION_KEY_LAST_SENT_DATERANGE . $report['idreport']; + + Option::set($key, $period->getRangeString()); + } + private static function valueIsTrue($value) { return $value == 'true' || $value == 1 || $value == '1' || $value === true; diff --git a/plugin.json b/plugin.json index 537c42b..5a41ce4 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "Slack", "description": "Send Matomo reports and alerts to Slack channels, keeping your team informed and ready to act in real time.", - "version": "5.0.0", + "version": "5.0.1", "theme": false, "require": { "matomo": ">=5.0.0,<6.0.0-b1"