/** * Get Patron Holds * * This is responsible for retrieving all holds by a specific patron. * * @param array $patron The patron array from patronLogin * * @throws DateException * @throws ILSException * @return array Array of the patron's holds on success. */ public function getMyHolds($patron) { $holds = parent::getMyHolds($patron); // Check if we have remote holds and augment if necessary $augment = false; foreach ($holds as $hold) { if ($hold['db_code'] != 'LOCAL') { $augment = true; break; } } if ($augment) { // Fetch hold information via the API so that we can include correct // title etc. for remote holds. $copyFields = ['id', 'item_id', 'volume', 'publication_year', 'title', 'institution_id', 'institution_name', 'institution_dbkey', 'in_transit']; $apiHolds = $this->getHoldsFromApi($patron, true); foreach ($apiHolds as $apiHold) { // Find the hold and add information to it foreach ($holds as &$hold) { if ($hold['reqnum'] == $apiHold['reqnum']) { // Ignore local holds if ($hold['db_code'] == 'LOCAL') { continue 2; } foreach ($copyFields as $field) { $hold[$field] = isset($apiHold[$field]) ? $apiHold[$field] : ''; } break; } } } } return $holds; }