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

(-)a/C4/HoldsQueue.pm (+2 lines)
Lines 409-414 sub MapItemsToHoldRequests { Link Here
409
                  || ( $item->{holdallowed} == 1
409
                  || ( $item->{holdallowed} == 1
410
                    && $item->{homebranch} ne $request->{borrowerbranch} );
410
                    && $item->{homebranch} ne $request->{borrowerbranch} );
411
411
412
                next if $request->{itemnumber} && $request->{itemnumber} != $item->{itemnumber};
413
412
                next unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } );
414
                next unless $item->{_object}->can_be_transferred( { to => $libraries->{ $request->{branchcode} } } );
413
415
414
                my $local_holds_priority_item_branchcode =
416
                my $local_holds_priority_item_branchcode =
(-)a/t/db_dependent/HoldsQueue.t (-2 / +65 lines)
Lines 8-14 Link Here
8
8
9
use Modern::Perl;
9
use Modern::Perl;
10
10
11
use Test::More tests => 51;
11
use Test::More tests => 52;
12
use Data::Dumper;
12
use Data::Dumper;
13
13
14
use C4::Calendar;
14
use C4::Calendar;
Lines 952-957 subtest "Test Local Holds Priority - Item level hold over Record level hold (Bug Link Here
952
    );
952
    );
953
};
953
};
954
954
955
subtest "Test Local Holds Priority - Get correct item for item level hold" => sub {
956
    plan tests => 3;
957
958
    Koha::Biblios->delete();
959
    t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
960
    t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' );
961
    t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' );
962
    my $branch  = $builder->build_object( { class => 'Koha::Libraries' } );
963
    my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } );
964
    my $local_patron = $builder->build_object(
965
        {
966
            class => "Koha::Patrons",
967
            value => {
968
                branchcode => $branch->branchcode
969
            }
970
        }
971
    );
972
    my $other_patron = $builder->build_object(
973
        {
974
            class => "Koha::Patrons",
975
            value => {
976
                branchcode => $branch2->branchcode
977
            }
978
        }
979
    );
980
    my $biblio = $builder->build_sample_biblio();
981
982
    my $item1 = $builder->build_sample_item(
983
        {
984
            biblionumber  => $biblio->biblionumber,
985
            library    => $branch->branchcode,
986
        }
987
    );
988
    my $item2 = $builder->build_sample_item(
989
        {
990
            biblionumber  => $biblio->biblionumber,
991
            library    => $branch->branchcode,
992
        }
993
    );
994
    my $item3 = $builder->build_sample_item(
995
        {
996
            biblionumber  => $biblio->biblionumber,
997
            library    => $branch->branchcode,
998
        }
999
    );
1000
1001
    my $reserve_id2 =
1002
        AddReserve( $item2->homebranch, $local_patron->borrowernumber,
1003
            $biblio->biblionumber, '', 2, undef, undef, undef, undef, $item2->id, undef, undef );
1004
1005
    C4::HoldsQueue::CreateQueue();
1006
1007
    my $queue_rs = $schema->resultset('TmpHoldsqueue');
1008
    my $q = $queue_rs->next;
1009
    is( $queue_rs->count(), 1,
1010
        "Hold queue contains one hold" );
1011
    is(
1012
        $q->borrowernumber,
1013
        $local_patron->borrowernumber,
1014
        "We should pick the local hold over the next available"
1015
    );
1016
    is( $q->itemnumber->id, $item2->id, "Got the correct item for item level local holds priority" );
1017
};
1018
955
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue (Bug 18001)" => sub {
1019
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue (Bug 18001)" => sub {
956
    plan tests => 1;
1020
    plan tests => 1;
957
1021
958
- 

Return to bug 25786