From 0b44820f5cf3a3d73bf09a95aaf219b330dd21e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Mon, 13 Jan 2025 17:28:21 +0000 Subject: [PATCH 1/3] DIS-138 fix: display records The integration had the side effect of not displaying records properly if it was enabled. This is because the control flow would break out of the loop that generates the records when finding a LibKey link. This bug mainly affected EBSCO host records. This patch amends this so that records are always displayed properly. To replicate: - checkout to a 25.01.00-based branch - enable the EBSCO host module - create an EBSCO host setting - run a search in 'Article and Databases' - notice that EBSCO host search results list appears empty Test plan: - apply this patch - run a search in 'Article and Databases' - notice that EBSCO host search results display --- code/web/sys/SearchObject/EbscoEdsSearcher.php | 17 ++++++++--------- code/web/sys/SearchObject/EbscohostSearcher.php | 17 +++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/code/web/sys/SearchObject/EbscoEdsSearcher.php b/code/web/sys/SearchObject/EbscoEdsSearcher.php index ffc5b1ba6a..18361a0fd3 100644 --- a/code/web/sys/SearchObject/EbscoEdsSearcher.php +++ b/code/web/sys/SearchObject/EbscoEdsSearcher.php @@ -314,19 +314,18 @@ public function getResultRecordHTML() { foreach ($this->lastSearchResults->Data->Records[$x]->RecordInfo->BibRecord->BibEntity->Identifiers as $ui) { if ($ui->Type == "doi") { $libKeyResult = $this->getLibKeyResult($ui->Value); - if (isset($libKeyResult['data']['retractionNoticeUrl'])) { - $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); - $interface->assign('retracted', true); - break; + if ($libKeyResult && isset($libKeyResult['data'])) { + if (isset($libKeyResult['data']['retractionNoticeUrl'])) { + $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); + $interface->assign('retracted', true); + } + $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); + $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); + $interface->assign('retracted', false); } - $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); - $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); - $interface->assign('retracted', false); - break; } } } - require_once ROOT_DIR . '/RecordDrivers/EbscoRecordDriver.php'; $record = new EbscoRecordDriver($current); if ($record->isValid()) { diff --git a/code/web/sys/SearchObject/EbscohostSearcher.php b/code/web/sys/SearchObject/EbscohostSearcher.php index 6bc18ab618..6b48f08ec5 100644 --- a/code/web/sys/SearchObject/EbscohostSearcher.php +++ b/code/web/sys/SearchObject/EbscohostSearcher.php @@ -256,15 +256,16 @@ public function getResultRecordHTML() { $interface->assign('resultIndex', $x + 1 + (($this->page - 1) * $this->limit)); if (Library::getActiveLibrary()->libKeySettingId != -1 && !empty($current->header->controlInfo->artinfo->ui)) { $libKeyResult = $this->getLibKeyResult($current->header->controlInfo->artinfo->ui); - if (isset($libKeyResult['data']['retractionNoticeUrl'])) { - $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); - $interface->assign('retracted', true); - break; + if ($libKeyResult && isset($libKeyResult['data'])) { + if (isset($libKeyResult['data']['retractionNoticeUrl'])) { + $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); + $interface->assign('retracted', true); + } else { + $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); + $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); + $interface->assign('retracted', false); + } } - $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); - $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); - $interface->assign('retracted', false); - break; } require_once ROOT_DIR . '/RecordDrivers/EbscohostRecordDriver.php'; $record = new EbscohostRecordDriver($current); From a08b91129e25d76f047780d4d35a4f8c60c03600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Tue, 14 Jan 2025 08:42:26 +0000 Subject: [PATCH 2/3] DIS-138 fix: retraction notices for EBSCO EDS This ensures that, should a retraction notice link be sent back by LibKey for a given record, the retraction link is used to populate the relevant button, and the warning displayed to the user. Before this, the url would have been overwritten, and the 'retracted' variable set to true even if a retraction was found. For better readability, further amendments are made to the control flow with a switch from nested if statements to guard clauses. Test plan - run a search in 'Article and Databases' - notice the 'Access Online' link to the right of 'More Info' on each result - check that the link opens the selected resource in a new tab (this should take you through LibKey and straight to the PDF document (if a pdf is available for the resource)) - find a retracted article, notice that a 'Retracted' warning message appears, that it is a link leading to LibKey page with information on the retraction, and that the 'Access Online' button is not available. --- .../web/sys/SearchObject/EbscoEdsSearcher.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/code/web/sys/SearchObject/EbscoEdsSearcher.php b/code/web/sys/SearchObject/EbscoEdsSearcher.php index 18361a0fd3..70839bcdd9 100644 --- a/code/web/sys/SearchObject/EbscoEdsSearcher.php +++ b/code/web/sys/SearchObject/EbscoEdsSearcher.php @@ -312,17 +312,20 @@ public function getResultRecordHTML() { $interface->assign('resultIndex', $x + 1 + (($this->page - 1) * $this->limit)); if (Library::getActiveLibrary()->libKeySettingId != -1 && !empty($this->lastSearchResults->Data->Records[$x]->RecordInfo->BibRecord->BibEntity->Identifiers)) { foreach ($this->lastSearchResults->Data->Records[$x]->RecordInfo->BibRecord->BibEntity->Identifiers as $ui) { - if ($ui->Type == "doi") { - $libKeyResult = $this->getLibKeyResult($ui->Value); - if ($libKeyResult && isset($libKeyResult['data'])) { - if (isset($libKeyResult['data']['retractionNoticeUrl'])) { - $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); - $interface->assign('retracted', true); - } - $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); - $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); - $interface->assign('retracted', false); - } + if ($ui->Type != "doi") { + continue; + } + $libKeyResult = $this->getLibKeyResult($ui->Value); + if (!$libKeyResult || !isset($libKeyResult['data'])) { + continue; + } + if (isset($libKeyResult['data']['retractionNoticeUrl'])) { + $interface->assign('libKeyUrl', $libKeyResult['data']['retractionNoticeUrl']); + $interface->assign('retracted', true); + } else { + $interface->assign('libKeyUrl', $libKeyResult["data"]["bestIntegratorLink"]["bestLink"]); + $interface->assign('retracted', false); + $interface->assign('libKeyCoverImageUrl', $libKeyResult['included'][0]['coverImageUrl']); } } } From 654c235148b9aa9a50e0efcd0b907516997607a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Zermatten?= Date: Tue, 14 Jan 2025 08:55:02 +0000 Subject: [PATCH 3/3] DIS-138 docs: update release notes --- code/web/release_notes/25.01.00.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/web/release_notes/25.01.00.MD b/code/web/release_notes/25.01.00.MD index f825364c77..0cba73cb69 100644 --- a/code/web/release_notes/25.01.00.MD +++ b/code/web/release_notes/25.01.00.MD @@ -71,6 +71,8 @@ - if the results from the LibKey API indicate an article has been retracted, they are marked as such. (*CZ*) - for retracted articles, a link to a LibKey page giving information on the retraction is displayed. (*CZ*) - for retracted articles, the 'Access Online' button is not displayed. (*CZ*) + - fixed an issue where the LibKey integration would prevent EBSCO host records from appearing due to a control flow issue. (*CZ*) + - fixed an issue where the LibKey integration would overwrite retraction notices for EBSCO EDS records. (*CZ*) ### Local ILL Updates - Properly handle volume level holds with Local ILL. (DIS-34) (*MDN*)