From 1532ba3b823bab9863334c114ff7a143fdcc4847 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 19 Nov 2015 06:43:02 +0100 Subject: [PATCH 1/5] getTimeLine() returns only false if db query fails --- SeedDMS_Core/Core/inc.ClassDMS.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index f5470c4a9..d091296d5 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2246,9 +2246,8 @@ class SeedDMS_Core_DMS { $queryStr = "SELECT document FROM tblDocumentContent WHERE date > ".$startts." AND date < ".$endts; $resArr = $this->db->getResultArray($queryStr); - if (!$resArr) + if ($resArr === false) return false; - $resArr = $this->db->getResultArray($queryStr); foreach($resArr as $rec) { $document = $this->getDocument($rec['document']); $timeline = array_merge($timeline, $document->getTimeline()); From f5bf3266058719f6b0ac5fef5eb4f7e49cb1f74d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 19 Nov 2015 06:43:36 +0100 Subject: [PATCH 2/5] check if getTimeLine() returns data --- views/bootstrap/class.Timeline.php | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/views/bootstrap/class.Timeline.php b/views/bootstrap/class.Timeline.php index 68e634b18..4222365a2 100644 --- a/views/bootstrap/class.Timeline.php +++ b/views/bootstrap/class.Timeline.php @@ -87,23 +87,23 @@ class SeedDMS_View_Timeline extends SeedDMS_Bootstrap_Style { $to = time()-7*86400; } - $data = $dms->getTimeline($from, $to); - - foreach($data as &$item) { - switch($item['type']) { - case 'add_version': - $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'])); - break; - case 'add_file': - $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()))); - break; - case 'status_change': - $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'], 'status'=> getOverallStatusText($item['status']))); - break; - default: - $msg = '???'; + if($data = $dms->getTimeline($from, $to)) { + foreach($data as &$item) { + switch($item['type']) { + case 'add_version': + $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'])); + break; + case 'add_file': + $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()))); + break; + case 'status_change': + $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'], 'status'=> getOverallStatusText($item['status']))); + break; + default: + $msg = '???'; + } + $item['msg'] = $msg; } - $item['msg'] = $msg; } $jsondata = array(); From 2f15d75508289584e30272cc56897c3bb2ee6cef Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 19 Nov 2015 07:16:46 +0100 Subject: [PATCH 3/5] set end date to end of day if day is set --- views/bootstrap/class.Timeline.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/views/bootstrap/class.Timeline.php b/views/bootstrap/class.Timeline.php index 4222365a2..940b6f354 100644 --- a/views/bootstrap/class.Timeline.php +++ b/views/bootstrap/class.Timeline.php @@ -82,13 +82,13 @@ class SeedDMS_View_Timeline extends SeedDMS_Bootstrap_Style { } if($todate) { - $to = makeTsFromLongDate($todate.' 00:00:00'); + $to = makeTsFromLongDate($todate.' 23:59:59'); } else { $to = time()-7*86400; } if($data = $dms->getTimeline($from, $to)) { - foreach($data as &$item) { + foreach($data as $i=>$item) { switch($item['type']) { case 'add_version': $msg = getMLText('timeline_full_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'])); @@ -102,7 +102,7 @@ class SeedDMS_View_Timeline extends SeedDMS_Bootstrap_Style { default: $msg = '???'; } - $item['msg'] = $msg; + $data[$i]['msg'] = $msg; } } @@ -144,7 +144,7 @@ class SeedDMS_View_Timeline extends SeedDMS_Bootstrap_Style { } if($todate) { - $to = makeTsFromLongDate($todate.' 00:00:00'); + $to = makeTsFromLongDate($todate.' 23:59:59'); } else { $to = time(); } @@ -206,7 +206,6 @@ echo "
\n"; $(document).ready(function () { $('#update').click(function(ev){ ev.preventDefault(); - console.log($('#form1').serialize()); $.getJSON( 'out.Timeline.php?action=data&' + $('#form1').serialize(), function(data) { From 485d17b775337680414d439fdce9f9b96966f60e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 19 Nov 2015 07:17:21 +0100 Subject: [PATCH 4/5] remove old code --- out/out.Timeline.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/out/out.Timeline.php b/out/out.Timeline.php index 6eab82918..5ef48a368 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -33,17 +33,6 @@ if (!$user->isAdmin()) { } $rootfolder = $dms->getFolder($settings->_rootFolderID); -if(!empty($_GET['fromdate'])) { - $from = makeTsFromLongDate($_GET['fromdate'].' 00:00:00'); -} else { - $from = time()-7*86400; -} -if(!empty($_GET['todate'])) { - $to = makeTsFromLongDate($_GET['todate'].' 23:59:59'); -} else { - $to = time(); -} - if(isset($_GET['skip'])) $skip = $_GET['skip']; else From 7d7a1d76b2e7f41dd1acaa4e10dd7f2378d507a4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 19 Nov 2015 07:21:46 +0100 Subject: [PATCH 5/5] add more entry for 4.3.22 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index d11bffb63..8f8d56df1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ - fix lots of HTTP-Headers in op.Ajax.php (Closes: #233) - Timeline will be updated by ajax call, clicking on an item in the timeline will output some document information +- Timeline now ends at end of the last day. Previously this day wasn't included - new attribute type 'date' - all dates are now in format 'yyyy-mm-dd' - fix fatal error when requesting new password