Bugzilla – Attachment 192905 Details for
Bug 3492
Move hold fee setting into circulation rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3492: (follow-up) Replace GetReserveFee with holds_fee method
ab86751.patch (text/plain), 3.72 KB, created by
Martin Renvoize (ashimema)
on 2026-02-10 14:42:04 UTC
(
hide
)
Description:
Bug 3492: (follow-up) Replace GetReserveFee with holds_fee method
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-10 14:42:04 UTC
Size:
3.72 KB
patch
obsolete
>From ab86751f7caf435c657b535efc3177374f911965 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 10 Feb 2026 14:38:40 +0000 >Subject: [PATCH] Bug 3492: (follow-up) Replace GetReserveFee with holds_fee > method > >GetReserveFee was removed as part of the migration to circulation >rules-based hold fees, but reserve/request.pl still imported and >used it, causing compilation errors. > >This patch replaces the two usages of GetReserveFee with the modern >approach using Koha::Item->holds_fee($patron), matching the >implementation in opac-reserve.pl. > >The fee is calculated by iterating through available items and using >the first non-zero fee found, which provides backward compatibility >with the legacy reserve_charge template variable. > >This implementation uses ReservesControlBranch to determine which >branch's circulation rules apply (either item home library or patron >home library), consistent with the existing Koha policy framework. > >Test plan: >1. Apply patch >2. Verify reserve/request.pl compiles: perl -wc reserve/request.pl >3. Navigate to staff interface holds page with patron and biblio >4. Verify hold fee is displayed correctly if configured in > circulation rules >5. Place a hold and verify fee is charged correctly >--- > reserve/request.pl | 30 +++++++++++++++++++++++++++--- > 1 file changed, 27 insertions(+), 3 deletions(-) > >diff --git a/reserve/request.pl b/reserve/request.pl >index 22463bde8ec..fbc08a08269 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -33,7 +33,7 @@ use Date::Calc qw( Date_to_Days ); > use C4::Output qw( output_html_with_http_headers ); > use C4::Auth qw( get_template_and_user ); > use C4::Reserves >- qw( AlterPriority ToggleLowestPriority CanBookBeReserved GetMaxPatronHoldsForRecord CanItemBeReserved IsAvailableForItemLevelRequest GetReserveFee ); >+ qw( AlterPriority ToggleLowestPriority CanBookBeReserved GetMaxPatronHoldsForRecord CanItemBeReserved IsAvailableForItemLevelRequest ); > use C4::Items qw( get_hostitemnumbers_of ); > use C4::Koha qw( getitemtypeimagelocation ); > use C4::Serials qw( CountSubscriptionFromBiblionumber ); >@@ -772,7 +772,19 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > > # Pass through any reserve charge > if ($patron) { >- $biblioloopiter{reserve_charge} = GetReserveFee( $patron->borrowernumber, $biblionumber ); >+ >+ # Calculate hold fee using first available item >+ my $reserve_charge = 0; >+ if (@items) { >+ foreach my $item_object (@items) { >+ my $fee = $item_object->holds_fee($patron); >+ if ( defined $fee && $fee > 0 ) { >+ $reserve_charge = $fee; >+ last; >+ } >+ } >+ } >+ $biblioloopiter{reserve_charge} = $reserve_charge; > } > > if (@reserveloop) { >@@ -807,7 +819,19 @@ unless ($multi_hold) { > > # Pass through any reserve charge for single holds > if ($borrowernumber_hold) { >- $template->param( reserve_charge => GetReserveFee( $borrowernumber_hold, $biblionumbers[0] ) ); >+ my $patron = Koha::Patrons->find($borrowernumber_hold); >+ my $reserve_charge = 0; >+ if ( $patron && $biblio ) { >+ my @items = $biblio->items->as_list; >+ foreach my $item (@items) { >+ my $fee = $item->holds_fee($patron); >+ if ( defined $fee && $fee > 0 ) { >+ $reserve_charge = $fee; >+ last; >+ } >+ } >+ } >+ $template->param( reserve_charge => $reserve_charge ); > } > } > $template->param( biblionumbers => \@biblionumbers ); >-- >2.53.0 >
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 3492
:
1356
|
1357
|
119909
|
186336
|
186337
|
186338
|
186339
|
186340
|
186361
|
186691
|
186692
|
186693
|
186694
|
186695
|
186696
|
186711
|
186712
|
186713
|
186714
|
186715
|
186716
|
188001
|
188002
|
188003
|
188004
|
188005
|
188006
|
189254
|
189255
|
189256
|
189257
|
189258
|
189259
|
190432
|
190433
|
190434
|
190435
|
190436
|
190437
|
192834
|
192835
|
192836
|
192837
|
192838
|
192839
|
192904
| 192905