View | Details | Raw Unified | Return to bug 25184
Collapse All | Expand All

(-)a/C4/Reserves.pm (-1 / +4 lines)
Lines 793-799 sub CheckReserves { Link Here
793
    return unless $itemnumber; # bail if we got nothing.
793
    return unless $itemnumber; # bail if we got nothing.
794
    # if item is not for loan it cannot be reserved either.....
794
    # if item is not for loan it cannot be reserved either.....
795
    # except where items.notforloan < 0 :  This indicates the item is holdable.
795
    # except where items.notforloan < 0 :  This indicates the item is holdable.
796
    return if $notforloan_per_item or $notforloan_per_itemtype;
796
797
    my $dont_trap = C4::Context->preference('TrapHoldsOnOrder') ? ($notforloan_per_item > 0) : ($notforloan_per_item && 1 );
798
    return if $dont_trap or $notforloan_per_itemtype;
797
799
798
    # Find this item in the reserves
800
    # Find this item in the reserves
799
    my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers);
801
    my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber, $lookahead_days, $ignore_borrowers);
Lines 803-808 sub CheckReserves { Link Here
803
    # the more important the item.)
805
    # the more important the item.)
804
    # $highest is the most important item we've seen so far.
806
    # $highest is the most important item we've seen so far.
805
    my $highest;
807
    my $highest;
808
806
    if (scalar @reserves) {
809
    if (scalar @reserves) {
807
        my $LocalHoldsPriority = C4::Context->preference('LocalHoldsPriority');
810
        my $LocalHoldsPriority = C4::Context->preference('LocalHoldsPriority');
808
        my $LocalHoldsPriorityPatronControl = C4::Context->preference('LocalHoldsPriorityPatronControl');
811
        my $LocalHoldsPriorityPatronControl = C4::Context->preference('LocalHoldsPriorityPatronControl');
(-)a/installer/data/mysql/atomicupdate/bug_25184.perl (+11 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
4
    $dbh->do(q{
5
        INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
6
        ('TrapHoldsOnOrder','1',NULL,'If enabled, Koha will trap holds for on order items ( notforloan < 0 )','YesNo't c)
7
    });
8
9
    # Always end with this (adjust the bug info)
10
    NewVersion( $DBversion, 25184, "Items with a negative notforloan status should not be captured for holds");
11
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 652-657 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
652
('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
652
('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
653
('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'),
653
('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'),
654
('TranslateNotices','0',NULL, 'Allow notices to be translated','YesNo'),
654
('TranslateNotices','0',NULL, 'Allow notices to be translated','YesNo'),
655
('TrapHoldsOnOrder','1',NULL,'If enabled, Koha will trap holds for on order items ( notforloan < 0 )','YesNo'),
655
('UNIMARCAuthorityField100','afrey50      ba0',NULL,'Define the contents of UNIMARC authority control field 100 position 08-35','Textarea'),
656
('UNIMARCAuthorityField100','afrey50      ba0',NULL,'Define the contents of UNIMARC authority control field 100 position 08-35','Textarea'),
656
('UNIMARCAuthorsFacetsSeparator',', ',NULL,'UNIMARC authors facets separator','short'),
657
('UNIMARCAuthorsFacetsSeparator',', ',NULL,'UNIMARC authors facets separator','short'),
657
('UNIMARCField100Language','fre',NULL,'UNIMARC field 100 default language','short'),
658
('UNIMARCField100Language','fre',NULL,'UNIMARC field 100 default language','short'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 514-519 Circulation: Link Here
514
            - "<br />itype: [NEWBK,\"\"]"
514
            - "<br />itype: [NEWBK,\"\"]"
515
            - "<br /> Note: the word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
515
            - "<br /> Note: the word 'NULL' can be used to block renewal on undefined fields, while an empty string \"\" will block on an empty (but defined) field."
516
    Checkin policy:
516
    Checkin policy:
517
        -
518
            - pref: TrapHoldsOnOrder
519
              choices:
520
                  yes: Trap
521
                  no: "Don't trap"
522
            - items that are not for loan but holdable ( notforloan < 0 ) to fill holds.
517
        -
523
        -
518
            - pref: HoldsAutoFill
524
            - pref: HoldsAutoFill
519
              choices:
525
              choices:
(-)a/t/db_dependent/Holds.t (-2 / +8 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 63;
10
use Test::More tests => 64;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 345-350 ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged', Link Here
345
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
345
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
346
346
347
# Items that are not for loan, but holdable should not be trapped until they are available for loan
347
# Items that are not for loan, but holdable should not be trapped until they are available for loan
348
t::lib::Mocks::mock_preference( 'TrapHoldsOnOrder', 0 );
348
Koha::Items->find($itemnumber)->damaged(0)->notforloan(-1)->store;
349
Koha::Items->find($itemnumber)->damaged(0)->notforloan(-1)->store;
349
Koha::Holds->search({ biblionumber => $biblio->id })->delete();
350
Koha::Holds->search({ biblionumber => $biblio->id })->delete();
350
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can place hold on item that is not for loan but holdable ( notforloan < 0 )" );
351
is( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status}, 'OK', "Patron can place hold on item that is not for loan but holdable ( notforloan < 0 )" );
Lines 353-361 $hold = Koha::Hold->new( Link Here
353
        borrowernumber => $borrowernumbers[0],
354
        borrowernumber => $borrowernumbers[0],
354
        itemnumber     => $itemnumber,
355
        itemnumber     => $itemnumber,
355
        biblionumber   => $biblio->biblionumber,
356
        biblionumber   => $biblio->biblionumber,
357
        found          => undef,
358
        priority       => 1,
359
        reservedate    => dt_from_string,
360
        branchcode     => $branch_1,
356
    }
361
    }
357
)->store();
362
)->store();
358
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item that is not for loan but holdable ( notforloan < 0 )" );
363
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for item that is not for loan but holdable ( notforloan < 0 )" );
364
t::lib::Mocks::mock_preference( 'TrapHoldsOnOrder', 1 );
365
ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold is trapped for item that is not for loan but holdable ( notforloan < 0 )" );
359
$hold->delete();
366
$hold->delete();
360
367
361
# Regression test for bug 9532
368
# Regression test for bug 9532
362
- 

Return to bug 25184