Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Set empty date to null #263

Open
wants to merge 1 commit into
base: 6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Comment on lines +664 to +665
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would it be false? You updated the return values of getReviewDate() to not return false.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember. Looking at that method it still has return $page->obj('NextReviewDate'); so presumbably that was returning false in some circumstances

} else {
$this->owner->NextReviewDate = $nextDate;
}
Expand Down