diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 2056aa7e94a1e7ee88733d75b234a80e10ad3bdb..71e90cfad7f77ba241800fea262e8bfb34545faf 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -27,6 +27,26 @@ $config = array( 'action' => 'Show', ) ) + ), + 'legacy-summonrecord' => array( + 'type' => 'Zend\Mvc\Router\Http\Literal', + 'options' => array( + 'route' => '/Summon/Record', + 'defaults' => array( + 'controller' => 'SummonRecord', + 'action' => 'Home', + ) + ) + ), + 'legacy-worldcatrecord' => array( + 'type' => 'Zend\Mvc\Router\Http\Literal', + 'options' => array( + 'route' => '/WorldCat/Record', + 'defaults' => array( + 'controller' => 'WorldcatRecord', + 'action' => 'Home', + ) + ) ) ), ), diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index 37fb635920200732e631d52c7e0e977537cf98fe..f37395f8f786ba15d6bdad36b9c145e75c7302d7 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -477,11 +477,14 @@ class AbstractRecord extends AbstractBase */ protected function loadRecord() { - // Only load the record if it has not already been loaded: + // Only load the record if it has not already been loaded. Note that + // when determining record ID, we check both the route match (the most + // common scenario) and the GET parameters (a fallback used by some + // legacy routes). if (!is_object($this->driver)) { $this->driver = call_user_func( array($this->searchObject, 'getRecord'), - $this->params()->fromRoute('id') + $this->params()->fromRoute('id', $this->params()->fromQuery('id')) ); } return $this->driver; diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index 2e039836b2bf1589f1d2ba2c37958b0a7d5a141f..46755025b995765c316907f13e67544ce854e8ed 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -96,29 +96,6 @@ class SummonController extends AbstractSearch return $this->resultsAction(); } - /** - * Forward unrecognized actions to record controller for legacy URL - * compatibility. - * - * @param string $method Method name being called. - * @param array $params Parameters passed to method. - * - * @return void - */ - public function __call($method, $params) - { - if (substr($method, -6) == 'Action') { - $action = substr($method, 0, strlen($method) - 6); - // Special case for default record action: - if ($action == 'record') { - $action = 'home'; - } - return $this->forward() - ->dispatch('SummonRecord', array('action' => $action)); - } - return parent::__call($method, $params); - } - /** * Return a Search Results object containing advanced facet information. This * data may come from the cache, and it is currently shared between the Home diff --git a/module/VuFind/src/VuFind/Controller/WorldcatController.php b/module/VuFind/src/VuFind/Controller/WorldcatController.php index 487a6f4d7f199fbb0b4f92ee473569a3170ad1e2..4f7a1be0f08e867bb46d0fdbde957e4efe46a7a0 100644 --- a/module/VuFind/src/VuFind/Controller/WorldcatController.php +++ b/module/VuFind/src/VuFind/Controller/WorldcatController.php @@ -68,28 +68,5 @@ class WorldcatController extends AbstractSearch { return $this->resultsAction(); } - - /** - * Forward unrecognized actions to record controller for legacy URL - * compatibility. - * - * @param string $method Method name being called. - * @param array $params Parameters passed to method. - * - * @return void - */ - public function __call($method, $params) - { - if (substr($method, -6) == 'Action') { - $action = substr($method, 0, strlen($method) - 6); - // Special case for default record action: - if ($action == 'record') { - $action = 'home'; - } - return $this->forward() - ->dispatch('WorldcatRecord', array('action' => $action)); - } - return parent::__call($method, $params); - } }