|
Lines 347-353
subtest "Placing holds via SIP check CanItemBeReserved" => sub {
Link Here
|
| 347 |
}; |
347 |
}; |
| 348 |
|
348 |
|
| 349 |
subtest do_checkin => sub { |
349 |
subtest do_checkin => sub { |
| 350 |
plan tests => 13; |
350 |
plan tests => 14; |
| 351 |
|
351 |
|
| 352 |
my $mockILS = Test::MockObject->new; |
352 |
my $mockILS = Test::MockObject->new; |
| 353 |
my $server = { ils => $mockILS }; |
353 |
my $server = { ils => $mockILS }; |
|
Lines 463-468
subtest do_checkin => sub {
Link Here
|
| 463 |
is( Koha::Checkouts->search( { itemnumber => $item->itemnumber } )->count, 0, ); |
463 |
is( Koha::Checkouts->search( { itemnumber => $item->itemnumber } )->count, 0, ); |
| 464 |
}; |
464 |
}; |
| 465 |
|
465 |
|
|
|
466 |
subtest 'Checkin message' => sub { |
| 467 |
plan tests => 3; |
| 468 |
my $mockILS = Test::MockObject->new; |
| 469 |
my $server = { ils => $mockILS }; |
| 470 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 471 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 472 |
my $homebranch = $builder->build( |
| 473 |
{ |
| 474 |
source => 'Branch', |
| 475 |
value => { |
| 476 |
branchcode => 'HMBR', |
| 477 |
branchname => 'Homebranch' |
| 478 |
} |
| 479 |
} |
| 480 |
); |
| 481 |
|
| 482 |
my $institution = { |
| 483 |
id => $library->id, |
| 484 |
implementation => "ILS", |
| 485 |
policy => { |
| 486 |
checkin => "true", |
| 487 |
renewal => "true", |
| 488 |
checkout => "true", |
| 489 |
timeout => 100, |
| 490 |
retries => 5, |
| 491 |
} |
| 492 |
}; |
| 493 |
my $ils = C4::SIP::ILS->new($institution); |
| 494 |
my $item = $builder->build_sample_item( |
| 495 |
{ |
| 496 |
library => $library->branchcode, |
| 497 |
homebranch => $homebranch->{'branchcode'}, |
| 498 |
location => 'My Location', |
| 499 |
permanent_location => 'My Permanent Location', |
| 500 |
} |
| 501 |
); |
| 502 |
my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 503 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 504 |
is( $circ->{screen_msg}, '', "Checkin message is not displayed when show_checkin_message is disabled" ); |
| 505 |
|
| 506 |
$server->{account}->{show_checkin_message} = 1; |
| 507 |
|
| 508 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 509 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 510 |
is( $circ->{screen_msg}, 'Item checked-in: Homebranch - My Location.', "Checkin message when show_checkin_message is enabled and UseLocationAsAQInSIP is disabled" ); |
| 511 |
|
| 512 |
t::lib::Mocks::mock_preference( 'UseLocationAsAQInSIP', '1' ); |
| 513 |
|
| 514 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
| 515 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
| 516 |
is( $circ->{screen_msg}, 'Item checked-in: My Permanent Location - My Location.', "Checkin message when both show_checkin_message and UseLocationAsAQInSIP are enabled" ); |
| 517 |
|
| 518 |
}; |
| 519 |
|
| 466 |
subtest 'Checkin with fines' => sub { |
520 |
subtest 'Checkin with fines' => sub { |
| 467 |
plan tests => 2; |
521 |
plan tests => 2; |
| 468 |
|
522 |
|
| 469 |
- |
|
|