diff --git a/CHANGELOG b/CHANGELOG index e74a5d206..54d5c8c79 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 diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 17c9ca50e..fd263a91c 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -2542,9 +2542,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()); diff --git a/out/out.Timeline.php b/out/out.Timeline.php index ceef8d540..221726fd7 100644 --- a/out/out.Timeline.php +++ b/out/out.Timeline.php @@ -35,17 +35,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 diff --git a/views/bootstrap/class.Timeline.php b/views/bootstrap/class.Timeline.php index 68e634b18..940b6f354 100644 --- a/views/bootstrap/class.Timeline.php +++ b/views/bootstrap/class.Timeline.php @@ -82,28 +82,28 @@ 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; } - $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 $i=>$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 = '???'; + } + $data[$i]['msg'] = $msg; } - $item['msg'] = $msg; } $jsondata = array(); @@ -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) {