From 3ed6eb09711561c9669747f5db042c39d8b054cf Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 15 Oct 2024 14:19:44 +1300 Subject: [PATCH] FIX Set empty date to null --- src/Extensions/SiteTreeContentReview.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Extensions/SiteTreeContentReview.php b/src/Extensions/SiteTreeContentReview.php index 81cb82f..21310c9 100644 --- a/src/Extensions/SiteTreeContentReview.php +++ b/src/Extensions/SiteTreeContentReview.php @@ -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; }