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.
This commit is contained in:
Ingo Schommer 2012-08-30 16:05:56 +02:00
parent 900f1d144a
commit 150f68e382

View File

@ -311,7 +311,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
* @return null * @return null
*/ */
function embargoUntilDate($datetime, $write = true) { 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(); if ($write) $this->write();
} }
@ -345,7 +345,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
* @return null * @return null
*/ */
function expireAtDate($datetime, $write = true) { 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(); if ($write) $this->write();
} }