Lines 1135-1141
subtest 'reserves.item_level_hold' => sub {
Link Here
|
1135 |
|
1135 |
|
1136 |
subtest 'MoveReserve additional test' => sub { |
1136 |
subtest 'MoveReserve additional test' => sub { |
1137 |
|
1137 |
|
1138 |
plan tests => 4; |
1138 |
plan tests => 8; |
1139 |
|
1139 |
|
1140 |
# Create the items and patrons we need |
1140 |
# Create the items and patrons we need |
1141 |
my $biblio = $builder->build_sample_biblio(); |
1141 |
my $biblio = $builder->build_sample_biblio(); |
Lines 1175-1181
subtest 'MoveReserve additional test' => sub {
Link Here
|
1175 |
( $patron_1->borrowernumber, $biblio->biblionumber, $item_1->itemnumber, $item_1->homebranch, 0, $reserve_1 ) |
1175 |
( $patron_1->borrowernumber, $biblio->biblionumber, $item_1->itemnumber, $item_1->homebranch, 0, $reserve_1 ) |
1176 |
); |
1176 |
); |
1177 |
|
1177 |
|
1178 |
# The 2nd hold should be filed even if the item is preselected for the first hold |
1178 |
# The 2nd hold should be filled even if the item is preselected for the first hold |
1179 |
MoveReserve( $item_1->itemnumber, $patron_2->borrowernumber ); |
1179 |
MoveReserve( $item_1->itemnumber, $patron_2->borrowernumber ); |
1180 |
is( $patron_2->holds->count, 0, "The 2nd patrons no longer has a hold" ); |
1180 |
is( $patron_2->holds->count, 0, "The 2nd patrons no longer has a hold" ); |
1181 |
is( |
1181 |
is( |
Lines 1183-1188
subtest 'MoveReserve additional test' => sub {
Link Here
|
1183 |
"The 2nd patrons hold was filled and moved to old holds" |
1183 |
"The 2nd patrons hold was filled and moved to old holds" |
1184 |
); |
1184 |
); |
1185 |
|
1185 |
|
|
|
1186 |
my $reserve_3 = AddReserve( |
1187 |
{ |
1188 |
branchcode => $item_2->homebranch, |
1189 |
borrowernumber => $patron_2->borrowernumber, |
1190 |
biblionumber => $biblio->biblionumber, |
1191 |
priority => 1, |
1192 |
itemnumber => $item_2->itemnumber, |
1193 |
} |
1194 |
); |
1195 |
|
1196 |
# The 3rd hold should not be filled as it is an item level hold on a different item |
1197 |
MoveReserve( $item_1->itemnumber, $patron_2->borrowernumber ); |
1198 |
is( $patron_2->holds->count, 1, "The 2nd patron still has a hold" ); |
1199 |
is( $patron_2->old_holds->count, 1, "The 2nd patron has only 1 old holds" ); |
1200 |
|
1201 |
my $hold_3 = Koha::Holds->find($reserve_3); |
1202 |
$hold_3->item_level_hold(0)->store(); |
1203 |
|
1204 |
# The 3rd hold should now be filled as it is a title level hold, even though associated with a different item |
1205 |
MoveReserve( $item_1->itemnumber, $patron_2->borrowernumber ); |
1206 |
is( $patron_2->holds->count, 0, "The 2nd patron no longer has a hold" ); |
1207 |
is( $patron_2->old_holds->count(), 2, "The 2nd patron's hold was filled and moved to old holds" ); |
1208 |
|
1186 |
}; |
1209 |
}; |
1187 |
|
1210 |
|
1188 |
subtest 'RevertWaitingStatus' => sub { |
1211 |
subtest 'RevertWaitingStatus' => sub { |
1189 |
- |
|
|