From 25206d5111b921ce9a77354deb72a9c514ddc671 Mon Sep 17 00:00:00 2001 From: Mark Noble Date: Fri, 10 Jan 2025 10:59:37 -0700 Subject: [PATCH] Evergreen updates - Extend the timeout for loading reading history for Evergreen - Properly handle titles that no longer exist within Evergreen when loading reading history for a patron. - When importing lists from Evergreen, ensure that list entries have their titles set so the lists can be sorted by title. --- code/web/Drivers/Evergreen.php | 29 ++++++++++++++++------------- code/web/release_notes/25.02.00.MD | 5 +++++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/code/web/Drivers/Evergreen.php b/code/web/Drivers/Evergreen.php index aef531ae7a..c1c254f489 100644 --- a/code/web/Drivers/Evergreen.php +++ b/code/web/Drivers/Evergreen.php @@ -817,6 +817,7 @@ public function getReadingHistory($patron, $page = 1, $recordsPerPage = -1, $sor $offset = 0; $hasMoreHistory = true; + set_time_limit(0); while ($hasMoreHistory) { $authToken = $this->getAPIAuthToken($patron, false); if ($authToken != null) { @@ -876,18 +877,20 @@ public function getReadingHistory($patron, $page = 1, $recordsPerPage = -1, $sor } } else { $checkout = $this->loadCheckoutData($patron, $circEntryMapped['source_circ'], $authToken); - $curTitle = []; - $curTitle['id'] = $checkout->recordId; - $curTitle['shortId'] = $checkout->recordId; - $curTitle['recordId'] = $checkout->recordId; - $curTitle['title'] = $checkout->title; - $curTitle['author'] = $checkout->author; - $curTitle['format'] = $checkout->format; - $curTitle['checkout'] = $checkout->checkoutDate; - if (!empty($circEntryMapped['checkin_time'])) { - $curTitle['checkin'] = strtotime($circEntryMapped['checkin_time']); - } else { - $curTitle['checkin'] = null; + if ($checkout != null) { + $curTitle = []; + $curTitle['id'] = $checkout->recordId; + $curTitle['shortId'] = $checkout->recordId; + $curTitle['recordId'] = $checkout->recordId; + $curTitle['title'] = $checkout->title; + $curTitle['author'] = $checkout->author; + $curTitle['format'] = $checkout->format; + $curTitle['checkout'] = $checkout->checkoutDate; + if (!empty($circEntryMapped['checkin_time'])) { + $curTitle['checkin'] = strtotime($circEntryMapped['checkin_time']); + } else { + $curTitle['checkin'] = null; + } } } $readingHistoryTitles[] = $curTitle; @@ -898,7 +901,6 @@ public function getReadingHistory($patron, $page = 1, $recordsPerPage = -1, $sor $offset += 100; } - set_time_limit(20 * count($readingHistoryTitles)); $systemVariables = SystemVariables::getSystemVariables(); global $aspen_db; require_once ROOT_DIR . '/RecordDrivers/GroupedWorkDriver.php'; @@ -2407,6 +2409,7 @@ function importListsFromIls($patron) { $listEntry = new UserListEntry(); $listEntry->source = 'GroupedWork'; $listEntry->sourceId = $groupedWork->permanent_id; + $listEntry->title = StringUtils::trimStringToLengthAtWordBoundary($groupedWork->full_title, 50, true); $listEntry->listId = $newList->id; $listEntry->notes = ''; $listEntry->dateAdded = strtotime($createTime); diff --git a/code/web/release_notes/25.02.00.MD b/code/web/release_notes/25.02.00.MD index d4256ae538..ff93eb4d64 100644 --- a/code/web/release_notes/25.02.00.MD +++ b/code/web/release_notes/25.02.00.MD @@ -12,6 +12,11 @@ - Add a new API to retrieve available sublocations for the system. (DIS-195) (*MDN*) - API updates to support using multiple pickup areas within a location. (DIS-195) (*MDN*) +### Evergreen updates +- Extend the timeout for loading reading history for Evergreen. (*MDN*) +- Properly handle titles that no longer exist within Evergreen when loading reading history for a patron. (*MDN*) +- When importing lists from Evergreen, ensure that list entries have their titles set so the lists can be sorted by title. (*MDN*) + //katherine //kirstien