diff --git a/code/extensions/ContentReviewDefaultSettings.php b/code/extensions/ContentReviewDefaultSettings.php index 3eba067..936fa55 100644 --- a/code/extensions/ContentReviewDefaultSettings.php +++ b/code/extensions/ContentReviewDefaultSettings.php @@ -34,8 +34,8 @@ class ContentReviewDefaultSettings extends DataExtension private static $defaults = array( 'ReviewSubjectReminder' => 'Page(s) are approaching content review date', 'ReviewSubject' => 'Page(s) are due for content review', - 'ReviewBodyFirstReminder' => '

Page(s) 1 month from review

There are $PagesCount pages that are due for review by you 1 month from today.

', - 'ReviewBodySecondReminder' => '

Page(s) 1 week from from review

There are $PagesCount pages that are due for review by you 1 week from today.

', + 'ReviewBodyFirstReminder' => '

Page(s) 1 month from review

There are $FirstReminderPagesCount pages that are due for review by you 1 month from today.

', + 'ReviewBodySecondReminder' => '

Page(s) 1 week from from review

There are $SecondReminderPagesCount pages that are due for review by you 1 week from today.

', 'ReviewBody' => '

Page(s) due for review

There are $PagesCount pages that are due for review today by you.

', 'ReviewReminderEmail' => 'govt.nz@dia.govt.nz', 'FirstReviewDaysBefore' => '30', @@ -125,19 +125,6 @@ class ContentReviewDefaultSettings extends DataExtension $fields->addFieldToTab('Root.ContentReview', $reviewFrequency); - $FirstReviewDaysBefore = NumericField::create( - 'FirstReviewDaysBefore', - _t('ContentReview.FIRSTREVIEWDAYSBEFORE', 'First review reminder # days before final review') - ); - - $fields->addFieldToTab('Root.ContentReview', $FirstReviewDaysBefore); - - $SecondReviewDaysBefore = NumericField::create( - 'SecondReviewDaysBefore', - _t('ContentReview.SECONDREVIEWDAYSBEFORE', 'Second review reminder # days before final review') - ); - - $fields->addFieldToTab('Root.ContentReview', $SecondReviewDaysBefore); $users = Permission::get_members_by_permission(array( 'CMS_ACCESS_CMSMain', @@ -170,12 +157,24 @@ class ContentReviewDefaultSettings extends DataExtension $fields->addFieldToTab('Root.ContentReview', $groupField); + $FirstReviewDaysBefore = NumericField::create( + 'FirstReviewDaysBefore', + _t('ContentReview.FIRSTREVIEWDAYSBEFORE', 'First review reminder # days before final review') + ); + + $SecondReviewDaysBefore = NumericField::create( + 'SecondReviewDaysBefore', + _t('ContentReview.SECONDREVIEWDAYSBEFORE', 'Second review reminder # days before final review') + ); + // Email content $fields->addFieldsToTab( 'Root.ContentReview', array( TextField::create('ReviewFrom', _t('ContentReview.EMAILFROM', 'From email address')) ->setRightTitle(_t('Review.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')), + $FirstReviewDaysBefore, + $SecondReviewDaysBefore, TextField::create('ReviewReminderEmail','Review reminder email address') ->setRightTitle('e.g: review.reminders@site.com'), TextField::create('ReviewSubjectReminder', _t('ContentReview.EMAILSUBJECTREMINDER', 'Subject line - reminder')), diff --git a/code/tasks/ContentReviewEmails.php b/code/tasks/ContentReviewEmails.php index 0e38872..775bdde 100644 --- a/code/tasks/ContentReviewEmails.php +++ b/code/tasks/ContentReviewEmails.php @@ -46,26 +46,6 @@ class ContentReviewEmails extends BuildTask } } - - - - -Debug::show('====================================================================FIRST REMINDER'); - foreach ($firstReminderPages as $p) { - Debug::show($p->Title); - } -Debug::show('====================================================================SECOND REMINDER'); - foreach ($secondReminderPages as $p) { - Debug::show($p->Title); - } -Debug::show('====================================================================DUE/OVERDUE'); - foreach ($pages as $p) { - Debug::show($p->Title); - } - //die(); - - - $overduePages = $this->getNotifiablePagesForOwners($pages); // Send one email to one owner with all the pages in there instead of no of pages of emails. @@ -109,6 +89,12 @@ Debug::show('=================================================================== return $overduePages; } + /** + * Send an email to the configured team indicating which notices are at 'first reminder' or 'second reminder' status + * The 'days before due' value for each of these is configurable in settings. + * ie. a value of 30 for the 'first reminder' setting means a page with a review date exactly 30 days from due, will + * be present in the email sent to the configured address. + */ protected function notifyTeam($firstReminderPages, $secondReminderPages) { // Prepare variables $siteConfig = SiteConfig::current_site_config(); @@ -117,15 +103,12 @@ Debug::show('=================================================================== // Build email $email = new Email(); - $email->setTo($siteConfig->Email); + $email->setTo($siteConfig->ReviewReminderEmail); $email->setFrom($siteConfig->ReviewFrom); - $subject = $siteConfig->ReviewSubject; + $subject = $siteConfig->ReviewSubjectReminder; $email->setSubject($subject); - - - // Get user-editable body $bodyFirstReminder = $this->getEmailBody($siteConfig, $templateVariables1, 'reminder1'); $bodySecondReminder = $this->getEmailBody($siteConfig, $templateVariables2, 'reminder2'); @@ -136,16 +119,11 @@ Debug::show('=================================================================== $email->populateTemplate(array( 'EmailBodyFirstReminder' => $bodyFirstReminder, 'EmailBodySecondReminder' => $bodySecondReminder, - 'Recipient' => $siteConfig->ReviewReminderEmail, 'FirstReminderPages' => $firstReminderPages, 'SecondReminderPages' => $secondReminderPages, )); - Debug::show($email); - //$email->send(); - - - + $email->send(); } /** @@ -180,8 +158,7 @@ Debug::show('=================================================================== 'Pages' => $pages, )); - Debug::show($email); - //$email->send(); + $email->send(); } /** diff --git a/readme.md b/readme.md index a797eda..2f9ac9e 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,20 @@ [![License](http://img.shields.io/packagist/l/silverstripe/contentreview.svg?style=flat-square)](license.md) ![helpfulrobot](https://helpfulrobot.io/silverstripe/contentreview/badge) +**Note:** _Govt.nz customisations to this module are as follows_ + +Prior to the due date, the content review task will send an email to the address configured in the settings. + +This email contains two lists: +- a list of pages whose review date is exactly 1 month in the future. +- another list of pages whose review date is exactly 1 week in the future. + +Both these times (1 month and 1 week) are defaults only, and can be configured in the settings area. + +The email body for these reminder emails is also configurable in the settings. + +--- + This module helps keep your website content accurate and up-to-date, which keeps your users happy. It does so by sending reviewers reminder emails to go in and check the content. For a reviewer this diff --git a/templates/ContentReviewAdminHelp.ss b/templates/ContentReviewAdminHelp.ss index 243a541..5682ac8 100644 --- a/templates/ContentReviewAdminHelp.ss +++ b/templates/ContentReviewAdminHelp.ss @@ -1,10 +1,22 @@ -

This is a list of dynamic variables that you can use in the email templates.

+

This is a list of dynamic variables that you can use in the First and Second reminder email templates.

+ +
+ +

This is a list of dynamic variables that you can use in the Due email template.

+ +