FIX Set empty date to null

This commit is contained in:
Steve Boyd 2024-10-15 14:19:44 +13:00
parent cd1b9ed9f2
commit 3ed6eb0971

View File

@ -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;
}