Skip to content
Snippets Groups Projects
Commit d68a865a authored by Demian Katz's avatar Demian Katz
Browse files

Made constructor injection of catalog connection into ILS logic classes...

Made constructor injection of catalog connection into ILS logic classes mandatory to break unnecessary dependencies.
parent f67532d5
No related merge requests found
......@@ -149,15 +149,17 @@ class AjaxController extends AbstractBase
* Support method for getItemStatuses() -- filter suppressed locations from the
* array of item information for a particular bib record.
*
* @param array $record Information on items linked to a single bib record
* @param array $record Information on items linked to a single
* bib record
* @param \VuFind\ILS\Connection $catalog ILS connection
*
* @return array Filtered version of $record
*/
protected function filterSuppressedLocations($record)
protected function filterSuppressedLocations($record, $catalog)
{
static $hideHoldings = false;
if ($hideHoldings === false) {
$logic = new \VuFind\ILS\Logic\Holds($this->getAuthManager());
$logic = new \VuFind\ILS\Logic\Holds($this->getAuthManager(), $catalog);
$hideHoldings = $logic->getSuppressedLocations();
}
......@@ -221,7 +223,7 @@ class AjaxController extends AbstractBase
$statuses = array();
foreach ($results as $recordNumber=>$record) {
// Filter out suppressed locations:
$record = $this->filterSuppressedLocations($record);
$record = $this->filterSuppressedLocations($record, $catalog);
// Skip empty records:
if (count($record)) {
......
......@@ -28,7 +28,6 @@
*/
namespace VuFind\ILS\Logic;
use VuFind\Config\Reader as ConfigReader,
VuFind\Connection\Manager as ConnectionManager,
VuFind\Crypt\HMAC,
VuFind\ILS\Connection as ILSConnection;
......@@ -55,7 +54,7 @@ class Holds
* @param \VuFind\Auth\Manager $account Auth manager object
* @param ILSConnection $catalog A catalog connection
*/
public function __construct($account, $catalog = false)
public function __construct($account, $catalog)
{
$this->account = $account;
$this->config = ConfigReader::getConfig();
......@@ -66,8 +65,7 @@ class Holds
}
}
$this->catalog = ($catalog !== false)
? $catalog : ConnectionManager::connectToCatalog();
$this->catalog = $catalog;
}
/**
......
......@@ -28,7 +28,6 @@
*/
namespace VuFind\ILS\Logic;
use VuFind\Config\Reader as ConfigReader,
VuFind\Connection\Manager as ConnectionManager,
VuFind\Crypt\HMAC,
VuFind\ILS\Connection as ILSConnection;
......@@ -55,7 +54,7 @@ class TitleHolds
* @param \VuFind\Auth\Manager $account Auth manager object
* @param ILSConnection $catalog A catalog connection
*/
public function __construct($account, $catalog = false)
public function __construct($account, $catalog)
{
$this->account = $account;
$this->config = ConfigReader::getConfig();
......@@ -66,8 +65,7 @@ class TitleHolds
}
}
$this->catalog = ($catalog !== false)
? $catalog : ConnectionManager::connectToCatalog();
$this->catalog = $catalog;
}
/**
......
......@@ -797,7 +797,7 @@ class SolrMarc extends SolrDefault
*/
public function getRealTimeHoldings($account)
{
$holdLogic = new HoldLogic($account);
$holdLogic = new HoldLogic($account, ConnectionManager::connectToCatalog());
return $holdLogic->getHoldings($this->getUniqueID());
}
......@@ -833,7 +833,9 @@ class SolrMarc extends SolrDefault
|| stristr("part", $biblioLevel)
) {
if (ILSConnection::getTitleHoldsMode() != "disabled") {
$holdLogic = new TitleHoldLogic($account);
$holdLogic = new TitleHoldLogic(
$account, ConnectionManager::connectToCatalog()
);
return $holdLogic->getHold($this->getUniqueID());
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment