Skip to content

Commit

Permalink
DIS-34 API Local ILL
Browse files Browse the repository at this point in the history
API Updates to support local ILL for LiDA
Update to allow volume Local ILL requests for LiDA
  • Loading branch information
mdnoble73 committed Jan 2, 2025
1 parent 6e6e7f5 commit e8638a9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
4 changes: 3 additions & 1 deletion code/web/RecordDrivers/RecordActionGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function getSpecificVolumeLocalIllRequestAction($module, $source, $id, $volumeIn
'id' => "actionButton$id",
'onclick' => "return AspenDiscovery.Record.showLocalIllRequest('$module', '$source', '$id', '{$volumeInfo['volumeId']}');",
'requireLogin' => false,
'type' => 'ils_hold',
'type' => 'local_ill_request',
'volumeId' => $volumeInfo['volumeId'],
'volumeName' => $volumeInfo['volumeName']
];
}

Expand Down
9 changes: 6 additions & 3 deletions code/web/release_notes/25.01.00.MD
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
## Aspen LiDA Updates
//mark
### Github Updates
- Move Aspen LiDA to it's own repository at https://github.com/Aspen-Discovery/aspen-lida. (*MDN*)
### Account Updates
- Show Volume in holds when applicable. (DIS-34) (*MDN*)
- Show Out of Hold Group Message in holds when applicable. (DIS-34) (*MDN*)

### Local ILL
- Show Out of Hold Group Message when available. (DIS-34) (*MDN*)
- Fixes for placing local ILL requests. (DIS-34) (*MDN*)
- Allow placing local ILL requests for individual volumes of a record. (DIS-34) (*MDN*)

### Other Updates
- Move Aspen LiDA to its own repository at https://github.com/Aspen-Discovery/aspen-lida. (*MDN*)
- Add debugging code to aid in diagnosing startup problems. (*MDN*)

## Aspen Discovery Updates
Expand Down
10 changes: 9 additions & 1 deletion code/web/services/API/ItemAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ function getAppGroupedWork() {
$action['sampleNumber'] = $recordAction['sampleNumber'];
}
}

$action['volumeId'] = $recordAction['volumeId'] ?? null;
$action['volumeName'] = $recordAction['volumeName'] ?? null;

$actions[] = $action;
}

Expand Down Expand Up @@ -1125,6 +1129,8 @@ function getVariations() {
$actionButtons[$key]['requireLogin'] = $action['requireLogin'] ?? false;
$actionButtons[$key]['sampleNumber'] = $action['sampleNumber'] ?? null;
$actionButtons[$key]['formatId'] = $action['formatId'] ?? null;
$actionButtons[$key]['volumeId'] = $action['volumeId'] ?? null;
$actionButtons[$key]['volumeName'] = $action['volumeName'] ?? null;

if(isset($action['redirectUrl'])) {
$actionButtons[$key]['redirectUrl'] = $action['redirectUrl'];
Expand Down Expand Up @@ -1275,8 +1281,10 @@ function getRecords() {
$buttons[$key]['requireLogin'] = $actionButton['requireLogin'] ?? false;
$buttons[$key]['sampleNumber'] = $actionButton['sampleNumber'] ?? null;
$buttons[$key]['formatId'] = $actionButton['formatId'] ?? null;
$buttons[$key]['volumeId'] = $actionButton['volumeId'] ?? null;
$buttons[$key]['volumeName'] = $actionButton['volumeName'] ?? null;

if(isset($actionButton['redirectUrl'])) {
if (isset($actionButton['redirectUrl'])) {
$buttons[$key]['redirectUrl'] = $actionButton['redirectUrl'];
}
}
Expand Down
13 changes: 9 additions & 4 deletions code/web/services/API/UserAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1789,11 +1789,11 @@ function renewItem(): array {

/**
* Renews all items that have been checked out to the user from the ILS.
* Returns a count of the number of items that could be renewed.
* Returns a count of the items that could be renewed.
*
* Parameters:
* <ul>
* <li>username - The barcode of the user. Can be truncated to the last 7 or 9 digits.</li>
* <li>username - The barcode of the user. Can be truncated to the last 7 or 9 digits.</li>
* <li>password - The pin number for the user. </li>
* </ul>
*
Expand Down Expand Up @@ -1869,7 +1869,7 @@ function renewAll(): array {
*
* Sample Call:
* <code>
* https://aspenurl/API/UserAPI?method=renewAll&username=userbarcode&password=userpin&bibId=1004012&pickupBranch=pa
* https://aspenurl/API/UserAPI?method=placeHold&username=userbarcode&password=userpin&bibId=1004012&pickupBranch=pa
* </code>
*
* Sample Response (successful hold):
Expand Down Expand Up @@ -1923,7 +1923,7 @@ function placeHold(): array {
if ($source == 'ils' || $source == null) {
if (isset($_REQUEST['pickupBranch']) || isset($_REQUEST['campus'])) {
if (isset($_REQUEST['pickupBranch'])) {
if (is_null($_REQUEST['pickupBranch'])) {
if (empty($_REQUEST['pickupBranch'])) {
$location = new Location();
$userPickupLocations = $location->getPickupBranches($user);
foreach ($userPickupLocations as $tmpLocation) {
Expand Down Expand Up @@ -1970,6 +1970,7 @@ function placeHold(): array {
$action = $result['api']['action'] ?? null;
$responseMessage = strip_tags($result['api']['message']);
$responseMessage = trim($responseMessage);
$needsIllRequest = isset($hold_result['error_code']) && ($hold_result['error_code'] == 'hatErrorResponse.17286') || ($hold_result['error_code'] == 'hatErrorResponse.447');
return [
'success' => $result['success'],
'title' => $result['api']['title'],
Expand All @@ -1978,12 +1979,14 @@ function placeHold(): array {
'confirmationNeeded' => $result['api']['confirmationNeeded'] ?? false,
'confirmationId' => $result['api']['confirmationId'] ?? null,
'shouldBeItemHold' => false,
'needsIllRequest' => $needsIllRequest
];
} elseif ($holdType == 'volume' && isset($_REQUEST['volumeId'])) {
$result = $user->placeVolumeHold($shortId, $_REQUEST['volumeId'], $pickupBranch);
$action = $result['api']['action'] ?? null;
$responseMessage = strip_tags($result['api']['message']);
$responseMessage = trim($responseMessage);
$needsIllRequest = isset($result['error_code']) && ($result['error_code'] == 'hatErrorResponse.17286') || ($result['error_code'] == 'hatErrorResponse.447');
return [
'success' => $result['success'],
'title' => $result['api']['title'],
Expand All @@ -1992,6 +1995,7 @@ function placeHold(): array {
'confirmationNeeded' => $result['api']['confirmationNeeded'] ?? false,
'confirmationId' => $result['api']['confirmationId'] ?? null,
'shouldBeItemHold' => false,
'needsIllRequest' => $needsIllRequest
];
} else {
//Make sure that there are not volumes available
Expand Down Expand Up @@ -2154,6 +2158,7 @@ function getValidPickupLocations(): array {
$pickupLocationArray = $pickupLocation->toArray();
$pickupLocationArray['locationId'] = (string)$pickupLocationArray['locationId'];
$pickupLocationArray['libraryId'] = (string)$pickupLocationArray['libraryId'];
$pickupLocationArray['locationCode'] = (string)$pickupLocationArray['code'];
$pickupLocations[] = $pickupLocationArray;
}
}
Expand Down
15 changes: 15 additions & 0 deletions code/web/sys/InterLibraryLoan/LocalIllForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,21 @@ public function getFormFieldsForApi() : array {
'maxLength' => 20,
];

$fields['volumeId'] = [
'type' => 'text',
'property' => 'volumeId',
'display' => 'hide',
'label' => translate([
'text' => 'Volume ID',
'isPublicFacing' => true,
]),
'description' => translate([
'text' => 'The volume to be requested',
'isPublicFacing' => true,
]),
'required' => false,
];

require_once ROOT_DIR . '/services/API/UserAPI.php';
$user = new UserAPI();

Expand Down

0 comments on commit e8638a9

Please sign in to comment.