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

Code simplification.

parent 2812b6d6
No related merge requests found
...@@ -441,6 +441,27 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte ...@@ -441,6 +441,27 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte
return $transactions; return $transactions;
} }
/**
* Is the selected pickup location valid for the hold?
*
* @param string $pickUpLocation Selected pickup location
* @param array $patron Patron information returned by the patronLogin
* method.
* @param array $holdDetails Details of hold being placed
*
* @return bool
*/
protected function pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails)
{
$pickUpLibs = $this->getPickUpLocations($patron, $holdDetails);
foreach ($pickUpLibs as $location) {
if ($location['locationID'] == $pickUpLocation) {
return true;
}
}
return false;
}
/** /**
* Get Pick Up Locations * Get Pick Up Locations
* *
...@@ -1058,15 +1079,7 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte ...@@ -1058,15 +1079,7 @@ class VoyagerRestful extends Voyager implements \VuFindHttp\HttpServiceAwareInte
} }
// Make Sure Pick Up Library is Valid // Make Sure Pick Up Library is Valid
$pickUpValid = false; if (!$this->pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails)) {
$pickUpLibs = $this->getPickUpLocations($patron, $holdDetails);
foreach ($pickUpLibs as $location) {
if ($location['locationID'] == $pickUpLocation) {
$pickUpValid = true;
}
}
if (!$pickUpValid) {
// Invalid Pick Up Point
return $this->holdError("hold_invalid_pickup"); return $this->holdError("hold_invalid_pickup");
} }
......
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