|
Lines 410-416
subtest 'Desks' => sub {
Link Here
|
| 410 |
}; |
410 |
}; |
| 411 |
|
411 |
|
| 412 |
subtest 'get_items_that_can_fill' => sub { |
412 |
subtest 'get_items_that_can_fill' => sub { |
| 413 |
plan tests => 2; |
413 |
plan tests => 3; |
| 414 |
|
414 |
|
| 415 |
my $biblio = $builder->build_sample_biblio; |
415 |
my $biblio = $builder->build_sample_biblio; |
| 416 |
my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4 |
416 |
my $itype_1 = $builder->build_object({ class => 'Koha::ItemTypes' }); # For 1, 2, 3, 4 |
|
Lines 442-453
subtest 'get_items_that_can_fill' => sub {
Link Here
|
| 442 |
} |
442 |
} |
| 443 |
); |
443 |
); |
| 444 |
|
444 |
|
|
|
445 |
my $holds = Koha::Holds->search({ reserve_id => $reserve_id_1 }); |
| 446 |
my $items = $holds->get_items_that_can_fill; |
| 447 |
is_deeply( [ map { $_->itemnumber } $items->as_list ], [ $item_1->itemnumber ], 'Item level hold can only be filled by the specific item'); |
| 448 |
|
| 445 |
my $reserve_id_2 = C4::Reserves::AddReserve( |
449 |
my $reserve_id_2 = C4::Reserves::AddReserve( |
| 446 |
{ |
450 |
{ |
| 447 |
borrowernumber => $patron_2->borrowernumber, |
451 |
borrowernumber => $patron_2->borrowernumber, |
| 448 |
biblionumber => $biblio->biblionumber, |
452 |
biblionumber => $biblio->biblionumber, |
| 449 |
priority => 2, |
453 |
priority => 2, |
| 450 |
itemnumber => $item_1->itemnumber, |
454 |
branchcode => $item_1->homebranch, |
| 451 |
} |
455 |
} |
| 452 |
); |
456 |
); |
| 453 |
|
457 |
|
|
Lines 476-488
subtest 'get_items_that_can_fill' => sub {
Link Here
|
| 476 |
} |
480 |
} |
| 477 |
)->store; |
481 |
)->store; |
| 478 |
|
482 |
|
| 479 |
my $holds = Koha::Holds->search( |
483 |
$holds = Koha::Holds->search( |
| 480 |
{ |
484 |
{ |
| 481 |
reserve_id => [ $reserve_id_1, $reserve_id_2, $waiting_reserve_id, ] |
485 |
reserve_id => [ $reserve_id_1, $reserve_id_2, $waiting_reserve_id, ] |
| 482 |
} |
486 |
} |
| 483 |
); |
487 |
); |
| 484 |
|
488 |
|
| 485 |
my $items = $holds->get_items_that_can_fill; |
489 |
$items = $holds->get_items_that_can_fill; |
| 486 |
is_deeply( [ map { $_->itemnumber } $items->as_list ], |
490 |
is_deeply( [ map { $_->itemnumber } $items->as_list ], |
| 487 |
[ $item_2->itemnumber, $item_5->itemnumber ], 'Only item 2 and 5 are available for filling the hold' ); |
491 |
[ $item_2->itemnumber, $item_5->itemnumber ], 'Only item 2 and 5 are available for filling the hold' ); |
| 488 |
|
492 |
|
|
Lines 496-502
subtest 'get_items_that_can_fill' => sub {
Link Here
|
| 496 |
)->store; |
500 |
)->store; |
| 497 |
$items = $holds->get_items_that_can_fill; |
501 |
$items = $holds->get_items_that_can_fill; |
| 498 |
is_deeply( [ map { $_->itemnumber } $items->as_list ], |
502 |
is_deeply( [ map { $_->itemnumber } $items->as_list ], |
| 499 |
[ $item_2->itemnumber ], 'Only item 1 is available for filling the hold' ); |
503 |
[ $item_2->itemnumber ], 'Only item 2 is available for filling the hold' ); |
| 500 |
|
504 |
|
| 501 |
}; |
505 |
}; |
| 502 |
|
506 |
|
| 503 |
- |
|
|