From 0792cb107e2ae4299f1440aea42dc2a421933d2e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 8 Sep 2025 15:41:58 +0100 Subject: [PATCH] Bug 40769: Display hold fees in staff client when placing holds This patch adds hold fee information display in the staff client's hold request interface, bringing it to feature parity with the OPAC. The OPAC already shows patrons the fee that will be charged for placing a hold, but the staff client did not display this information when staff place holds on behalf of patrons. This creates a transparency gap where staff cannot inform patrons about potential charges. Changes: - Import GetReserveFee function in reserve/request.pl - Calculate reserve charges for each biblio record - Display fee information in both single and multi-hold interfaces - Show appropriate messaging based on HoldFeeMode system preference - Use consistent formatting with currency display Test Plan: 1. Set up hold fees: - Go to Administration > Patron categories - Edit a patron category and set a "Hold fee" (e.g., 1.00) - Ensure HoldFeeMode system preference is set (default: "only if all items are checked out and the record has at least one") 2. Test single hold with fee display: - Go to a bibliographic record - Click "Place hold" - Find a patron from the category with hold fees configured - Verify fee information displays after the title: * Shows "Note: [Patron Name] will be charged a hold fee of $1.00 for placing this hold" when the HoldFeeMode is set to "any time a hold is placed" * Or "...when they collect this item" if HoldFeeMode is set to "any time a hold is collected" 3. Test multi-hold with fee display: - Ensure 'DisplayMultiPlaceHold' preference is set to 'Enable' - Search the catalog - On the search results page, select multiple biblios and click 'Place hold' - Search for the same patron - In the confirmation table, verify each record shows: * "Hold fee: $1.00 (charged when placed)" in the Information column * Or "(charged when collected)" based on HoldFeeMode 4. Test no fee display: - Repeat tests with a patron from a category with no hold fee - Verify no fee information is displayed 5. Test different HoldFeeMode settings: - Change HoldFeeMode system preference to 'any_time_is_collected' - Verify messaging changes to "when they collect this item" - Test with 'not_always' mode and verify fee only shows when appropriate 6. Verify existing functionality: - Ensure hold placement still works normally - Verify all other hold interface elements remain unchanged - Test that holds are properly placed with or without fees --- .../prog/en/modules/reserve/request.tt | 35 +++++++++++++++++++ reserve/request.pl | 12 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 1dd563e9924..994fcd83511 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -283,6 +283,17 @@ [% UNLESS ( multi_hold ) %]

Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %]by [% biblio.author | html %][% END %]

+ + [% IF ( patron && reserve_charge ) %] +
+ [% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %] + Note: [% INCLUDE 'patron-title.inc' patron = patron no_title = 1 no_cardnumber = 1 hide_patron_infos_if_needed = 1 %] will be charged a hold fee of [% reserve_charge | $Price %] when they collect this + item + [% ELSE %] + Note: [% INCLUDE 'patron-title.inc' patron = patron no_title = 1 no_cardnumber = 1 hide_patron_infos_if_needed = 1 %] will be charged a hold fee of [% reserve_charge | $Price %] for placing this hold + [% END %] +
+ [% END %] [% ELSE %]

[% IF ( patron ) %] @@ -461,6 +472,18 @@ [% IF ( biblioloo.publicationyear ) %]
  • Publication year: [% biblioloo.publicationyear | html %]
  • [% END %] + [% IF ( patron && biblioloo.reserve_charge ) %] +
  • + Hold fee: + [% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %] + [% biblioloo.reserve_charge | $Price %] + (charged when collected) + [% ELSE %] + [% biblioloo.reserve_charge | $Price %] + (charged when placed) + [% END %] +
  • + [% END %] [% IF ( biblioloo.warn ) %] @@ -1209,6 +1232,18 @@ [% IF ( biblioloo.publicationyear ) %]
  • Publication year: [% biblioloo.publicationyear | html %]
  • [% END %] + [% IF ( patron && biblioloo.reserve_charge ) %] +
  • + Hold fee: + [% IF Koha.Preference('HoldFeeMode') == 'any_time_is_collected' %] + [% biblioloo.reserve_charge | $Price %] + (charged when collected) + [% ELSE %] + [% biblioloo.reserve_charge | $Price %] + (charged when placed) + [% END %] +
  • + [% END %] [% IF ( biblioloo.warn ) %] diff --git a/reserve/request.pl b/reserve/request.pl index 8706a243aaf..1b54d9b720f 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 ); + qw( AlterPriority ToggleLowestPriority CanBookBeReserved GetMaxPatronHoldsForRecord CanItemBeReserved IsAvailableForItemLevelRequest GetReserveFee ); use C4::Items qw( get_hostitemnumbers_of ); use C4::Koha qw( getitemtypeimagelocation ); use C4::Serials qw( CountSubscriptionFromBiblionumber ); @@ -795,6 +795,11 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) $biblioloopiter{rank} = $fixedRank; $biblioloopiter{reserveloop} = \@reserveloop; + # Pass through any reserve charge + if ($patron) { + $biblioloopiter{reserve_charge} = GetReserveFee( $patron->borrowernumber, $biblionumber ); + } + if (@reserveloop) { $template->param( reserveloop => \@reserveloop ); } @@ -824,6 +829,11 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) unless ($multi_hold) { my $biblio = Koha::Biblios->find( $biblionumbers[0] ); $template->param( biblio => $biblio ); + + # Pass through any reserve charge for single holds + if ($borrowernumber_hold) { + $template->param( reserve_charge => GetReserveFee( $borrowernumber_hold, $biblionumbers[0] ) ); + } } $template->param( biblionumbers => \@biblionumbers ); -- 2.51.0