Lines 4-10
Link Here
|
4 |
# Current state is very rudimentary. Please help to extend it! |
4 |
# Current state is very rudimentary. Please help to extend it! |
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use Test::More tests => 12; |
7 |
use Test::More tests => 13; |
8 |
|
8 |
|
9 |
use Koha::Database; |
9 |
use Koha::Database; |
10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
Lines 524-529
subtest checkin_withdrawn => sub {
Link Here
|
524 |
is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); |
524 |
is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); |
525 |
}; |
525 |
}; |
526 |
|
526 |
|
|
|
527 |
subtest _get_sort_bin => sub { |
528 |
plan tests => 4; |
529 |
|
530 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
531 |
my $branch = $library->branchcode; |
532 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
533 |
my $branch2 = $library2->branchcode; |
534 |
|
535 |
my $rules = <<"RULES"; |
536 |
$branch:homebranch:ne:\$holdingbranch:X\r |
537 |
$branch:effective_itemtype:eq:CD:0\r |
538 |
$branch:itemcallnumber:<:340:1\r |
539 |
$branch:itemcallnumber:<:370:2\r |
540 |
$branch:itemcallnumber:<:600:3\r |
541 |
$branch2:homebranch:ne:\$holdingbranch:X\r |
542 |
$branch2:effective_itemtype:eq:CD:4\r |
543 |
$branch2:itemcallnumber:>:600:5\r |
544 |
RULES |
545 |
t::lib::Mocks::mock_preference('SIP2SortBinMapping', $rules); |
546 |
|
547 |
my $item_cd = $builder->build_sample_item( |
548 |
{ |
549 |
library => $library->branchcode, |
550 |
itype => 'CD' |
551 |
} |
552 |
); |
553 |
|
554 |
my $item_book = $builder->build_sample_item( |
555 |
{ |
556 |
library => $library->branchcode, |
557 |
itype => 'BOOK', |
558 |
itemcallnumber => '200.01' |
559 |
} |
560 |
); |
561 |
|
562 |
my $bin; |
563 |
|
564 |
# Set holdingbranch as though item returned to library other than homebranch (As AddReturn would) |
565 |
$item_cd->holdingbranch($library2->branchcode)->store(); |
566 |
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_cd, $library2->branchcode ); |
567 |
is($bin, 'X', "Item parameter on RHS of comparison works (ne comparitor)"); |
568 |
|
569 |
# Reset holdingbranch as though item returned to home library |
570 |
$item_cd->holdingbranch($library->branchcode)->store(); |
571 |
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_cd, $library->branchcode ); |
572 |
is($bin, '0', "Fixed value on RHS of comparison works (eq comparitor)"); |
573 |
$bin = C4::SIP::ILS::Transaction::Checkin::_get_sort_bin( $item_book, $library->branchcode ); |
574 |
is($bin, '1', "Rules applied in order (< comparitor)"); |
575 |
$item_book->itemcallnumber('350.20')->store(); |
576 |
is($bin, '2', "Rules applied in order (< comparitor)"); |
577 |
}; |
578 |
|
527 |
subtest item_circulation_status => sub { |
579 |
subtest item_circulation_status => sub { |
528 |
plan tests => 7; |
580 |
plan tests => 7; |
529 |
|
581 |
|
530 |
- |
|
|