From f9848a00bd680f6bedb651366e8d89b25532753e Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 9 Nov 2022 01:30:55 +0000 Subject: [PATCH] Bug 32142: Implement issued_or_reserved HoldFeeMode option Tests and test plan to come. --- C4/Reserves.pm | 12 ++++++++---- .../en/modules/admin/preferences/circulation.pref | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 6ff7149edcf..eec608d607d 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -764,19 +764,23 @@ SELECT COUNT(*) FROM reserves WHERE biblionumber=? AND borrowernumber<>? my $dbh = C4::Context->dbh; my ( $fee ) = $dbh->selectrow_array( $borquery, undef, ($borrowernumber) ); my $hold_fee_mode = C4::Context->preference('HoldFeeMode') || 'not_always'; - if( $fee and $fee > 0 and $hold_fee_mode eq 'not_always' ) { + if( $fee and $fee > 0 and ( $hold_fee_mode eq 'not_always' or $hold_fee_mode eq 'issued_or_reserved' ) ) { # This is a reconstruction of the old code: # Compare number of items with items issued, and optionally check holds - # If not all items are issued and there are no holds: charge no fee + # not_always = If not all items are issued and there are no holds: charge no fee + # issued_or_reserved = If all items are issued, OR there are holds: charge fee # NOTE: Lost, damaged, not-for-loan, etc. are just ignored here my ( $notissued, $reserved ); ( $notissued ) = $dbh->selectrow_array( $issue_qry, undef, ( $biblionumber ) ); - if( $notissued == 0 ) { + if( $notissued == 0 or $hold_fee_mode eq 'issued_or_reserved' ) { # all items are issued ( $reserved ) = $dbh->selectrow_array( $holds_qry, undef, ( $biblionumber, $borrowernumber ) ); - $fee = 0 if $reserved == 0; + if ( $reserved == 0 and $hold_fee_mode eq 'not_always' ) { + # no reserves are placed + $fee = 0; + } } else { $fee = 0; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index e025fc6e9d0..7e6ad30f799 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1124,6 +1124,7 @@ Circulation: choices: any_time_is_placed: "any time a hold is placed." not_always: "only if all items are checked out and the record has at least one hold already." + issued_or_reserved: "either if all items are checked out, or the record has at least one hold already." any_time_is_collected: "any time a hold is collected." - - pref: useDefaultReplacementCost -- 2.20.1