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 15, 2024
1 parent cd1b9ed commit 3ed6eb0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 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 @@ -509,6 +509,9 @@ public function advanceReviewDate()
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();
}
Expand Down Expand Up @@ -662,6 +665,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 3ed6eb0

Please sign in to comment.