From 3c1387319534ef2eefccfc41e47a011d4dd0f261 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2015 15:00:47 +0200 Subject: [PATCH 1/3] fix syntax error --- out/out.Timeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/out/out.Timeline.php b/out/out.Timeline.php index 536ebb643..e7ce12ef0 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -39,7 +39,7 @@ if(!empty($_GET['todate'])) { $to = time(); } -if(isset($_GET['skip'])) { +if(isset($_GET['skip'])) $skip = $_GET['skip']; else $skip = array(); From 3f82cb1957debdec0fc4b4644ff97506372ba87a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2015 15:47:46 +0200 Subject: [PATCH 2/3] 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; From 659f788de4d80f2d25901fa7f129b0d1196fabb2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 23 Sep 2015 15:50:04 +0200 Subject: [PATCH 3/3] do not show subheader of timeline if empty --- views/bootstrap/class.ViewDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index d9e6173cd..8a2ae362a 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -1113,9 +1113,9 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { isAdmin()) { - $this->contentHeading(getMLText("timeline")); $timeline = $document->getTimeline(); if($timeline) { + $this->contentHeading(getMLText("timeline")); foreach($timeline as &$item) { switch($item['type']) { case 'add_version':