mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
FIX Set empty date to null
This commit is contained in:
parent
cd1b9ed9f2
commit
3ed6eb0971
@ -194,7 +194,7 @@ class SiteTreeContentReview extends Extension implements PermissionProvider
|
||||
*
|
||||
* @param SiteTree $page
|
||||
*
|
||||
* @return bool|DBDate
|
||||
* @return null|DBDate
|
||||
*/
|
||||
public function getReviewDate(SiteTree $page = null)
|
||||
{
|
||||
@ -209,11 +209,11 @@ class SiteTreeContentReview extends Extension implements PermissionProvider
|
||||
$options = $this->owner->getOptions();
|
||||
|
||||
if (!$options) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$options->ReviewPeriodDays) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Failover to check on ReviewPeriodDays + LastEdited
|
||||
@ -509,6 +509,9 @@ class SiteTreeContentReview extends Extension implements PermissionProvider
|
||||
DBDatetime::now()->getTimestamp()
|
||||
);
|
||||
|
||||
$x=DBDate::create()->setValue($nextDateTimestamp)->Format(DBDate::ISO_DATE);
|
||||
;
|
||||
|
||||
$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format(DBDate::ISO_DATE);
|
||||
$this->owner->write();
|
||||
}
|
||||
@ -662,6 +665,8 @@ class SiteTreeContentReview extends Extension implements PermissionProvider
|
||||
|
||||
if (is_object($nextDate)) {
|
||||
$this->owner->NextReviewDate = $nextDate->getValue();
|
||||
} elseif ($nextDate === false) {
|
||||
$this->owner->NextReviewDate = null;
|
||||
} else {
|
||||
$this->owner->NextReviewDate = $nextDate;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user