From 676c3bb520baebd41135bbf349165979d52d2f0c Mon Sep 17 00:00:00 2001 From: Mark Noble Date: Thu, 26 Sep 2024 15:42:05 -0600 Subject: [PATCH] Add additional checking if for blank values from getActiveLocation in addition to null values and add additional debugging to self check tester --- code/web/release_notes/24.09.01.MD | 3 +++ code/web/services/API/UserAPI.php | 12 +++++++++--- code/web/services/ILS/SelfCheckTester.php | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/code/web/release_notes/24.09.01.MD b/code/web/release_notes/24.09.01.MD index a33280eac0..7d88bce7d0 100644 --- a/code/web/release_notes/24.09.01.MD +++ b/code/web/release_notes/24.09.01.MD @@ -2,6 +2,9 @@ ### Sierra Updates - Manually encode json when checking out a title to ensure statgroup is sent to the Sierra APIs as an integer. (*MDN*) +### Self Check Tester +- Add additional checking if for blank values from getActiveLocation in addition to null values and add additional debugging to self check tester. (*MDN*) + ### Other updates - Disabled the 'Show This Branch In Available At and Owning Location Facets' filter and setting as it is interacting poorly with facet labels. (*CZ*) - Increased the length for debuginfo column in the grouped_work_debug_info table (Ticket 138696) (*KL*) diff --git a/code/web/services/API/UserAPI.php b/code/web/services/API/UserAPI.php index 850322f7ef..8914b57886 100644 --- a/code/web/services/API/UserAPI.php +++ b/code/web/services/API/UserAPI.php @@ -5763,7 +5763,7 @@ function endMasquerade() { function checkoutILSItem($patronBarcode = null, $patronPassword = null, $itemBarcode = null, $activeLocationId = null): array { if ($patronBarcode != null && $patronPassword == null && $this->context == 'internal') { //For self check we don't require the pin, use find new user - //Call find new user just to be sure that all patron information is up to date. + //Call find new user just to be sure that all patron information is up-to-date. $user = UserAccount::findNewUser($patronBarcode, null); if (!$user) { //This user no longer exists? return an error? @@ -5793,11 +5793,17 @@ function checkoutILSItem($patronBarcode = null, $patronPassword = null, $itemBar $activeLocationId = $_REQUEST['locationId']; } } - if (empty($itemBarcode) || empty($activeLocationId)) { + if (empty($itemBarcode)) { return [ 'success' => false, 'title' => 'Error', - 'message' => 'Barcode and location id must be provided', + 'message' => 'Item Barcode must be provided', + ]; + } elseif (empty($activeLocationId)) { + return [ + 'success' => false, + 'title' => 'Error', + 'message' => 'Active location id must be provided', ]; } else { $location = new Location(); diff --git a/code/web/services/ILS/SelfCheckTester.php b/code/web/services/ILS/SelfCheckTester.php index 6c190e4428..8d3ef9be73 100644 --- a/code/web/services/ILS/SelfCheckTester.php +++ b/code/web/services/ILS/SelfCheckTester.php @@ -14,7 +14,7 @@ function launch() { global $locationSingleton; global $library; $location = $locationSingleton->getActiveLocation(); - if ($location == null) { + if (empty($location)) { $location = $library->getMainLocation(); } if ($location != null) {