Bugzilla – Attachment 187484 Details for
Bug 26993
Allow StoreLastBorrower to retain a locally-defined number of previous borrowers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26993: (follow-up) Rename last_returned_by_all as last_borrowers
Bug-26993-follow-up-Rename-lastreturnedbyall-as-la.patch (text/plain), 5.25 KB, created by
Lucas Gass (lukeg)
on 2025-10-06 16:54:06 UTC
(
hide
)
Description:
Bug 26993: (follow-up) Rename last_returned_by_all as last_borrowers
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-10-06 16:54:06 UTC
Size:
5.25 KB
patch
obsolete
>From 5813d86ba4f5f13e82bd1b0a62ad02a54d766ad0 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 6 Oct 2025 16:53:42 +0000 >Subject: [PATCH] Bug 26993: (follow-up) Rename last_returned_by_all as > last_borrowers > >--- > Koha/Item.pm | 6 +++--- > .../prog/en/modules/catalogue/moredetail.tt | 2 +- > .../Circulation/StoreLastBorrower.t | 20 +++++++++---------- > 3 files changed, 14 insertions(+), 14 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 36946689d02..e0f69eebe55 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -927,13 +927,13 @@ sub get_transfers { > return Koha::Item::Transfers->_new_from_dbic($transfers_rs); > } > >-=head3 last_returned_by_all >+=head3 last_borrowers > > Returns all patrons who have returned this item, ordered by most recent first. > > =cut > >-sub last_returned_by_all { >+sub last_borrowers { > my ($self) = @_; > > my $max_stored_borrowers = C4::Context->preference('StoreLastBorrower') || 0; >@@ -977,7 +977,7 @@ sub last_returned_by { > > # If StoreLastBorrower is 0 or disabled, bail without storing anything. Also delete any remaining rows from the table. > if ( $max_stored_borrowers == 0 ) { >- $self->last_returned_by_all->delete; >+ $self->last_borrowers->delete; > return $self; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index c63c768963a..6b29f327f37 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -495,7 +495,7 @@ > </li> > > [% IF Koha.Preference('StoreLastBorrower') && Koha.Preference('StoreLastBorrower') > 0 %] >- [% SET all_borrowers = ITEM_DAT.object.last_returned_by_all %] >+ [% SET all_borrowers = ITEM_DAT.object.last_borrowers %] > [% IF all_borrowers.count > 0 %] > <li> > <span class="label">Last returned by:</span> >diff --git a/t/db_dependent/Circulation/StoreLastBorrower.t b/t/db_dependent/Circulation/StoreLastBorrower.t >index f395e24d1bd..9b40efe9fb3 100755 >--- a/t/db_dependent/Circulation/StoreLastBorrower.t >+++ b/t/db_dependent/Circulation/StoreLastBorrower.t >@@ -150,10 +150,10 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > my $item = $builder->build_sample_item; > t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); > >- # Test last_returned_by_all with no borrowers >+ # Test last_borrowers with no borrowers > t::lib::Mocks::mock_preference( 'StoreLastBorrower', '3' ); >- my $borrowers = $item->last_returned_by_all(); >- is( $borrowers->count, 0, 'last_returned_by_all returns empty set when no borrowers stored' ); >+ my $borrowers = $item->last_borrowers(); >+ is( $borrowers->count, 0, 'last_borrowers returns empty set when no borrowers stored' ); > > # Add 3 borrowers for testing, checkout/check in > my @patrons; >@@ -182,8 +182,8 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > > $item = $item->get_from_storage; > >- # Test last_returned_by_all returns all borrowers >- $borrowers = $item->last_returned_by_all(); >+ # Test last_borrowers returns all borrowers >+ $borrowers = $item->last_borrowers(); > is( $borrowers->count, 3, 'Correctly returns 3 borrowers' ); > > # Test ordering >@@ -217,7 +217,7 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > } > > $item = $item->get_from_storage; >- $borrowers = $item->last_returned_by_all(); >+ $borrowers = $item->last_borrowers(); > is( > $borrowers->count, 3, > 'We only retain 3 borrowers when the sys pref is set to 3, even though there are 5 checkouts/checkins' >@@ -251,7 +251,7 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > ); > > $item = $item->get_from_storage; >- $borrowers = $item->last_returned_by_all(); >+ $borrowers = $item->last_borrowers(); > is( $borrowers->count, 2, 'StoreLastBorrower was reduced to 2, we should now only keep 2 in the table' ); > @borrowers_array = $borrowers->as_list; > is( >@@ -286,8 +286,8 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > ); > > $item = $item->get_from_storage; >- $borrowers = $item->last_returned_by_all(); >- is( $borrowers->count, 0, 'last_returned_by_all respects preference value 0' ); >+ $borrowers = $item->last_borrowers(); >+ is( $borrowers->count, 0, 'last_borrowers respects preference value 0' ); > > my $cleanup_patron = $builder->build( > { >@@ -312,7 +312,7 @@ subtest 'Test StoreLastBorrower with multiple borrowers' => sub { > ); > > $item = $item->get_from_storage; >- $borrowers = $item->last_returned_by_all(); >+ $borrowers = $item->last_borrowers(); > is( $borrowers->count, 0, 'All entries cleared when preference is 0' ); > is( $item->last_returned_by, undef, 'last_returned_by returns undef when no records' ); > >-- >2.39.5
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 26993
:
186773
|
186774
|
186775
|
186776
|
186801
|
186805
|
186806
|
186807
|
186808
|
186809
|
186844
|
186853
|
187311
|
187312
|
187313
|
187314
|
187315
|
187316
|
187459
|
187460
|
187483
| 187484