mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
Merge pull request #149 from dhensby/pull/135
Clear non-recurring custom date when reviewing
This commit is contained in:
commit
fa031262fb
@ -495,6 +495,11 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
$this->owner->write();
|
||||
}
|
||||
|
||||
if ($options && $options->ReviewPeriodDays == 0) {
|
||||
$this->owner->NextReviewDate = null;
|
||||
$this->owner->write();
|
||||
}
|
||||
|
||||
return (bool)$nextDateTimestamp;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ use SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings;
|
||||
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
|
||||
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
|
||||
use SilverStripe\Forms\LiteralField;
|
||||
use SilverStripe\ORM\FieldType\DBDate;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\Member;
|
||||
@ -123,6 +124,20 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
|
||||
$this->assertEquals(null, $page->NextReviewDate);
|
||||
}
|
||||
|
||||
public function testAdvanceReviewDate()
|
||||
{
|
||||
$page = new Page();
|
||||
$page->Title = 'Test page';
|
||||
$page->ReviewPeriodDays = 0;
|
||||
// Set timestamp to a time in the past
|
||||
$timestamp = DBDatetime::now()->getTimestamp() - 100000;
|
||||
$page->NextReviewDate = DBDate::create()->setValue($timestamp)->Format(DBDate::ISO_DATE);
|
||||
$page->write();
|
||||
$page->advanceReviewDate();
|
||||
$this->assertNull(Page::get()->find('Title', 'Test page')->NextReviewDate);
|
||||
}
|
||||
|
||||
|
||||
public function testAddReviewNote()
|
||||
{
|
||||
/** @var Member $author */
|
||||
|
Loading…
Reference in New Issue
Block a user