Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24.10.00 handle eds search error #135

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/web/interface/themes/responsive/EBSCO/searchError.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</div>
{/if}

{if !empty($searchError) && !empty($searchError.error.msg)}
{if !empty($searchError) && !empty($searchError->getMessage())}
<h2>{translate text="Error description" isPublicFacing=true}</h2>
<div>
{$searchError.error.msg}
{$searchError->getMessage()}
</div>
{/if}
</div>
1 change: 1 addition & 0 deletions code/web/release_notes/24.10.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
- E-commerce: SnapPay: drop unused database field and other small fixes. (*JStaub*)
- Correct cron artifact within new default intellij project. (*MDN*)
- When batch updating enumerations, display the label for the new value rather than the internal value. (*MDN*)
- Fix an issue where EBSCO EDS search errors were echoed to the UI on the search page (visible to any visitor) by adding the error message to the logs instead. (*CZ*)

## This release includes code contributions from
###ByWater Solutions
Expand Down
15 changes: 10 additions & 5 deletions code/web/sys/SearchObject/EbscoEdsSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function getCurlConnection() {
}

public function authenticate() {
global $logger;
if (SearchObject_EbscoEdsSearcher::$authenticationToken == null) {
global $library;
$settings = $this->getSettings();
Expand Down Expand Up @@ -185,13 +186,13 @@ public function authenticate() {
//echo("Authenticated in EDS!");
return true;
} elseif ($createSessionResponse->ErrorDescription) {
echo("create session failed, " . print_r($createSessionResponse));
return false;
$logger->log("create session failed, " . print_r($createSessionResponse, true), Logger::LOG_WARNING);
return new AspenError("Error processing search in EBSCO EDS");
}
}
} else {
echo("Authentication failed!, $return");
return false;
$logger->log("Error processing search in EBSCO EDS: " . print_r($return, true), Logger::LOG_WARNING);
return new AspenError("Error processing search in EBSCO EDS: Authentication failed");
}
} else {
return false;
Expand Down Expand Up @@ -553,9 +554,13 @@ function getSearchesFile() {
}

public function processSearch($returnIndexErrors = false, $recommendations = false, $preventQueryModification = false) {
if (!$this->authenticate()) {
$isAuthenticated = $this->authenticate();
if (empty($isAuthenticated)) {
return null;
}
if (get_class($isAuthenticated) == 'AspenError') {
return $isAuthenticated;
}

$this->startQueryTimer();
$hasSearchTerm = false;
Expand Down