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 1098-1103
subtest "Test Local Holds Priority - Item level hold over Record level hold (Bug
Link Here
|
1098 |
); |
1098 |
); |
1099 |
}; |
1099 |
}; |
1100 |
|
1100 |
|
|
|
1101 |
subtest "Test Local Holds Priority - Get correct item for item level hold" => sub { |
1102 |
plan tests => 3; |
1103 |
|
1104 |
Koha::Biblios->delete(); |
1105 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriority', 1 ); |
1106 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityPatronControl', 'PickupLibrary' ); |
1107 |
t::lib::Mocks::mock_preference( 'LocalHoldsPriorityItemControl', 'homebranch' ); |
1108 |
my $branch = $builder->build_object( { class => 'Koha::Libraries' } ); |
1109 |
my $branch2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
1110 |
my $local_patron = $builder->build_object( |
1111 |
{ |
1112 |
class => "Koha::Patrons", |
1113 |
value => { |
1114 |
branchcode => $branch->branchcode |
1115 |
} |
1116 |
} |
1117 |
); |
1118 |
my $other_patron = $builder->build_object( |
1119 |
{ |
1120 |
class => "Koha::Patrons", |
1121 |
value => { |
1122 |
branchcode => $branch2->branchcode |
1123 |
} |
1124 |
} |
1125 |
); |
1126 |
my $biblio = $builder->build_sample_biblio(); |
1127 |
|
1128 |
my $item1 = $builder->build_sample_item( |
1129 |
{ |
1130 |
biblionumber => $biblio->biblionumber, |
1131 |
library => $branch->branchcode, |
1132 |
} |
1133 |
); |
1134 |
my $item2 = $builder->build_sample_item( |
1135 |
{ |
1136 |
biblionumber => $biblio->biblionumber, |
1137 |
library => $branch->branchcode, |
1138 |
} |
1139 |
); |
1140 |
my $item3 = $builder->build_sample_item( |
1141 |
{ |
1142 |
biblionumber => $biblio->biblionumber, |
1143 |
library => $branch->branchcode, |
1144 |
} |
1145 |
); |
1146 |
|
1147 |
my $reserve_id2 = |
1148 |
AddReserve( $item2->homebranch, $local_patron->borrowernumber, |
1149 |
$biblio->biblionumber, '', 2, undef, undef, undef, undef, $item2->id, undef, undef ); |
1150 |
|
1151 |
C4::HoldsQueue::CreateQueue(); |
1152 |
|
1153 |
my $queue_rs = $schema->resultset('TmpHoldsqueue'); |
1154 |
my $q = $queue_rs->next; |
1155 |
is( $queue_rs->count(), 1, |
1156 |
"Hold queue contains one hold" ); |
1157 |
is( |
1158 |
$q->borrowernumber, |
1159 |
$local_patron->borrowernumber, |
1160 |
"We should pick the local hold over the next available" |
1161 |
); |
1162 |
is( $q->itemnumber->id, $item2->id, "Got the correct item for item level local holds priority" ); |
1163 |
}; |
1164 |
|
1101 |
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue (Bug 18001)" => sub { |
1165 |
subtest "Test Local Holds Priority - Ensure no duplicate requests in holds queue (Bug 18001)" => sub { |
1102 |
plan tests => 1; |
1166 |
plan tests => 1; |
1103 |
|
1167 |
|
1104 |
- |
|
|