Skip to content

Commit

Permalink
Merge pull request ding2#5 from odensecentralbibliotek/feature
Browse files Browse the repository at this point in the history
Added alma_availability_items function to get more availability information
  • Loading branch information
cableman committed Jun 20, 2013
2 parents b6a9c82 + df11c61 commit 5a2e3cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions includes/alma.availability.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
* Handles availability information from the library system.
*/

/**
* Implements provider availability, items.
*/
function alma_availability_items($provider_ids) {
$ids = join(',', $provider_ids);
$result = alma_client_invoke('get_availability', $ids);
if (!$result) {
$result = array();
}

return $result;
}
/**
* Implements provider availability, holdings.
*/
Expand Down
5 changes: 4 additions & 1 deletion lib/AlmaClient/AlmaClient.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,10 @@ public function get_availability($alma_ids) {
$data = array();
$doc = $this->request('catalogue/availability', array('catalogueRecordKey' => $alma_ids));
foreach ($doc->getElementsByTagName('catalogueRecord') as $record) {
$data[$record->getAttribute('id')] = ($record->getAttribute('isAvailable') == 'yes') ? TRUE : FALSE;
$data[$record->getAttribute('id')] = array(
'reservable' => ($record->getAttribute('isReservable') == 'true') ? TRUE : FALSE,
'available' => ($record->getAttribute('isAvailable') == 'yes') ? TRUE : FALSE,
);
}
return $data;
}
Expand Down

0 comments on commit 5a2e3cb

Please sign in to comment.