diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index 9d6ed37f24e9e0ed2c6b582925f42b9f521c9d80..316cb18a6967e51e8b874bc1ad61262490158729 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -341,7 +341,21 @@ class SearchController extends AbstractSearch $range = $this->params()->fromQuery('range'); $dept = $this->params()->fromQuery('department'); + // Validate the range parameter -- it should not exceed the greatest + // configured value: $searchSettings = $this->getConfig('searches'); + $maxAge = 0; + if (isset($searchSettings->NewItem->ranges)) { + $tmp = explode(',', $searchSettings->NewItem->ranges); + foreach ($tmp as $current) { + if (intval($current) > $maxAge) { + $maxAge = intval($current); + } + } + } + if ($maxAge > 0 && $range > $maxAge) { + $range = $maxAge; + } // The code always pulls in enough catalog results to get a fixed number // of pages worth of Solr results. Note that if the Solr index is out of diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php index a4b70a9dc1d34320ad2ec54b0b07fd33daef6ccb..41f1153df33b269c966ccc8d9e6d89d062ee7f54 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php @@ -27,7 +27,7 @@ * @link http://vufind.org/wiki/vufind2:building_an_ils_driver Wiki */ namespace VuFind\ILS\Driver; -use File_MARC, PDO, PDOException, VuFind\Config\Reader as ConfigReader, +use File_MARC, PDO, PDOException, VuFind\Exception\Date as DateException, VuFind\Exception\ILS as ILSException, VuFind\I18n\Translator\TranslatorAwareInterface, @@ -1551,22 +1551,6 @@ class Voyager extends AbstractBase implements TranslatorAwareInterface { $items = array(); - // Prevent unnecessary load on Voyager -- no point in exceeding the maximum - // configured date range. - $maxAge = 30; - $searchSettings = ConfigReader::getConfig('searches'); - if (isset($searchSettings->NewItem->ranges)) { - $tmp = explode(',', $searchSettings->NewItem->ranges); - foreach ($tmp as $current) { - if (intval($current) > $maxAge) { - $maxAge = intval($current); - } - } - } - if ($daysOld > $maxAge) { - $daysOld = $maxAge; - } - $bindParams = array( ':enddate' => date('d-m-Y', strtotime('now')), ':startdate' => date('d-m-Y', strtotime("-$daysOld day"))