|
Lines 334-340
subtest "Placing holds via SIP check CanItemBeReserved" => sub {
Link Here
|
| 334 |
}; |
334 |
}; |
| 335 |
|
335 |
|
| 336 |
subtest do_checkin => sub { |
336 |
subtest do_checkin => sub { |
| 337 |
plan tests => 13; |
337 |
plan tests => 14; |
| 338 |
|
338 |
|
| 339 |
my $mockILS = Test::MockObject->new; |
339 |
my $mockILS = Test::MockObject->new; |
| 340 |
my $server = { ils => $mockILS }; |
340 |
my $server = { ils => $mockILS }; |
|
Lines 440-445
subtest do_checkin => sub {
Link Here
|
| 440 |
is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); |
440 |
is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); |
| 441 |
}; |
441 |
}; |
| 442 |
|
442 |
|
|
|
443 |
subtest 'Checkin message' => sub { |
| 444 |
plan tests => 3; |
| 445 |
my $mockILS = Test::MockObject->new; |
| 446 |
my $server = { ils => $mockILS }; |
| 447 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 448 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 449 |
my $homebranch = $builder->build( |
| 450 |
{ |
| 451 |
source => 'Branch', |
| 452 |
value => { |
| 453 |
branchcode => 'HMBR', |
| 454 |
branchname => 'Homebranch' |
| 455 |
} |
| 456 |
} |
| 457 |
); |
| 458 |
|
| 459 |
my $institution = { |
| 460 |
id => $library->id, |
| 461 |
implementation => "ILS", |
| 462 |
policy => { |
| 463 |
checkin => "true", |
| 464 |
renewal => "true", |
| 465 |
checkout => "true", |
| 466 |
timeout => 100, |
| 467 |
retries => 5, |
| 468 |
} |
| 469 |
}; |
| 470 |
my $ils = C4::SIP::ILS->new($institution); |
| 471 |
my $item = $builder->build_sample_item( |
| 472 |
{ |
| 473 |
library => $library->branchcode, |
| 474 |
homebranch => $homebranch->{'branchcode'}, |
| 475 |
location => 'My Location', |
| 476 |
permanent_location => 'My Permanent Location', |
| 477 |
} |
| 478 |
); |
| 479 |
my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 480 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 481 |
is( $circ->{screen_msg}, '', "Checkin message is not displayed when show_checkin_message is disabled" ); |
| 482 |
|
| 483 |
$server->{account}->{show_checkin_message} = 1; |
| 484 |
|
| 485 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 486 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 487 |
is( $circ->{screen_msg}, 'Item checked-in: Homebranch - My Location.', "Checkin message when show_checkin_message is enabled and UseLocationAsAQInSIP is disabled" ); |
| 488 |
|
| 489 |
t::lib::Mocks::mock_preference( 'UseLocationAsAQInSIP', '1' ); |
| 490 |
|
| 491 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 492 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 493 |
is( $circ->{screen_msg}, 'Item checked-in: My Permanent Location - My Location.', "Checkin message when both show_checkin_message and UseLocationAsAQInSIP are enabled" ); |
| 494 |
|
| 495 |
}; |
| 496 |
|
| 443 |
subtest 'Checkin with fines' => sub { |
497 |
subtest 'Checkin with fines' => sub { |
| 444 |
plan tests => 2; |
498 |
plan tests => 2; |
| 445 |
|
499 |
|
| 446 |
- |
|
|