Lines 334-341
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 => 12; |
337 |
plan tests => 13; |
338 |
|
338 |
|
|
|
339 |
my $mockILS = Test::MockObject->new; |
340 |
my $server = { ils => $mockILS }; |
339 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
341 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
340 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
342 |
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); |
341 |
my $patron = $builder->build_object( |
343 |
my $patron = $builder->build_object( |
Lines 437-447
subtest do_checkin => sub {
Link Here
|
437 |
is( $hold->itemnumber, $item->itemnumber, ); |
439 |
is( $hold->itemnumber, $item->itemnumber, ); |
438 |
is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); |
440 |
is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, ); |
439 |
}; |
441 |
}; |
|
|
442 |
|
443 |
subtest 'Checkin with fines' => sub { |
444 |
plan tests => 2; |
445 |
|
446 |
my $mockILS = Test::MockObject->new; |
447 |
my $server = { ils => $mockILS }; |
448 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
449 |
my $institution = { |
450 |
id => $library->id, |
451 |
implementation => "ILS", |
452 |
policy => { |
453 |
checkin => "true", |
454 |
renewal => "true", |
455 |
checkout => "true", |
456 |
timeout => 100, |
457 |
retries => 5, |
458 |
} |
459 |
}; |
460 |
my $ils = C4::SIP::ILS->new($institution); |
461 |
my $item = $builder->build_sample_item( |
462 |
{ |
463 |
library => $library->branchcode, |
464 |
} |
465 |
); |
466 |
|
467 |
# show_outstanding_amount disabled |
468 |
my $patron = $builder->build_object( |
469 |
{ |
470 |
class => 'Koha::Patrons', |
471 |
value => { |
472 |
branchcode => $library->branchcode, |
473 |
} |
474 |
} |
475 |
); |
476 |
my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
477 |
my $fee1 = $builder->build( |
478 |
{ |
479 |
source => 'Accountline', |
480 |
value => { |
481 |
borrowernumber => $patron->borrowernumber, |
482 |
amountoutstanding => 12, |
483 |
debit_type_code => 'OVERDUE', |
484 |
itemnumber => $item->itemnumber |
485 |
} |
486 |
} |
487 |
); |
488 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
489 |
is( $circ->{screen_msg}, '', "The fine is not displayed on checkin when show_outstanding_amount is disabled" ); |
490 |
|
491 |
# show_outstanding_amount enabled |
492 |
$patron = $builder->build_object( |
493 |
{ |
494 |
class => 'Koha::Patrons', |
495 |
value => { |
496 |
branchcode => $library->branchcode, |
497 |
} |
498 |
} |
499 |
); |
500 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
501 |
|
502 |
$fee1 = $builder->build( |
503 |
{ |
504 |
source => 'Accountline', |
505 |
value => { |
506 |
borrowernumber => $patron->borrowernumber, |
507 |
amountoutstanding => 12, |
508 |
debit_type_code => 'OVERDUE', |
509 |
itemnumber => $item->itemnumber |
510 |
} |
511 |
} |
512 |
); |
513 |
|
514 |
$server->{account}->{show_outstanding_amount} = 1; |
515 |
$circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
516 |
|
517 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} ); |
518 |
is( $circ->{screen_msg}, 'You owe $12.00 for this item.', "The fine is displayed on checkin when show_outstanding_amount is enabled" ); |
519 |
|
520 |
}; |
440 |
}; |
521 |
}; |
441 |
|
522 |
|
442 |
subtest do_checkout_with_patron_blocked => sub { |
523 |
subtest do_checkout_with_patron_blocked => sub { |
443 |
plan tests => 4; |
524 |
plan tests => 5; |
444 |
|
525 |
|
|
|
526 |
my $mockILS = Test::MockObject->new; |
527 |
my $server = { ils => $mockILS }; |
445 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
528 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
446 |
my $institution = { |
529 |
my $institution = { |
447 |
id => $library->id, |
530 |
id => $library->id, |
Lines 492-500
subtest do_checkout_with_patron_blocked => sub {
Link Here
|
492 |
); |
575 |
); |
493 |
|
576 |
|
494 |
my $fines_sip_patron = C4::SIP::ILS::Patron->new( $fines_patron->cardnumber ); |
577 |
my $fines_sip_patron = C4::SIP::ILS::Patron->new( $fines_patron->cardnumber ); |
495 |
$circ = $ils->checkout($fines_patron->cardnumber, $item->barcode); |
578 |
|
|
|
579 |
$circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
496 |
is( $circ->{screen_msg}, 'Patron has fines', "Got correct fines screen message" ); |
580 |
is( $circ->{screen_msg}, 'Patron has fines', "Got correct fines screen message" ); |
497 |
|
581 |
|
|
|
582 |
$server->{account}->{show_outstanding_amount} = 1; |
583 |
$circ = $ils->checkout($fines_patron->cardnumber, $item->barcode, undef, undef, $server->{account}); |
584 |
is( $circ->{screen_msg}, 'Patron has fines - You owe $10.00.', "Got correct fines with amount screen message" ); |
498 |
my $debarred_patron = $builder->build_object( |
585 |
my $debarred_patron = $builder->build_object( |
499 |
{ |
586 |
{ |
500 |
class => 'Koha::Patrons', |
587 |
class => 'Koha::Patrons', |
501 |
- |
|
|