Lines 300-306
subtest 'LookupPatron test' => sub {
Link Here
|
300 |
|
300 |
|
301 |
subtest 'Holds test' => sub { |
301 |
subtest 'Holds test' => sub { |
302 |
|
302 |
|
303 |
plan tests => 5; |
303 |
plan tests => 7; |
304 |
|
304 |
|
305 |
$schema->storage->txn_begin; |
305 |
$schema->storage->txn_begin; |
306 |
|
306 |
|
Lines 417-422
subtest 'Holds test' => sub {
Link Here
|
417 |
source => 'Item', |
417 |
source => 'Item', |
418 |
value => { |
418 |
value => { |
419 |
biblionumber => $biblio3->{biblionumber}, |
419 |
biblionumber => $biblio3->{biblionumber}, |
|
|
420 |
barcode => '123456789', |
420 |
damaged => 0, |
421 |
damaged => 0, |
421 |
itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype, |
422 |
itype => $builder->build_object({ class => 'Koha::ItemTypes' })->itemtype, |
422 |
} |
423 |
} |
Lines 449-454
subtest 'Holds test' => sub {
Link Here
|
449 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
450 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
450 |
is( $reply->{code}, 'damaged', "Item is damaged" ); |
451 |
is( $reply->{code}, 'damaged', "Item is damaged" ); |
451 |
|
452 |
|
|
|
453 |
$patron = $builder->build_object({ class => 'Koha::Patrons' }); |
454 |
my $module = new Test::MockModule('C4::Context'); |
455 |
$module->mock('userenv', sub { { patron => $patron } }); |
456 |
my $date_due = Koha::DateUtils::dt_from_string()->add(weeks => 2); |
457 |
my $issue = C4::Circulation::AddIssue($patron->unblessed, $item3->{barcode}, $date_due); |
458 |
t::lib::Mocks::mock_preference( 'AllowHoldsOnPatronsPossessions', '0' ); |
459 |
|
460 |
$query->param( 'patron_id', $patron->borrowernumber); |
461 |
$query->param( 'bib_id', $biblio3->{biblionumber}); |
462 |
$query->param( 'item_id', $item3->{itemnumber}); |
463 |
$reply = C4::ILSDI::Services::HoldItem( $query ); |
464 |
|
465 |
is( $reply->{code}, 'itemAlreadyOnLoan', "Patron has issued same book" ); |
466 |
is( $reply->{pickup_location}, undef, "No reserve placed"); |
467 |
|
452 |
$schema->storage->txn_rollback; |
468 |
$schema->storage->txn_rollback; |
453 |
}; |
469 |
}; |
454 |
|
470 |
|
Lines 716-722
subtest 'GetPatronInfo paginated loans' => sub {
Link Here
|
716 |
}); |
732 |
}); |
717 |
my $module = new Test::MockModule('C4::Context'); |
733 |
my $module = new Test::MockModule('C4::Context'); |
718 |
$module->mock('userenv', sub { { branch => $library->branchcode } }); |
734 |
$module->mock('userenv', sub { { branch => $library->branchcode } }); |
719 |
my $date_due = DateTime->now->add(weeks => 2); |
735 |
my $date_due = Koha::DateUtils::dt_from_string()->add(weeks => 2); |
720 |
my $issue1 = C4::Circulation::AddIssue($patron->unblessed, $item1->barcode, $date_due); |
736 |
my $issue1 = C4::Circulation::AddIssue($patron->unblessed, $item1->barcode, $date_due); |
721 |
my $date_due1 = Koha::DateUtils::dt_from_string( $issue1->date_due ); |
737 |
my $date_due1 = Koha::DateUtils::dt_from_string( $issue1->date_due ); |
722 |
my $issue2 = C4::Circulation::AddIssue($patron->unblessed, $item2->barcode, $date_due); |
738 |
my $issue2 = C4::Circulation::AddIssue($patron->unblessed, $item2->barcode, $date_due); |