# 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;
--- /dev/null
+$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");
+}
('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'),
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:
yes: Do
use C4::Context;
-use Test::More tests => 64;
+use Test::More tests => 65;
use MARC::Record;
use C4::Biblio;
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