Skip to content

DIS-211: Ignore 'number one bestseller' subtitle in OverDrive #2191

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

Closed
wants to merge 13 commits into from
Closed
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
Binary file modified code/axis_360_export/axis_360_export.jar
Binary file not shown.
Binary file modified code/hoopla_export/hoopla_export.jar
Binary file not shown.
Binary file modified code/koha_export/koha_export.jar
Binary file not shown.
Binary file modified code/polaris_export/polaris_export.jar
Binary file not shown.
Binary file modified code/reindexer/reindexer.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ private String processOverDriveRecord(String overdriveId, String title, String s
if (series != null && !series.isEmpty() && subtitleLower.contains(series.toLowerCase())){
subtitle = "";
//Remove book club notices and award winners
}else if (subtitleLower.contains("book club") || subtitleLower.contains("award winner") || subtitleLower.contains("read with jenna")) {
}else if (subtitleLower.contains("book club") || subtitleLower.contains("award winner") || subtitleLower.contains("read with jenna")
|| subtitleLower.contains("number one bestseller")) {
subtitle = "";
}
}
Expand Down
Binary file modified code/user_list_indexer/user_list_indexer.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions code/web/release_notes/25.01.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
### Web Builder Updates
- When adding a form to a custom page, limit the forms displayed in the dropdown to those from the user's own library if their permissions are Administer Library Custom Forms. (*AB*)

### Indexing Updates
- Enhanced subtitle filtering for OverDrive records by ignoring the subtitle "number one bestseller". (DIS-211) (*LS*)

### Other Updates
- Fix linking to library websites for consortia within Web Builder and the Hours and Location dialog. (*MDN*)
- Add an editorconfig file for template files to standardize using tabs across all files. (*MDN*)
Expand All @@ -150,6 +153,7 @@
- Lucas Gass (LG)
- Nick Clemens (WNC)
- Yanjun Li (YL)
- Leo Stoyanov (LS)

### Grove For Libraries
- Mark Noble (MDN)
Expand Down
68 changes: 68 additions & 0 deletions code/web/release_notes/25.02.00.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## Aspen LiDA Updates
//mark
### Account Updates
- When a library has multiple sublocations that are valid as pickup areas, allow the user to change the pickup area when changing the pickup location. (DIS-195) (*MDN*)

### Holds Updates
- When a library has multiple sublocations that are valid as pickup areas, allow the user to select a pickup area when placing a hold. (DIS-195) (*MDN*)

## Aspen Discovery Updates
//mark
### API Updates
- 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*)

//katherine

//kirstien

//james

//alexander

//chloe


//pedro

// lucas

// tomas

// kyle

//kidclamp

Use mb_substr to presrve diacritics in lists (DIS-178) (*WNC*)

//yanjun

//lukeg

## This release includes code contributions from
### ByWater Solutions
- Kyle Hall (KMH)
- Lucas Gass (LG)
- Nick Clemens (WNC)
- Yanjun Li (YL)

### Grove For Libraries
- Mark Noble (MDN)
- Kirstien Kroeger (KK)
- Katherine Perdue (KP)

### Nashville Public Library
- James Staub (JStaub)

### PTFS-Europe
- Alexander Blanchard (AB)
- Chloe Zermatten (CZ)
- Pedro Amorim (PA)

### Theke Solutions
- Lucas Montoya (LM)
- Tomás Cohen Arazi (TC)

## Special Testing thanks to

## This release includes sponsored developments from
130 changes: 113 additions & 17 deletions code/web/services/API/UserAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class UserAPI extends AbstractAPI {


/**
* Processes method to determine return type and calls the correct method.
* Processes method to determine the return type and calls the correct method.
* Should not be called directly.
*
* @see Action::launch()
* @access private
*/
function launch() {
function launch() : void {
$method = (isset($_GET['method']) && !is_array($_GET['method'])) ? $_GET['method'] : '';
$output = '';

Expand Down Expand Up @@ -54,6 +54,7 @@ function launch() {
'returnCheckout',
'updateOverDriveEmail',
'getValidPickupLocations',
'getValidSublocations',
'getHiddenBrowseCategories',
'getILSMessages',
'dismissBrowseCategory',
Expand Down Expand Up @@ -256,8 +257,8 @@ function logout(): bool {
*
* Parameters:
* <ul>
* <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>username - The barcode of the user. Can be truncated to the last 7 or 9 digits.</li>
* <li>password - The pin for the user.
* </ul>
*
* @noinspection PhpUnused
Expand Down Expand Up @@ -1916,6 +1917,18 @@ function placeHold(): array {
$shortId = $bibId;
}

$pickupSublocationId = $_REQUEST['pickupSublocation'] ?? false;
$pickupSublocation = null;
if ($pickupSublocationId) {
//In the form this is set as the id of the sublocation in Aspen, but we want to pass the ILS ID
require_once ROOT_DIR . '/sys/LibraryLocation/Sublocation.php';
$pickupSublocationObject = new Sublocation();
$pickupSublocationObject->id = $pickupSublocationId;
if ($pickupSublocationObject->find(true)) {
$pickupSublocation = $pickupSublocationObject->ilsId;
}
}

$user = $this->getUserForApiCall();
if ($user && !($user instanceof AspenError)) {
global $library;
Expand Down Expand Up @@ -1966,7 +1979,7 @@ function placeHold(): array {

$holdType = $_REQUEST['holdType'];
if ($holdType == 'item' && isset($_REQUEST['itemId'])) {
$result = $user->placeItemHold($shortId, $_REQUEST['itemId'], $pickupBranch, $cancelDate);
$result = $user->placeItemHold($shortId, $_REQUEST['itemId'], $pickupBranch, $cancelDate, $pickupSublocation);
$action = $result['api']['action'] ?? null;
$responseMessage = strip_tags($result['api']['message']);
$responseMessage = trim($responseMessage);
Expand All @@ -1982,7 +1995,7 @@ function placeHold(): array {
'needsIllRequest' => $needsIllRequest
];
} elseif ($holdType == 'volume' && isset($_REQUEST['volumeId'])) {
$result = $user->placeVolumeHold($shortId, $_REQUEST['volumeId'], $pickupBranch);
$result = $user->placeVolumeHold($shortId, $_REQUEST['volumeId'], $pickupBranch, $pickupSublocation);
$action = $result['api']['action'] ?? null;
$responseMessage = strip_tags($result['api']['message']);
$responseMessage = trim($responseMessage);
Expand Down Expand Up @@ -2012,7 +2025,7 @@ function placeHold(): array {
];
}
}
$result = $user->placeHold($bibId, $pickupBranch, $cancelDate);
$result = $user->placeHold($bibId, $pickupBranch, $cancelDate, $pickupSublocation);
$action = $result['api']['action'] ?? null;
$responseMessage = strip_tags($result['api']['message']);
$responseMessage = trim($responseMessage);
Expand Down Expand Up @@ -2131,7 +2144,19 @@ function changeHoldPickUpLocation(): array {
]),
];
}
$result = $user->changeHoldPickUpLocation($holdId, $locationCode);
$newSublocation = $_REQUEST['newSublocation'] ?? null;
$pickupSublocation = null;
if (!empty($newSublocation)) {
//In the form this is set as the id of the sublocation in Aspen, but we want to pass the ILS ID
require_once ROOT_DIR . '/sys/LibraryLocation/Sublocation.php';
$pickupSublocationObject = new Sublocation();
$pickupSublocationObject->id = $newSublocation;
if ($pickupSublocationObject->find(true)) {
$pickupSublocation = $pickupSublocationObject->ilsId;
}
}

$result = $user->changeHoldPickUpLocation($holdId, $locationCode, $pickupSublocation);
return [
'success' => $result['success'],
'title' => $result['api']['title'],
Expand All @@ -2146,11 +2171,7 @@ function changeHoldPickUpLocation(): array {
}

function getValidPickupLocations(): array {
[
$username,
$password,
] = $this->loadUsernameAndPassword();
$patron = UserAccount::validateAccount($username, $password);
$patron = $this->getUserForApiCall();
if ($patron && !($patron instanceof AspenError)) {
if ($patron->hasIlsConnection()) {
$tmpPickupLocations = $patron->getValidPickupBranches($patron->getAccountProfile()->recordSource);
Expand Down Expand Up @@ -2182,6 +2203,64 @@ function getValidPickupLocations(): array {
}
}

function getValidSublocations() : array {
$patron = $this->getUserForApiCall();
if ($patron && !($patron instanceof AspenError)) {
if (isset($_REQUEST['locationCode'])) {
$location = new Location();
$location->code = $_REQUEST['locationCode'];
if ($location->find(true)) {
$validSubLocationsForUser = $location->getPickupSublocations($patron);
$subLocationsToReturn = [];
foreach ($validSubLocationsForUser as $sublocation) {
$subLocationsToReturn[$sublocation->id] = [
'id' => $sublocation->id,
'ilsId' => $sublocation->ilsId,
'displayName' => $sublocation->name,
'locationCode' => $location->code,
'locationId' => $location->locationId
];
}
return [
'success' => true,
'sublocations' => $subLocationsToReturn,
];
}else{
return [
'success' => false,
'message' => 'Could not find location for the specified location code',
];
}
}else{
$tmpPickupLocations = $patron->getValidPickupBranches($patron->getAccountProfile()->recordSource);
$subLocationsToReturn = [];
foreach ($tmpPickupLocations as $pickupLocation) {
if (!is_string($pickupLocation)) {
$validSubLocationsForUser = $pickupLocation->getPickupSublocations($patron);
foreach ($validSubLocationsForUser as $sublocation) {
$subLocationsToReturn[$sublocation->id] = [
'id' => $sublocation->id,
'ilsId' => $sublocation->ilsId,
'displayName' => $sublocation->name,
'locationCode' => $pickupLocation->code,
'locationId' => $pickupLocation->locationId
];
}
}
}
return [
'success' => true,
'sublocations' => $subLocationsToReturn,
];
}
} else {
return [
'success' => false,
'message' => 'Login unsuccessful',
];
}
}

function confirmHold(): array {
$user = $this->getUserForApiCall();
if ($user && !($user instanceof AspenError)) {
Expand Down Expand Up @@ -4628,7 +4707,7 @@ function updateScreenBrightnessStatus(): array {
$user = $this->getUserForApiCall();
if ($user && !($user instanceof AspenError)) {
$newStatus = $_REQUEST['status'] ?? null;
if($newStatus) {
if($newStatus !== null) {
if ($newStatus == 'false' || !$newStatus) {
$user->shouldAskBrightness = 0;
$user->update();
Expand All @@ -4639,6 +4718,11 @@ function updateScreenBrightnessStatus(): array {
];
} else {
// no update to the status since it defaults to 1
return [
'success' => true,
'title' => 'Success',
'message' => 'User screen brightness prompt status did not need update'
];
}
} else {
return [
Expand All @@ -4664,7 +4748,7 @@ function getUserByBarcode(): array {
];
if (isset($_REQUEST['username'])) {
$user = UserAccount::getUserByBarcode($_REQUEST['username']);
if ($user != false) {
if ($user !== false) {
$results = [
'success' => true,
'id' => $user->id,
Expand All @@ -4683,7 +4767,7 @@ function getUserByBarcode(): array {
/**
* @return bool|User
*/
function getUserForApiCall($patronBarcode = null, $patronPassword = null) {
function getUserForApiCall(?String $patronBarcode = null, ?String $patronPassword = null) : bool|User {
if ($this->context == 'internal') {
if ($patronBarcode == null && $patronPassword == null) {
return UserAccount::getActiveUserObj();
Expand Down Expand Up @@ -4734,7 +4818,7 @@ function getUserForApiCall($patronBarcode = null, $patronPassword = null) {
}
}

function getLinkedAccounts() {
function getLinkedAccounts() : array {
$user = $this->getUserForApiCall();

if ($user && !($user instanceof AspenError)) {
Expand Down Expand Up @@ -6045,6 +6129,12 @@ function markMessageAsRead(): array {
'title' => translate(['text' => 'Updated', 'isPublicFacing' => true]),
'message' => translate(['text' => 'Marked message as read', 'isPublicFacing' => true]),
];
}else{
return [
'success' => false,
'title' => translate(['text' => 'Not Updated', 'isPublicFacing' => true]),
'message' => translate(['text' => 'Could not mark message as read', 'isPublicFacing' => true]),
];
}
} else {
return [
Expand Down Expand Up @@ -6087,6 +6177,12 @@ function markMessageAsUnread(): array {
'title' => translate(['text' => 'Updated', 'isPublicFacing' => true]),
'message' => translate(['text' => 'Marked message as unread', 'isPublicFacing' => true]),
];
}else{
return [
'success' => false,
'title' => translate(['text' => 'Not Updated', 'isPublicFacing' => true]),
'message' => translate(['text' => 'Could not mark message as unread', 'isPublicFacing' => true]),
];
}
} else {
return [
Expand Down
Loading