diff --git a/build.xml b/build.xml index 4d4be7f17..af197c585 100644 --- a/build.xml +++ b/build.xml @@ -16,7 +16,7 @@ - + diff --git a/out/out.Search.php b/out/out.Search.php index 6d0b03e46..17d3c379d 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -356,10 +356,12 @@ if($fullsearch) { $totalPages = 0; $entries = array(); $facets = array(); + $stats = array(); $searchTime = 0; } else { $entries = array(); $facets = $searchresult['facets']; + $stats = $searchresult['stats'] ?? null; $dcount = 0; $fcount = 0; if($searchresult['hits']) { @@ -406,6 +408,7 @@ if($fullsearch) { $totalPages = 0; $entries = array(); $facets = array(); + $stats = array(); $searchTime = 0; } } @@ -717,6 +720,7 @@ if($fullsearch) { } else $totalPages = 1; $facets = array(); + $stats = array(); // }}} } @@ -737,6 +741,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) { $accessop = new SeedDMS_AccessOperation($dms, $user, $settings); if($view) { $view->setParam('facets', $facets); + $view->setParam('stats', $stats); $view->setParam('accessobject', $accessop); $view->setParam('query', $query); $view->setParam('includecontent', $includecontent); diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 47508e2b5..191006ccb 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -396,6 +396,7 @@ $(document).ready(function() { $orderby = $this->params['orderby']; $entries = $this->params['searchhits']; $facets = $this->params['facets']; + $stats = $this->params['stats']; $totalpages = $this->params['totalpages']; $pageNumber = $this->params['pagenumber']; $searchTime = $this->params['searchtime']; @@ -1240,14 +1241,14 @@ $(document).ready(function() { case SeedDMS_Core_AttributeDefinition::type_date: if($values && (count($values) > 1 || reset($values) < $total)) { if(empty($allparams['attributes'][$facetname]['from']) && empty($allparams['attributes'][$facetname]['to'])) { - $tt = array_keys($values); + $tt = isset($stats[$facetname]) ? $stats[$facetname] : [];//array_keys($values); $content = ''; $content .= '

'.getMLText('objects_without_attribute').'

'; $content .= '
'; $content .= ' from '; - $content .= $this->getDateChooser('', "attributes[".$facetname."][from]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(max($tt)), null, '', true); + $content .= $this->getDateChooser('', "attributes[".$facetname."][from]", $this->params['session']->getLanguage(), '', $tt ? getReadableDate($tt['min']) : null, $tt ? getReadableDate($tt['max']) : null, null, '', true); $content .= ' to '; - $content .= $this->getDateChooser('', "attributes[".$facetname."][to]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(max($tt)), null, '', true); + $content .= $this->getDateChooser('', "attributes[".$facetname."][to]", $this->params['session']->getLanguage(), '', $tt ? getReadableDate($tt['min']) : null, $tt ? getReadableDate($tt['max']) : null, null, '', true); $content .= ''; $content .= '
'; $this->printAccordion($dispname, $content);