From 150f68e382d23536183969a0f020c570ea83f893 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 30 Aug 2012 16:05:56 +0200 Subject: [PATCH] BUG Set raw date value for embargo/expiry to avoid DateField bugs The object property is expected to be a scalar, but the logic sets it to a DBField instance. While DataObject handles this fine, the DatetimeField logic fails and simply writes the string classname into the field. Should be fixed in DatetimeField eventually, but easier handled here for now. --- code/DMSDocument.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/DMSDocument.php b/code/DMSDocument.php index e5bcd35..ef4b5c0 100644 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -311,7 +311,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { * @return null */ function embargoUntilDate($datetime, $write = true) { - $this->EmbargoedUntilDate = DBField::create_field('SS_Datetime', $datetime);; + $this->EmbargoedUntilDate = DBField::create_field('SS_Datetime', $datetime)->Format('Y-m-d H:i:s'); if ($write) $this->write(); } @@ -345,7 +345,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { * @return null */ function expireAtDate($datetime, $write = true) { - $this->ExpireAtDate = DBField::create_field('SS_Datetime', $datetime); + $this->ExpireAtDate = DBField::create_field('SS_Datetime', $datetime)->Format('Y-m-d H:i:s'); if ($write) $this->write(); }