@@ -, +, @@ notforloan value you used in step 3 --- C4/Reserves.pm | 3 +++ installer/data/mysql/atomicupdate/bug_25232.perl | 11 +++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/circulation.pref | 5 +++++ t/db_dependent/Holds.t | 4 +++- 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25232.perl --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -794,6 +794,9 @@ sub CheckReserves { # if item is not for loan it cannot be reserved either..... # except where items.notforloan < 0 : This indicates the item is holdable. + my $SkipHoldTrapOnNotForLoanValue = C4::Context->preference('SkipHoldTrapOnNotForLoanValue'); + return if $SkipHoldTrapOnNotForLoanValue && $notforloan_per_item eq $SkipHoldTrapOnNotForLoanValue; + my $dont_trap = C4::Context->preference('TrapHoldsOnOrder') ? ($notforloan_per_item > 0) : ($notforloan_per_item && 1 ); return if $dont_trap or $notforloan_per_itemtype; --- a/installer/data/mysql/atomicupdate/bug_25232.perl +++ a/installer/data/mysql/atomicupdate/bug_25232.perl @@ -0,0 +1,11 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" ); + $dbh->do(q{ + INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('SkipHoldTrapOnNotForLoanValue','',NULL,'If set, Koha will never trap items for hold with this notforloan value','Integer') + }); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 25184, "Items with a negative notforloan status should not be captured for holds"); +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -587,6 +587,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'), ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'), ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), +('SkipHoldTrapOnNotForLoanValue','',NULL,'If set, Koha will never trap items for hold with this notforloan value','Integer'), ('SlipCSS','',NULL,'Slips CSS url.','free'), ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'), ('SMSSendPassword', '', '', 'Password used to send SMS messages', 'free'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -526,6 +526,11 @@ Circulation: yes: Trap no: "Don't trap" - items that are not for loan but holdable ( notforloan < 0 ) to fill holds. + - + - Never trap items with a 'not for loan' value of + - pref: SkipHoldTrapOnNotForLoanValue + class: integer + - to fill holds. - - pref: HoldsAutoFill choices: --- a/t/db_dependent/Holds.t +++ a/t/db_dependent/Holds.t @@ -7,7 +7,7 @@ use t::lib::TestBuilder; use C4::Context; -use Test::More tests => 64; +use Test::More tests => 65; use MARC::Record; use C4::Biblio; @@ -363,6 +363,8 @@ $hold = Koha::Hold->new( ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item that is not for loan but holdable ( notforloan < 0 )" ); t::lib::Mocks::mock_preference( 'TrapHoldsOnOrder', 1 ); ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold is trapped for item that is not for loan but holdable ( notforloan < 0 )" ); +t::lib::Mocks::mock_preference( 'SkipHoldTrapOnNotForLoanValue', '-1' ); +ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item with notforloan value matching SkipHoldTrapOnNotForLoanValue" ); $hold->delete(); # Regression test for bug 9532 --