Lines 8-14
Link Here
|
8 |
|
8 |
|
9 |
use Modern::Perl; |
9 |
use Modern::Perl; |
10 |
|
10 |
|
11 |
use Test::More tests => 53; |
11 |
use Test::More tests => 54; |
12 |
use Data::Dumper; |
12 |
use Data::Dumper; |
13 |
|
13 |
|
14 |
use C4::Calendar; |
14 |
use C4::Calendar; |
Lines 662-667
$reserve_id = AddReserve(
Link Here
|
662 |
C4::HoldsQueue::CreateQueue(); |
662 |
C4::HoldsQueue::CreateQueue(); |
663 |
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } ); |
663 |
$holds_queue = $dbh->selectall_arrayref( "SELECT * FROM tmp_holdsqueue", { Slice => {} } ); |
664 |
is( @$holds_queue, 1, "Hold where pickup branch matches home branch targeted" ); |
664 |
is( @$holds_queue, 1, "Hold where pickup branch matches home branch targeted" ); |
|
|
665 |
my $target_rs = $schema->resultset('HoldFillTarget'); |
666 |
is( $target_rs->next->reserve_id, $reserve_id, "Reserve id correctly set in hold fill target for title level hold" ); |
665 |
Koha::Holds->find( $reserve_id )->cancel; |
667 |
Koha::Holds->find( $reserve_id )->cancel; |
666 |
|
668 |
|
667 |
# Holding branch matches pickup branch |
669 |
# Holding branch matches pickup branch |
Lines 908-914
Koha::Holds->find( $reserve_id )->cancel;
Link Here
|
908 |
|
910 |
|
909 |
|
911 |
|
910 |
subtest "Test Local Holds Priority - Bib level" => sub { |
912 |
subtest "Test Local Holds Priority - Bib level" => sub { |
911 |
plan tests => 2; |
913 |
plan tests => 3; |
912 |
|
914 |
|
913 |
Koha::Biblios->delete(); |
915 |
Koha::Biblios->delete(); |
914 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 ); |
916 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 ); |
Lines 960-965
subtest "Test Local Holds Priority - Bib level" => sub {
Link Here
|
960 |
C4::HoldsQueue::CreateQueue(); |
962 |
C4::HoldsQueue::CreateQueue(); |
961 |
|
963 |
|
962 |
my $queue_rs = $schema->resultset('TmpHoldsqueue'); |
964 |
my $queue_rs = $schema->resultset('TmpHoldsqueue'); |
|
|
965 |
my $target_rs = $schema->resultset('HoldFillTarget'); |
963 |
is( $queue_rs->count(), 1, |
966 |
is( $queue_rs->count(), 1, |
964 |
"Hold queue contains one hold" ); |
967 |
"Hold queue contains one hold" ); |
965 |
is( |
968 |
is( |
Lines 967-972
subtest "Test Local Holds Priority - Bib level" => sub {
Link Here
|
967 |
$local_patron->borrowernumber, |
970 |
$local_patron->borrowernumber, |
968 |
"We should pick the local hold over the next available" |
971 |
"We should pick the local hold over the next available" |
969 |
); |
972 |
); |
|
|
973 |
is( $target_rs->next->reserve_id, $reserve_id2, "Reserve id correctly set in hold fill target" ); |
970 |
}; |
974 |
}; |
971 |
|
975 |
|
972 |
subtest "Test Local Holds Priority - Item level" => sub { |
976 |
subtest "Test Local Holds Priority - Item level" => sub { |
Lines 1233-1239
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue
Link Here
|
1233 |
|
1237 |
|
1234 |
subtest "Item level holds info is preserved (Bug 25738)" => sub { |
1238 |
subtest "Item level holds info is preserved (Bug 25738)" => sub { |
1235 |
|
1239 |
|
1236 |
plan tests => 3; |
1240 |
plan tests => 4; |
1237 |
|
1241 |
|
1238 |
$dbh->do("DELETE FROM tmp_holdsqueue"); |
1242 |
$dbh->do("DELETE FROM tmp_holdsqueue"); |
1239 |
$dbh->do("DELETE FROM hold_fill_targets"); |
1243 |
$dbh->do("DELETE FROM hold_fill_targets"); |
Lines 1301-1306
subtest "Item level holds info is preserved (Bug 25738)" => sub {
Link Here
|
1301 |
|
1305 |
|
1302 |
my $queue_line_1 = $queue_rs->next; |
1306 |
my $queue_line_1 = $queue_rs->next; |
1303 |
is( $queue_line_1->item_level_request, 1, 'Request is correctly advertised as item-level' ); |
1307 |
is( $queue_line_1->item_level_request, 1, 'Request is correctly advertised as item-level' ); |
|
|
1308 |
my $target_rs = $schema->resultset('HoldFillTarget')->search({borrowernumber=>$patron_1->borrowernumber});; |
1309 |
is( $target_rs->next->reserve_id, $reserve_id_1, "Reserve id correctly set in hold fill target for item level hold" ); |
1304 |
|
1310 |
|
1305 |
my $queue_line_2 = $queue_rs->next; |
1311 |
my $queue_line_2 = $queue_rs->next; |
1306 |
is( $queue_line_2->item_level_request, 0, 'Request is correctly advertised as biblio-level' ); |
1312 |
is( $queue_line_2->item_level_request, 0, 'Request is correctly advertised as biblio-level' ); |
1307 |
- |
|
|