Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenaka <diosmosis@users.noreply.github.com>2017-11-24 03:58:22 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2017-11-24 03:58:22 +0300
commitf092d3b20289e8f6844674779b7b8b475e553cd1 (patch)
treeb2374f6db41f9309f2ba19d4dc4d9c6cd9260262
parent1f12b54962e58a893aa211b931b5e231c217df64 (diff)
Use consistent HTML email body for all scheduled reports (HTML, PDF & CSV) (#12233)
* Extract mail configuring parts of sendReport method & write tests for them. * Use twig in AttachedFileReportEmailGenerator. * Extract header/footer of html scheduled report email into re-usable View subclasses & use for PDF/CSV emails. * Fixing test failures. * Integrationt est
-rw-r--r--core/ReportRenderer/Html.php67
-rw-r--r--core/View/HtmlEmailFooterView.php25
-rw-r--r--core/View/HtmlReportEmailHeaderView.php92
-rw-r--r--plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig4
-rw-r--r--plugins/ScheduledReports/API.php2
-rw-r--r--plugins/ScheduledReports/GeneratedReport.php105
-rw-r--r--plugins/ScheduledReports/ReportEmailGenerator.php48
-rw-r--r--plugins/ScheduledReports/ReportEmailGenerator/AttachedFileReportEmailGenerator.php82
-rw-r--r--plugins/ScheduledReports/ReportEmailGenerator/HtmlReportEmailGenerator.php25
-rw-r--r--plugins/ScheduledReports/ScheduledReports.php129
-rw-r--r--plugins/ScheduledReports/config/config.php24
-rw-r--r--plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php146
-rw-r--r--plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/HtmlReportEmailGeneratorTest.php54
-rw-r--r--plugins/ScheduledReports/tests/Integration/ReportEmailGeneratorTest.php137
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html4
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html4
-rw-r--r--tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html4
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html4
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html4
-rw-r--r--tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html4
20 files changed, 773 insertions, 191 deletions
diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php
index 3240a8ad94..b447cdf8e6 100644
--- a/core/ReportRenderer/Html.php
+++ b/core/ReportRenderer/Html.php
@@ -9,15 +9,8 @@
namespace Piwik\ReportRenderer;
use Piwik\Piwik;
-use Piwik\Plugin;
-use Piwik\Plugins\API\API;
-use Piwik\Plugins\CoreAdminHome\CustomLogo;
use Piwik\ReportRenderer;
-use Piwik\SettingsPiwik;
-use Piwik\Site;
-use Piwik\Date;
use Piwik\View;
-use Piwik\Plugins\ScheduledReports\ScheduledReports;
/**
* HTML report renderer
@@ -27,11 +20,6 @@ class Html extends ReportRenderer
const IMAGE_GRAPH_WIDTH = 700;
const IMAGE_GRAPH_HEIGHT = 200;
- const REPORT_TITLE_TEXT_SIZE = 24;
- const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
- const REPORT_TABLE_ROW_TEXT_SIZE = '13px';
- const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
-
const HTML_CONTENT_TYPE = 'text/html';
const HTML_FILE_EXTENSION = 'html';
@@ -86,68 +74,21 @@ class Html extends ReportRenderer
private function epilogue()
{
- $view = new View('@CoreHome/ReportRenderer/_htmlReportFooter');
- $view->hasWhiteLabel = Plugin\Manager::getInstance()->isPluginLoaded('WhiteLabel');
+ $view = new View\HtmlEmailFooterView();
$this->rendering .= $view->render();
}
public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata, $segment)
{
- $frontPageView = new View('@CoreHome/ReportRenderer/_htmlReportHeader');
- $this->assignCommonParameters($frontPageView);
-
- $period = $this->report['period'];
-
- $periods = ScheduledReports::getPeriodToFrequencyAsAdjective();
- $frontPageView->assign("period", $periods[$period]);
- $frontPageView->assign("reportTitle", $reportTitle);
- $frontPageView->assign("prettyDate", $prettyDate);
- $frontPageView->assign("description", $description);
- $frontPageView->assign("reportMetadata", $reportMetadata);
- $frontPageView->assign("websiteName", Site::getNameFor($this->idSite));
- $frontPageView->assign("idSite", $this->idSite);
- $frontPageView->assign("period", $period);
-
- $customLogo = new CustomLogo();
- $frontPageView->assign("isCustomLogo", $customLogo->isEnabled() && CustomLogo::hasUserLogo());
- $frontPageView->assign("logoHeader", $customLogo->getHeaderLogoUrl($pathOnly = false));
-
- $date = Date::now()->setTimezone(Site::getTimezoneFor($this->idSite))->toString();
- $frontPageView->assign("date", $date);
-
- // segment
- $displaySegment = ($segment != null);
- $frontPageView->assign("displaySegment", $displaySegment);
- if ($displaySegment) {
- $frontPageView->assign("segmentName", $segment['name']);
- }
-
+ $frontPageView = new View\HtmlReportEmailHeaderView($reportTitle, $prettyDate, $description, $reportMetadata,
+ $segment, $this->idSite, $this->report['period']);
$this->rendering .= $frontPageView->render();
}
- private function assignCommonParameters(View $view)
- {
- $view->assign("reportFontFamily", ReportRenderer::DEFAULT_REPORT_FONT_FAMILY);
- $view->assign("reportTitleTextColor", ReportRenderer::REPORT_TITLE_TEXT_COLOR);
- $view->assign("reportTitleTextSize", self::REPORT_TITLE_TEXT_SIZE);
- $view->assign("reportTextColor", ReportRenderer::REPORT_TEXT_COLOR);
- $view->assign("tableHeaderBgColor", ReportRenderer::TABLE_HEADER_BG_COLOR);
- $view->assign("tableHeaderTextColor", ReportRenderer::TABLE_HEADER_TEXT_COLOR);
- $view->assign("tableCellBorderColor", ReportRenderer::TABLE_CELL_BORDER_COLOR);
- $view->assign("tableBgColor", ReportRenderer::TABLE_BG_COLOR);
- $view->assign("reportTableHeaderTextWeight", self::TABLE_HEADER_TEXT_WEIGHT);
- $view->assign("reportTableHeaderTextSize", self::REPORT_TABLE_HEADER_TEXT_SIZE);
- $view->assign("reportTableHeaderTextTransform", ReportRenderer::TABLE_HEADER_TEXT_TRANSFORM);
- $view->assign("reportTableRowTextSize", self::REPORT_TABLE_ROW_TEXT_SIZE);
- $view->assign("reportBackToTopTextSize", self::REPORT_BACK_TO_TOP_TEXT_SIZE);
- $view->assign("currentPath", SettingsPiwik::getPiwikUrl());
- $view->assign("logoHeader", API::getInstance()->getHeaderLogoUrl());
- }
-
public function renderReport($processedReport)
{
$reportView = new View('@CoreHome/ReportRenderer/_htmlReportBody');
- $this->assignCommonParameters($reportView);
+ View\HtmlReportEmailHeaderView::assignCommonParameters($reportView);
$reportMetadata = $processedReport['metadata'];
$reportData = $processedReport['reportData'];
diff --git a/core/View/HtmlEmailFooterView.php b/core/View/HtmlEmailFooterView.php
new file mode 100644
index 0000000000..123736a0df
--- /dev/null
+++ b/core/View/HtmlEmailFooterView.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\View;
+
+
+use Piwik\View;
+
+class HtmlEmailFooterView extends View
+{
+ const TEMPLATE_FILE = '@CoreHome/ReportRenderer/_htmlReportFooter';
+
+ public function __construct()
+ {
+ parent::__construct(self::TEMPLATE_FILE);
+
+ $this->hasWhiteLabel = \Piwik\Plugin\Manager::getInstance()->isPluginLoaded('WhiteLabel');
+ }
+} \ No newline at end of file
diff --git a/core/View/HtmlReportEmailHeaderView.php b/core/View/HtmlReportEmailHeaderView.php
new file mode 100644
index 0000000000..d27b20ad43
--- /dev/null
+++ b/core/View/HtmlReportEmailHeaderView.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\View;
+
+use Piwik\Date;
+use Piwik\Plugins\API\API;
+use Piwik\Plugins\CoreAdminHome\CustomLogo;
+use Piwik\ReportRenderer;
+use Piwik\Scheduler\Schedule\Schedule;
+use Piwik\SettingsPiwik;
+use Piwik\Site;
+use Piwik\View;
+
+class HtmlReportEmailHeaderView extends View
+{
+ const TEMPLATE_FILE = '@CoreHome/ReportRenderer/_htmlReportHeader';
+
+ const REPORT_TITLE_TEXT_SIZE = 24;
+ const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
+ const REPORT_TABLE_ROW_TEXT_SIZE = '13px';
+ const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
+
+ private static $reportFrequencyTranslationByPeriod = [
+ Schedule::PERIOD_DAY => 'General_DailyReport',
+ Schedule::PERIOD_WEEK => 'General_WeeklyReport',
+ Schedule::PERIOD_MONTH => 'General_MonthlyReport',
+ Schedule::PERIOD_YEAR => 'General_YearlyReport',
+ Schedule::PERIOD_RANGE => 'General_RangeReports',
+ ];
+
+ public function __construct($reportTitle, $prettyDate, $description, $reportMetadata, $segment, $idSite, $period)
+ {
+ parent::__construct(self::TEMPLATE_FILE);
+
+ self::assignCommonParameters($this);
+
+ $periods = self::getPeriodToFrequencyAsAdjective();
+ $this->assign("frequency", $periods[$period]);
+ $this->assign("reportTitle", $reportTitle);
+ $this->assign("prettyDate", $prettyDate);
+ $this->assign("description", $description);
+ $this->assign("reportMetadata", $reportMetadata);
+ $this->assign("websiteName", Site::getNameFor($idSite));
+ $this->assign("idSite", $idSite);
+ $this->assign("period", $period);
+
+ $customLogo = new CustomLogo();
+ $this->assign("isCustomLogo", $customLogo->isEnabled() && CustomLogo::hasUserLogo());
+ $this->assign("logoHeader", $customLogo->getHeaderLogoUrl($pathOnly = false));
+
+ $date = Date::now()->setTimezone(Site::getTimezoneFor($idSite))->toString();
+ $this->assign("date", $date);
+
+ // segment
+ $displaySegment = ($segment != null);
+ $this->assign("displaySegment", $displaySegment);
+ if ($displaySegment) {
+ $this->assign("segmentName", $segment['name']);
+ }
+ }
+
+ public static function assignCommonParameters(View $view)
+ {
+ $view->assign("reportFontFamily", ReportRenderer::DEFAULT_REPORT_FONT_FAMILY);
+ $view->assign("reportTitleTextColor", ReportRenderer::REPORT_TITLE_TEXT_COLOR);
+ $view->assign("reportTitleTextSize", self::REPORT_TITLE_TEXT_SIZE);
+ $view->assign("reportTextColor", ReportRenderer::REPORT_TEXT_COLOR);
+ $view->assign("tableHeaderBgColor", ReportRenderer::TABLE_HEADER_BG_COLOR);
+ $view->assign("tableHeaderTextColor", ReportRenderer::TABLE_HEADER_TEXT_COLOR);
+ $view->assign("tableCellBorderColor", ReportRenderer::TABLE_CELL_BORDER_COLOR);
+ $view->assign("tableBgColor", ReportRenderer::TABLE_BG_COLOR);
+ $view->assign("reportTableHeaderTextWeight", ReportRenderer::TABLE_HEADER_TEXT_WEIGHT);
+ $view->assign("reportTableHeaderTextSize", self::REPORT_TABLE_HEADER_TEXT_SIZE);
+ $view->assign("reportTableHeaderTextTransform", ReportRenderer::TABLE_HEADER_TEXT_TRANSFORM);
+ $view->assign("reportTableRowTextSize", self::REPORT_TABLE_ROW_TEXT_SIZE);
+ $view->assign("reportBackToTopTextSize", self::REPORT_BACK_TO_TOP_TEXT_SIZE);
+ $view->assign("currentPath", SettingsPiwik::getPiwikUrl());
+ $view->assign("logoHeader", API::getInstance()->getHeaderLogoUrl());
+ }
+
+ private static function getPeriodToFrequencyAsAdjective()
+ {
+ return array_map(['\Piwik\Piwik', 'translate'], self::$reportFrequencyTranslationByPeriod);
+ }
+}
diff --git a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig
index a301147477..d4f8dd64d4 100644
--- a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig
+++ b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig
@@ -38,7 +38,11 @@
</h2>
<p style='{{styleParagraph}}{{fontStyle}}'>
+ {% if isAttachedFile is defined and isAttachedFile %}
+ {{ 'ScheduledReports_PleaseFindAttachedFile'|translate(frequency, reportTitle) }}
+ {% else %}
{{'ScheduledReports_PleaseFindBelow'|translate(period,reportTitle)}}
+ {% endif %}
<br />{{ description }}
<br />{{ 'General_DateRange'|translate }} {{ prettyDate }}
<br />{{ 'ScheduledReports_SentFromX'|translate(piwikUrl) }}
diff --git a/plugins/ScheduledReports/API.php b/plugins/ScheduledReports/API.php
index 7674634120..4ac650fe34 100644
--- a/plugins/ScheduledReports/API.php
+++ b/plugins/ScheduledReports/API.php
@@ -26,10 +26,8 @@ use Piwik\Plugins\SegmentEditor\API as APISegmentEditor;
use Piwik\Plugins\SitesManager\API as SitesManagerApi;
use Piwik\ReportRenderer;
use Piwik\Site;
-use Piwik\Tracker;
use Piwik\Translate;
use Piwik\Translation\Translator;
-use Piwik\Url;
use Psr\Log\LoggerInterface;
/**
diff --git a/plugins/ScheduledReports/GeneratedReport.php b/plugins/ScheduledReports/GeneratedReport.php
new file mode 100644
index 0000000000..6baf311850
--- /dev/null
+++ b/plugins/ScheduledReports/GeneratedReport.php
@@ -0,0 +1,105 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports;
+
+use Piwik\Piwik;
+
+class GeneratedReport
+{
+ /**
+ * @var array
+ */
+ private $reportDetails;
+
+ /**
+ * @var string
+ */
+ private $reportTitle;
+
+ /**
+ * @var string
+ */
+ private $prettyDate;
+
+ /**
+ * @var string
+ */
+ private $contents;
+
+ /**
+ * @var array
+ */
+ private $additionalFiles;
+
+ public function __construct(array $reportDetails, $reportTitle, $prettyDate, $contents, array $additionalFiles)
+ {
+ $this->reportDetails = $reportDetails;
+ $this->reportTitle = $reportTitle;
+ $this->prettyDate = $prettyDate;
+ $this->contents = $contents;
+ $this->additionalFiles = $additionalFiles;
+ }
+
+ /**
+ * @return array
+ */
+ public function getReportDetails()
+ {
+ return $this->reportDetails;
+ }
+
+ /**
+ * @return string
+ */
+ public function getReportTitle()
+ {
+ return $this->reportTitle;
+ }
+
+ /**
+ * @return string
+ */
+ public function getPrettyDate()
+ {
+ return $this->prettyDate;
+ }
+
+ /**
+ * @return string
+ */
+ public function getContents()
+ {
+ return $this->contents;
+ }
+
+ /**
+ * @return array
+ */
+ public function getAdditionalFiles()
+ {
+ return $this->additionalFiles;
+ }
+
+ /**
+ * @return string
+ */
+ public function getReportFormat()
+ {
+ return $this->reportDetails['format'] ?: 'pdf';
+ }
+
+ /**
+ * @return string
+ */
+ public function getReportDescription()
+ {
+ return Piwik::translate('General_Report') . ' ' . $this->reportTitle . " - " . $this->prettyDate;
+ }
+}
diff --git a/plugins/ScheduledReports/ReportEmailGenerator.php b/plugins/ScheduledReports/ReportEmailGenerator.php
new file mode 100644
index 0000000000..bda895280e
--- /dev/null
+++ b/plugins/ScheduledReports/ReportEmailGenerator.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports;
+
+use Piwik\Mail;
+use Piwik\Piwik;
+use Zend_Mime;
+
+abstract class ReportEmailGenerator
+{
+ public function makeEmail(GeneratedReport $report, $customReplyTo = null)
+ {
+ $mail = new Mail();
+ $mail->setDefaultFromPiwik();
+ $mail->setSubject($report->getReportDescription());
+
+ if (!empty($customReplyTo)) {
+ $mail->setReplyTo($customReplyTo['email'], $customReplyTo['alias']);
+ }
+
+ $this->configureEmail($mail, $report);
+
+ foreach ($report->getAdditionalFiles() as $additionalFile) {
+ $fileContent = $additionalFile['content'];
+ $at = $mail->createAttachment(
+ $fileContent,
+ $additionalFile['mimeType'],
+ Zend_Mime::DISPOSITION_INLINE,
+ $additionalFile['encoding'],
+ $additionalFile['filename']
+ );
+ $at->id = $additionalFile['cid'];
+
+ unset($fileContent);
+ }
+
+ return $mail;
+ }
+
+ protected abstract function configureEmail(Mail $mail, GeneratedReport $report);
+}
diff --git a/plugins/ScheduledReports/ReportEmailGenerator/AttachedFileReportEmailGenerator.php b/plugins/ScheduledReports/ReportEmailGenerator/AttachedFileReportEmailGenerator.php
new file mode 100644
index 0000000000..31257d0825
--- /dev/null
+++ b/plugins/ScheduledReports/ReportEmailGenerator/AttachedFileReportEmailGenerator.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+
+use Piwik\Mail;
+use Piwik\Plugins\ScheduledReports\API;
+use Piwik\Plugins\ScheduledReports\GeneratedReport;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+use Piwik\SettingsPiwik;
+use Piwik\View;
+use Zend_Mime;
+
+class AttachedFileReportEmailGenerator extends ReportEmailGenerator
+{
+ /**
+ * @var string
+ */
+ private $attachedFileExtension;
+
+ /**
+ * @var string
+ */
+ private $attachedFileMimeType;
+
+ /**
+ * @var string
+ */
+ private $piwikUrl;
+
+ public function __construct($attachedFileExtension, $attachedFileMimeType, $piwikUrl = null)
+ {
+ $this->attachedFileExtension = $attachedFileExtension;
+ $this->attachedFileMimeType = $attachedFileMimeType;
+ $this->piwikUrl = $piwikUrl === null ? SettingsPiwik::getPiwikUrl() : $piwikUrl;
+ }
+
+ protected function configureEmail(Mail $mail, GeneratedReport $report)
+ {
+ $message = $this->getMessageBody($report);
+ $mail->setBodyHtml($message);
+
+ $mail->createAttachment(
+ $report->getContents(),
+ $this->attachedFileMimeType,
+ Zend_Mime::DISPOSITION_INLINE,
+ Zend_Mime::ENCODING_BASE64,
+ $report->getReportDescription() . $this->attachedFileExtension
+ );
+ }
+
+ private function getMessageBody(GeneratedReport $report)
+ {
+ $reportDetails = $report->getReportDetails();
+
+ $segment = null;
+ if (!empty($reportDetails['idsegment'])) {
+ $segment = API::getSegment($reportDetails['idsegment']);
+ }
+
+ $headerView = new View\HtmlReportEmailHeaderView(
+ $report->getReportTitle(),
+ $report->getPrettyDate(),
+ $report->getReportDescription(),
+ [],
+ $segment,
+ $reportDetails['idsite'],
+ $reportDetails['period']
+ );
+ $headerView->isAttachedFile = true;
+
+ $footerView = new View\HtmlEmailFooterView();
+
+ return $headerView->render() . $footerView->render();
+ }
+}
diff --git a/plugins/ScheduledReports/ReportEmailGenerator/HtmlReportEmailGenerator.php b/plugins/ScheduledReports/ReportEmailGenerator/HtmlReportEmailGenerator.php
new file mode 100644
index 0000000000..d1885551dc
--- /dev/null
+++ b/plugins/ScheduledReports/ReportEmailGenerator/HtmlReportEmailGenerator.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+
+use Piwik\Mail;
+use Piwik\Plugins\ScheduledReports\GeneratedReport;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+use Zend_Mime;
+
+class HtmlReportEmailGenerator extends ReportEmailGenerator
+{
+ protected function configureEmail(Mail $mail, GeneratedReport $report)
+ {
+ // Needed when using images as attachment with cid
+ $mail->setType(Zend_Mime::MULTIPART_RELATED);
+ $mail->setBodyHtml($report->getContents());
+ }
+} \ No newline at end of file
diff --git a/plugins/ScheduledReports/ScheduledReports.php b/plugins/ScheduledReports/ScheduledReports.php
index b22d4cecdc..3cc11f608d 100644
--- a/plugins/ScheduledReports/ScheduledReports.php
+++ b/plugins/ScheduledReports/ScheduledReports.php
@@ -9,22 +9,19 @@
namespace Piwik\Plugins\ScheduledReports;
use Exception;
-use Piwik\Db;
+use Piwik\Config;
+use Piwik\Container\StaticContainer;
use Piwik\Log;
-use Piwik\Mail;
use Piwik\Option;
use Piwik\Period;
use Piwik\Piwik;
+use Piwik\Plugins\UsersManager\Model as UserModel;
use Piwik\Plugins\MobileMessaging\MobileMessaging;
use Piwik\Plugins\UsersManager\API as APIUsersManager;
-use Piwik\Plugins\UsersManager\Model as UserModel;
use Piwik\ReportRenderer;
use Piwik\Scheduler\Schedule\Schedule;
-use Piwik\SettingsPiwik;
use Piwik\Tracker;
use Piwik\View;
-use Zend_Mime;
-use Piwik\Config;
/**
*
@@ -71,7 +68,7 @@ class ScheduledReports extends \Piwik\Plugin
const OPTION_KEY_LAST_SENT_DATERANGE = 'report_last_sent_daterange_';
/**
- * @see Piwik\Plugin::registerEvents
+ * @see \Piwik\Plugin::registerEvents
*/
public function registerEvents()
{
@@ -305,90 +302,21 @@ class ScheduledReports extends \Piwik\Plugin
return;
}
- $periods = self::getPeriodToFrequencyAsAdjective();
- $subject = Piwik::translate('General_Report') . ' ' . $reportTitle . " - " . $prettyDate;
-
- $mail = new Mail();
- $mail->setDefaultFromPiwik();
- $mail->setSubject($subject);
- $attachmentName = $subject;
-
- $this->setReplyToAsSender($mail, $report);
-
- $displaySegmentInfo = false;
- $segmentInfo = null;
- $segment = API::getSegment($report['idsegment']);
- if ($segment != null) {
- $displaySegmentInfo = true;
- $segmentInfo = Piwik::translate('ScheduledReports_SegmentAppliedToReports', $segment['name']);
- }
+ $generatedReport = new GeneratedReport($report, $reportTitle, $prettyDate, $contents, $additionalFiles);
- $messageFindAttached = Piwik::translate('ScheduledReports_PleaseFindAttachedFile', array($periods[$report['period']], $reportTitle));
- $messageFindBelow = Piwik::translate('ScheduledReports_PleaseFindBelow', array($periods[$report['period']], $reportTitle));
- $messageSentFrom = '';
+ $reportFormat = $generatedReport->getReportFormat();
- $piwikUrl = SettingsPiwik::getPiwikUrl();
- if (!empty($piwikUrl)) {
- $messageSentFrom = Piwik::translate('ScheduledReports_SentFromX', $piwikUrl);
+ $customReplyTo = null;
+ if (Config::getInstance()->General['scheduled_reports_replyto_is_user_email_and_alias']
+ || !isset($reportDetails['login'])
+ ) {
+ $userModel = new UserModel();
+ $customReplyTo = $userModel->getUser($report['login']);
}
- switch ($report['format']) {
- case 'html':
-
- // Needed when using images as attachment with cid
- $mail->setType(Zend_Mime::MULTIPART_RELATED);
- $mail->setBodyHtml($contents);
- break;
-
- case 'csv':
- $message = "\n$messageFindAttached\n$messageSentFrom";
-
- if ($displaySegmentInfo) {
- $message .= " " . $segmentInfo;
- }
-
- $mail->setBodyText($message);
- $mail->createAttachment(
- $contents,
- 'application/csv',
- Zend_Mime::DISPOSITION_INLINE,
- Zend_Mime::ENCODING_BASE64,
- $attachmentName . '.csv'
- );
- break;
-
- default:
- case 'pdf':
- $message = "\n$messageFindAttached\n$messageSentFrom";
-
- if ($displaySegmentInfo) {
- $message .= " " . $segmentInfo;
- }
-
- $mail->setBodyText($message);
- $mail->createAttachment(
- $contents,
- 'application/pdf',
- Zend_Mime::DISPOSITION_INLINE,
- Zend_Mime::ENCODING_BASE64,
- $attachmentName . '.pdf'
- );
- break;
- }
-
- foreach ($additionalFiles as $additionalFile) {
- $fileContent = $additionalFile['content'];
- $at = $mail->createAttachment(
- $fileContent,
- $additionalFile['mimeType'],
- Zend_Mime::DISPOSITION_INLINE,
- $additionalFile['encoding'],
- $additionalFile['filename']
- );
- $at->id = $additionalFile['cid'];
-
- unset($fileContent);
- }
+ /** @var ReportEmailGenerator $reportGenerator */
+ $reportGenerator = StaticContainer::get(ReportEmailGenerator::class . '.' . $reportFormat);
+ $mail = $reportGenerator->makeEmail($generatedReport, $customReplyTo);
// Get user emails and languages
$reportParameters = $report['parameters'];
@@ -645,33 +573,6 @@ class ScheduledReports extends \Piwik\Plugin
);
}
- /**
- * Used in the Report's email content, ie "monthly report"
- * @ignore
- */
- public static function getPeriodToFrequencyAsAdjective()
- {
- return array(
- Schedule::PERIOD_DAY => Piwik::translate('General_DailyReport'),
- Schedule::PERIOD_WEEK => Piwik::translate('General_WeeklyReport'),
- Schedule::PERIOD_MONTH => Piwik::translate('General_MonthlyReport'),
- Schedule::PERIOD_YEAR => Piwik::translate('General_YearlyReport'),
- Schedule::PERIOD_RANGE => Piwik::translate('General_RangeReports'),
- );
- }
-
- protected function setReplyToAsSender(Mail $mail, array $report)
- {
- if (Config::getInstance()->General['scheduled_reports_replyto_is_user_email_and_alias']) {
- if (isset($report['login'])) {
- $userModel = new UserModel();
- $user = $userModel->getUser($report['login']);
-
- $mail->setReplyTo($user['email'], $user['alias']);
- }
- }
- }
-
private function reportAlreadySent($report, Period $period)
{
$key = self::OPTION_KEY_LAST_SENT_DATERANGE . $report['idreport'];
diff --git a/plugins/ScheduledReports/config/config.php b/plugins/ScheduledReports/config/config.php
new file mode 100644
index 0000000000..1c1680a7c4
--- /dev/null
+++ b/plugins/ScheduledReports/config/config.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator\AttachedFileReportEmailGenerator;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator\HtmlReportEmailGenerator;
+
+return [
+ ReportEmailGenerator::class . '.pdf' => DI\object(AttachedFileReportEmailGenerator::class)
+ ->constructorParameter('attachedFileExtension', '.pdf')
+ ->constructorParameter('attachedFileMimeType', 'application/pdf'),
+
+ ReportEmailGenerator::class . '.csv' => DI\object(AttachedFileReportEmailGenerator::class)
+ ->constructorParameter('attachedFileExtension', '.csv')
+ ->constructorParameter('attachedFileMimeType', 'application/csv'),
+
+ ReportEmailGenerator::class . '.html' => DI\object(HtmlReportEmailGenerator::class),
+];
diff --git a/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php
new file mode 100644
index 0000000000..2c89da4134
--- /dev/null
+++ b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports\tests\Integration\ReportEmailGenerator;
+
+
+use Piwik\Mail;
+use Piwik\Plugins\ScheduledReports\GeneratedReport;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator\AttachedFileReportEmailGenerator;
+use Piwik\Tests\Framework\Fixture;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+use Piwik\Plugins\SegmentEditor\API as APISegmentEditor;
+
+class AttachedFileReportEmailGeneratorTest extends IntegrationTestCase
+{
+ /**
+ * @var AttachedFileReportEmailGenerator
+ */
+ private $testInstance;
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $this->testInstance = new AttachedFileReportEmailGenerator('.thing', 'generic/thing');
+
+ Fixture::createWebsite('2011-01-01 00:00:00', $ecommerce = 0, 'sitename');
+ }
+
+ public function test_makeEmail_ReturnsCorrectlyConfiguredEmailInstance()
+ {
+ $reportDetails = [
+ 'format' => 'html',
+ 'period' => 'day',
+ 'idsite' => '1',
+ ];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ []
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport);
+ $mailContent = $this->getMailContent($mail);
+
+ $this->assertStringStartsWith('=0A<html', $mail->getBodyHtml()->getContent());
+ $this->assertEquals('General_Report report - pretty date', $mail->getSubject());
+ $this->assertContains('ScheduledReports_PleaseFindAttachedFile', $mailContent);
+ $this->assertContains('ScheduledReports_SentFromX', $mailContent);
+ $this->assertEquals('Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+Content-Disposition: inline
+', $mail->getBodyHtml()->getHeaders());
+
+ $parts = array_map(function (\Zend_Mime_Part $part) {
+ return [
+ 'content' => $part->getContent(),
+ 'headers' => $part->getHeaders(),
+ ];
+ }, $mail->getParts());
+ $this->assertEquals([
+ [
+ 'content' => 'cmVwb3J0IGNvbnRlbnRz',
+ 'headers' => 'Content-Type: generic/thing
+Content-Transfer-Encoding: base64
+Content-Disposition: inline; filename="General_Report report - pretty date.thing"
+',
+ ],
+ ], $parts);
+ }
+
+ public function test_makeEmail_OmitsSentFrom_IfPiwikUrlDoesNotExist()
+ {
+ $this->testInstance = new AttachedFileReportEmailGenerator('.thing', 'generic/thing', false);
+
+ $reportDetails = [
+ 'format' => 'html',
+ 'period' => 'week',
+ 'idsite' => '1',
+ ];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ []
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport);
+ $mailContent = $this->getMailContent($mail);
+
+ $this->assertStringStartsWith('=0A<html', $mailContent);
+ $this->assertContains('ScheduledReports_PleaseFindAttachedFile', $mailContent);
+ $this->assertEquals('Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+Content-Disposition: inline
+', $mail->getBodyHtml()->getHeaders());
+ }
+
+ public function test_makeEmail_AddsSegmentInformation_IfReportIsForSavedSegment()
+ {
+ $idsegment = APISegmentEditor::getInstance()->add('testsegment', 'browserCode==ff');
+
+ $reportDetails = [
+ 'format' => 'html',
+ 'period' => 'week',
+ 'idsite' => '1',
+ 'idsegment' => $idsegment,
+ ];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ []
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport);
+ $mailContent = $this->getMailContent($mail);
+
+ $this->assertStringStartsWith('=0A<html', $mailContent);
+ $this->assertContains("ScheduledReports_PleaseFindAttachedFile", $mailContent);
+ $this->assertContains('ScheduledReports_SentFromX=', $mailContent);
+ $this->assertContains('ScheduledReports_CustomVisitorSegment', $mailContent);
+ $this->assertEquals('Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+Content-Disposition: inline
+', $mail->getBodyHtml()->getHeaders());
+ }
+
+ private function getMailContent(Mail $mail)
+ {
+ return str_replace("=\n", '', $mail->getBodyHtml()->getContent());
+ }
+} \ No newline at end of file
diff --git a/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/HtmlReportEmailGeneratorTest.php b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/HtmlReportEmailGeneratorTest.php
new file mode 100644
index 0000000000..e0e8c0c9ae
--- /dev/null
+++ b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/HtmlReportEmailGeneratorTest.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ScheduledReports\tests\Integration\ReportEmailGenerator;
+
+use Piwik\Plugins\ScheduledReports\GeneratedReport;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator\HtmlReportEmailGenerator;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+use Zend_Mime;
+
+class HtmlReportEmailGeneratorTest extends IntegrationTestCase
+{
+ /**
+ * @var HtmlReportEmailGenerator
+ */
+ private $testInstance;
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->testInstance = new HtmlReportEmailGenerator();
+ }
+
+ public function test_makeEmail_ReturnsCorrectlyConfiguredEmailInstance()
+ {
+ $reportDetails = [
+ 'format' => 'html',
+ ];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ []
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport);
+
+ $this->assertEquals('General_Report report - pretty date', $mail->getSubject());
+ $this->assertEquals(Zend_Mime::MULTIPART_RELATED, $mail->getType());
+ $this->assertEquals('report contents', $mail->getBodyHtml()->getContent());
+ $this->assertEquals('Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+Content-Disposition: inline
+', $mail->getBodyHtml()->getHeaders());
+ }
+}
diff --git a/plugins/ScheduledReports/tests/Integration/ReportEmailGeneratorTest.php b/plugins/ScheduledReports/tests/Integration/ReportEmailGeneratorTest.php
new file mode 100644
index 0000000000..9b07e574ca
--- /dev/null
+++ b/plugins/ScheduledReports/tests/Integration/ReportEmailGeneratorTest.php
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Copyright (C) InnoCraft Ltd - All rights reserved.
+ *
+ * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.
+ * The intellectual and technical concepts contained herein are protected by trade secret or copyright law.
+ * Redistribution of this information or reproduction of this material is strictly forbidden
+ * unless prior written permission is obtained from InnoCraft Ltd.
+ *
+ * You shall use this code only in accordance with the license agreement obtained from InnoCraft Ltd.
+ *
+ * @link https://www.innocraft.com/
+ * @license For license details see https://www.innocraft.com/license
+ */
+
+namespace Piwik\Plugins\ScheduledReports\tests\Integration;
+
+use Piwik\Mail;
+use Piwik\Plugins\ScheduledReports\GeneratedReport;
+use Piwik\Plugins\ScheduledReports\ReportEmailGenerator;
+use Piwik\Tests\Framework\TestCase\IntegrationTestCase;
+
+class TestReportEmailGenerator extends ReportEmailGenerator
+{
+ protected function configureEmail(Mail $mail, GeneratedReport $report)
+ {
+ // empty
+ }
+}
+
+
+class ReportEmailGeneratorTest extends IntegrationTestCase
+{
+ /**
+ * @var TestReportEmailGenerator
+ */
+ private $testInstance;
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $this->testInstance = new TestReportEmailGenerator();
+ }
+
+ public function test_makeEmail_CreatesCorrectlyConfiguredMailInstance()
+ {
+ $reportDetails = [];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ [
+ [
+ 'mimeType' => 'mimetype1',
+ 'encoding' => 'utf-8',
+ 'content' => 'content 1',
+ 'filename' => 'file1.txt',
+ 'cid' => 'cid1',
+ ],
+ [
+ 'mimeType' => 'mimetype2',
+ 'encoding' => 'utf-8',
+ 'content' => 'content 2',
+ 'filename' => 'file2.txt',
+ 'cid' => 'cid2',
+ ],
+ ]
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport);
+
+ $this->assertEquals('General_Report report - pretty date', $mail->getSubject());
+
+ $parts = array_map(function (\Zend_Mime_Part $part) {
+ return [
+ 'content' => $part->getContent(),
+ 'headers' => $part->getHeaders(),
+ ];
+ }, $mail->getParts());
+ $this->assertEquals([
+ [
+ 'content' => 'content 1',
+ 'headers' => 'Content-Type: mimetype1
+Content-Transfer-Encoding: utf-8
+Content-ID: <cid1>
+Content-Disposition: inline; filename="file1.txt"
+',
+ ],
+ [
+ 'content' => 'content 2',
+ 'headers' => 'Content-Type: mimetype2
+Content-Transfer-Encoding: utf-8
+Content-ID: <cid2>
+Content-Disposition: inline; filename="file2.txt"
+',
+ ],
+ ], $parts);
+ }
+
+ public function test_makeEmail_UsesCustomReplyTo_IfSupplied()
+ {
+ $reportDetails = [];
+
+ $generatedReport = new GeneratedReport(
+ $reportDetails,
+ 'report',
+ 'pretty date',
+ 'report contents',
+ []
+ );
+
+ $mail = $this->testInstance->makeEmail($generatedReport, [
+ 'email' => 'test@testytesterson.com',
+ 'alias' => 'test person',
+ ]);
+
+ $this->assertEquals('General_Report report - pretty date', $mail->getSubject());
+ $this->assertEquals('test@testytesterson.com', $mail->getReplyTo());
+ $this->assertEquals([
+ 'From' => [
+ 0 => 'ScheduledReports_PiwikReports <noreply@localhost>',
+ 'append' => true,
+ ],
+ 'Subject' => [
+ 0 => 'General_Report report - pretty date',
+ ],
+ 'Reply-To' => [
+ 0 => 'test person <test@testytesterson.com>',
+ 'append' => true,
+ ],
+ ], $mail->getHeaders());
+ $this->assertEquals([], $mail->getParts());
+ }
+}
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html
index f9b00e6273..bc0c63f737 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Site 1.
- <br />Mail Test report
+ Please find below your day report for Site 1.
+ <br />Mail Test report
<br />Date range: January 2010
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html
index 5135698bdc..b3907eca2f 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Site 1.
- <br />Mail Test report
+ Please find below your day report for Site 1.
+ <br />Mail Test report
<br />Date range: January 2010
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>
diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
index d503e5ebd0..ad317c6dd0 100644
--- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
+++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Site 1.
- <br />Mail Test report
+ Please find below your day report for Site 1.
+ <br />Mail Test report
<br />Date range: January 2010
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html
index 3cc46fd0ad..4302aed3be 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Piwik test.
- <br />Mail Test report
+ Please find below your day report for Piwik test.
+ <br />Mail Test report
<br />Date range: week April 4 – 10, 2011
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html
index a6c31c80a0..8a6c167ef7 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Piwik test.
- <br />Mail Test report
+ Please find below your day report for Piwik test.
+ <br />Mail Test report
<br />Date range: week April 4 – 10, 2011
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>
diff --git a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
index 0a0b0ba34f..552ff56ce2 100644
--- a/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
+++ b/tests/PHPUnit/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html
@@ -32,8 +32,8 @@
</h2>
<p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, &#039;Segoe UI&#039;, Roboto, Oxygen-Sans, Cantarell, &#039;Helvetica Neue&#039;, sans-serif; '>
- Please find below your day report for Piwik test.
- <br />Mail Test report
+ Please find below your day report for Piwik test.
+ <br />Mail Test report
<br />Date range: week April 4 – 10, 2011
<br />Sent from http://example.com/piwik/tests/PHPUnit/proxy/.
</p>