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

Optionally allow API retrieval of local callslips (#847)

- Renamed getRemoteCallSlips to getCallSlips and added a new bool parameter that when set to true will return local CallSlip information along with Remote CallSlip information (default is false).
parent 211a9225
No related merge requests found
...@@ -2366,14 +2366,17 @@ EOT; ...@@ -2366,14 +2366,17 @@ EOT;
} }
/** /**
* Get Patron Remote Storage Retrieval Requests (Call Slips). Gets remote * Get Patron Storage Retrieval Requests (Call Slips). Gets callslips via
* callslips via the API. * the API. Returns only remote slips by default since more complete data
* can be retrieved directly from the local database; however, the $local
* parameter exists to support potential local customizations.
* *
* @param array $patron The patron array from patronLogin * @param array $patron The patron array from patronLogin
* @param bool $local Whether to include local callslips
* *
* @return mixed Array of the patron's storage retrieval requests. * @return mixed Array of the patron's storage retrieval requests.
*/ */
protected function getRemoteCallSlips($patron) protected function getCallSlips($patron, $local = false)
{ {
// Build Hierarchy // Build Hierarchy
$hierarchy = [ $hierarchy = [
...@@ -2397,8 +2400,11 @@ EOT; ...@@ -2397,8 +2400,11 @@ EOT;
$requests = []; $requests = [];
if (isset($results->callslips->institution)) { if (isset($results->callslips->institution)) {
foreach ($results->callslips->institution as $institution) { foreach ($results->callslips->institution as $institution) {
if ($this->isLocalInst((string)$institution->attributes()->id)) { if (!$local
// Ignore local callslips, we have them already && $this->isLocalInst((string)$institution->attributes()->id)
) {
// Unless $local is set, ignore local callslips; we have them
// already....
continue; continue;
} }
foreach ($institution->callslip as $callslip) { foreach ($institution->callslip as $callslip) {
...@@ -3147,7 +3153,7 @@ EOT; ...@@ -3147,7 +3153,7 @@ EOT;
{ {
return array_merge( return array_merge(
$this->getHoldsFromApi($patron, false), $this->getHoldsFromApi($patron, false),
$this->getRemoteCallSlips($patron) $this->getCallSlips($patron, false) // remote only
); );
} }
......
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