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

(-)a/C4/HoldsQueue.pm (+2 lines)
Lines 481-486 sub MapItemsToHoldRequests { Link Here
481
                    biblionumber   => $request->{biblionumber},
481
                    biblionumber   => $request->{biblionumber},
482
                    holdingbranch  => $items_by_itemnumber{ $request->{itemnumber} }->{holdingbranch},
482
                    holdingbranch  => $items_by_itemnumber{ $request->{itemnumber} }->{holdingbranch},
483
                    pickup_branch  => $request->{branchcode} || $request->{borrowerbranch},
483
                    pickup_branch  => $request->{branchcode} || $request->{borrowerbranch},
484
                    reserve_id     => $request->{reserve_id},
484
                    item_level     => $request->{item_level_hold},
485
                    item_level     => $request->{item_level_hold},
485
                    reservedate    => $request->{reservedate},
486
                    reservedate    => $request->{reservedate},
486
                    reservenotes   => $request->{reservenotes},
487
                    reservenotes   => $request->{reservenotes},
Lines 656-661 sub MapItemsToHoldRequests { Link Here
656
                biblionumber => $request->{biblionumber},
657
                biblionumber => $request->{biblionumber},
657
                holdingbranch => $holdingbranch,
658
                holdingbranch => $holdingbranch,
658
                pickup_branch => $pickup_branch,
659
                pickup_branch => $pickup_branch,
660
                reserve_id => $request->{reserve_id},
659
                item_level => $request->{item_level_hold},
661
                item_level => $request->{item_level_hold},
660
                reservedate => $request->{reservedate},
662
                reservedate => $request->{reservedate},
661
                reservenotes => $request->{reservenotes},
663
                reservenotes => $request->{reservenotes},
(-)a/t/db_dependent/HoldsQueue.t (-3 / +8 lines)
Lines 669-674 $reserve_id = AddReserve( Link Here
669
C4::HoldsQueue::CreateQueue();
669
C4::HoldsQueue::CreateQueue();
670
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
670
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } );
671
is( @$holds_queue, 1, "Hold where pickup branch matches home branch targeted" );
671
is( @$holds_queue, 1, "Hold where pickup branch matches home branch targeted" );
672
my $target_rs = $schema->resultset('HoldFillTarget');
673
is( $target_rs->next->reserve_id, $reserve_id, "Reserve id correctly set in hold fill target for title level hold" );
672
Koha::Holds->find( $reserve_id )->cancel;
674
Koha::Holds->find( $reserve_id )->cancel;
673
675
674
# Holding branch matches pickup branch
676
# Holding branch matches pickup branch
Lines 915-921 Koha::Holds->find( $reserve_id )->cancel; Link Here
915
917
916
918
917
subtest "Test Local Holds Priority - Bib level" => sub {
919
subtest "Test Local Holds Priority - Bib level" => sub {
918
    plan tests => 2;
920
    plan tests => 3;
919
921
920
    Koha::Biblios->delete();
922
    Koha::Biblios->delete();
921
    t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
923
    t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 );
Lines 971-976 subtest "Test Local Holds Priority - Bib level" => sub { Link Here
971
    C4::HoldsQueue::CreateQueue();
973
    C4::HoldsQueue::CreateQueue();
972
974
973
    my $queue_rs = $schema->resultset('TmpHoldsqueue');
975
    my $queue_rs = $schema->resultset('TmpHoldsqueue');
976
    my $target_rs = $schema->resultset('HoldFillTarget');
974
    is( $queue_rs->count(), 1,
977
    is( $queue_rs->count(), 1,
975
        "Hold queue contains one hold" );
978
        "Hold queue contains one hold" );
976
    is(
979
    is(
Lines 978-983 subtest "Test Local Holds Priority - Bib level" => sub { Link Here
978
        $local_patron->borrowernumber,
981
        $local_patron->borrowernumber,
979
        "We should pick the local hold over the next available"
982
        "We should pick the local hold over the next available"
980
    );
983
    );
984
    is( $target_rs->next->reserve_id, $reserve_id2, "Reserve id correctly set in hold fill target" );
981
};
985
};
982
986
983
subtest "Test Local Holds Priority - Item level" => sub {
987
subtest "Test Local Holds Priority - Item level" => sub {
Lines 1263-1269 subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue Link Here
1263
1267
1264
subtest "Item level holds info is preserved (Bug 25738)" => sub {
1268
subtest "Item level holds info is preserved (Bug 25738)" => sub {
1265
1269
1266
    plan tests => 3;
1270
    plan tests => 4;
1267
1271
1268
    $dbh->do("DELETE FROM tmp_holdsqueue");
1272
    $dbh->do("DELETE FROM tmp_holdsqueue");
1269
    $dbh->do("DELETE FROM hold_fill_targets");
1273
    $dbh->do("DELETE FROM hold_fill_targets");
Lines 1336-1341 subtest "Item level holds info is preserved (Bug 25738)" => sub { Link Here
1336
1340
1337
    my $queue_line_1 = $queue_rs->next;
1341
    my $queue_line_1 = $queue_rs->next;
1338
    is( $queue_line_1->item_level_request, 1, 'Request is correctly advertised as item-level' );
1342
    is( $queue_line_1->item_level_request, 1, 'Request is correctly advertised as item-level' );
1343
    my $target_rs = $schema->resultset('HoldFillTarget')->search({borrowernumber=>$patron_1->borrowernumber});;
1344
    is( $target_rs->next->reserve_id, $reserve_id_1, "Reserve id correctly set in hold fill target for item level hold" );
1339
1345
1340
    my $queue_line_2 = $queue_rs->next;
1346
    my $queue_line_2 = $queue_rs->next;
1341
    is( $queue_line_2->item_level_request, 0, 'Request is correctly advertised as biblio-level' );
1347
    is( $queue_line_2->item_level_request, 0, 'Request is correctly advertised as biblio-level' );
1342
- 

Return to bug 18958