From 3f82cb1957debdec0fc4b4644ff97506372ba87a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2015 15:47:46 +0200 Subject: [PATCH] do not add item to timeline if date is empty --- SeedDMS_Core/Core/inc.ClassDocument.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index de97314ee..993f22b8c 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -2129,9 +2129,15 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ if (is_bool($resArr) && !$resArr) return false; + /* The above query will also contain entries where a document status exists + * but no status log entry. Those records will have no date and must be + * skipped. + */ foreach ($resArr as $row) { - $date = $row['date']; - $timeline[] = array('date'=>$date, 'msg'=>'Version '.$row['version'].': Status change to '.$row['status'], 'type'=>'status_change', 'version'=>$row['version'], 'document'=>$this, 'status'=>$row['status'], 'params'=>array($row['version'], $row['status'])); + if($row['date']) { + $date = $row['date']; + $timeline[] = array('date'=>$date, 'msg'=>'Version '.$row['version'].': Status change to '.$row['status'], 'type'=>'status_change', 'version'=>$row['version'], 'document'=>$this, 'status'=>$row['status'], 'params'=>array($row['version'], $row['status'])); + } } return $timeline; } /* }}} */ @@ -4415,7 +4421,7 @@ class SeedDMS_Core_AddContentResultSet { /* {{{ */ if (!is_integer($status)) { return false; } - if ($status<-3 || $status>2) { + if ($status<-3 || $status>3) { return false; } $this->_status = $status;