Bugzilla – Attachment 155763 Details for
Bug 34722
All items display as recalled when an item-level recall is made
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34722: Prevent other items from displaying to fill item-level recalls
Bug-34722-Prevent-other-items-from-displaying-to-f.patch (text/plain), 3.56 KB, created by
David Nind
on 2023-09-17 20:13:14 UTC
(
hide
)
Description:
Bug 34722: Prevent other items from displaying to fill item-level recalls
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-09-17 20:13:14 UTC
Size:
3.56 KB
patch
obsolete
>From d95333388f8451ebb78f7171ecc961679d4439fa Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 6 Sep 2023 00:13:48 +0000 >Subject: [PATCH] Bug 34722: Prevent other items from displaying to fill > item-level recalls > >This patch prevents other items attached to a record from being displayed as 'recalled' by item-level recalls. > >To test: >1. Ensure UseRecalls system preference is enabled and circulation rules relevant to recalls are configured. Set 'on shelf recalls allowed' circulation rule 'if any unavailable' for ease of testing. >2. Search for a record that has multiple items, or create one with multiple items. Check out two of the items (Item A and Item B) to a patron, Patron A. >3. Log into the OPAC as another patron, Patron B. Search for the record and place a recall. Choose to recall a specific item and select Item A. >4. Go back to the staff interface and view the catalogue detail page for the record. Notice that every item has a 'recalled by...' message, even though Item A was specifically recalled. >5. Log into the OPAC as another patron, Patron C. Search for the record and place a recall. Choose to recall a specific item, notice every item has a 'recalled by...' message. Select Item B and Confirm. >6. In your terminal, the 'Other items are not returned for item-level recalls' test should fail when running >prove t/db_dependent/Koha/Item.t > >7. Apply the patch and restart services > >8. Confirm tests at t/db_dependent/Koha/Item.t now pass >9. Refresh the staff interface, confirm only Items A and B have the recalled message and the recall patron information for each item is accurate >10. Log into the OPAC as another patron, Patron D. Search for the record and place a recall. Choose to recall a specific item. Confirm only Items A and B have the recalled message. > >Sponsored-by: Toi Ohomai Institute of Technology >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Item.pm | 14 ++++++++++++-- > t/db_dependent/Koha/Item.t | 3 ++- > 2 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index dba357e680..d51eaeecea 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1842,11 +1842,21 @@ sub recall { > }, > { order_by => { -asc => 'created_date' } } > )->as_list; >+ >+ my $item_level_recall; > foreach my $recall (@recalls) { >- if ( $recall->item_level and $recall->item_id == $self->itemnumber ){ >- return $recall; >+ if ( $recall->item_level ) { >+ $item_level_recall = 1; >+ if ( $recall->item_id == $self->itemnumber ){ >+ return $recall; >+ } > } > } >+ if ( $item_level_recall ) { >+ # recall needs to be filled be a specific item only >+ # no other item is relevant to return >+ return; >+ } > # no item-level recall to return, so return earliest biblio-level > # FIXME: eventually this will be based on priority > return $recalls[0]; >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 176e8feed1..310eff6f22 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -1915,7 +1915,7 @@ subtest 'store() tests' => sub { > > subtest 'Recalls tests' => sub { > >- plan tests => 22; >+ plan tests => 23; > > $schema->storage->txn_begin; > >@@ -1956,6 +1956,7 @@ subtest 'Recalls tests' => sub { > )->store; > > is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' ); >+ is( $item2->recall, undef, 'Other items are not returned for item-level recalls' ); > > $recall2->set_cancelled; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34722
:
155245
|
155763
|
155765