Skip to content

Commit

Permalink
FIX Set empty date to null
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 25, 2024
1 parent cd1b9ed commit 8622bbe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Extensions/SiteTreeContentReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function updateCMSActions(FieldList $actions)
*
* @param SiteTree $page
*
* @return bool|DBDate
* @return null|DBDate
*/
public function getReviewDate(SiteTree $page = null)
{
Expand All @@ -209,11 +209,11 @@ public function getReviewDate(SiteTree $page = null)
$options = $this->owner->getOptions();

if (!$options) {
return false;
return null;
}

if (!$options->ReviewPeriodDays) {
return false;
return null;
}

// Failover to check on ReviewPeriodDays + LastEdited
Expand Down Expand Up @@ -508,7 +508,6 @@ public function advanceReviewDate()
' + ' . $options->ReviewPeriodDays . ' days',
DBDatetime::now()->getTimestamp()
);

$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format(DBDate::ISO_DATE);
$this->owner->write();
}
Expand Down Expand Up @@ -662,6 +661,8 @@ protected function setDefaultReviewDateForInherited()

if (is_object($nextDate)) {
$this->owner->NextReviewDate = $nextDate->getValue();
} elseif ($nextDate === false) {
$this->owner->NextReviewDate = null;
} else {
$this->owner->NextReviewDate = $nextDate;
}
Expand Down

0 comments on commit 8622bbe

Please sign in to comment.