|
Lines 6-12
use C4::Circulation;
Link Here
|
| 6 |
use Koha::Database; |
6 |
use Koha::Database; |
| 7 |
use Koha::Patrons; |
7 |
use Koha::Patrons; |
| 8 |
|
8 |
|
| 9 |
use Test::More tests => 59; |
9 |
use Test::More tests => 60; |
| 10 |
|
10 |
|
| 11 |
use_ok('Koha::Patron'); |
11 |
use_ok('Koha::Patron'); |
| 12 |
|
12 |
|
|
Lines 234-243
map {
Link Here
|
| 234 |
# $patron, $different_patron, $items (same bib number), $different_item |
234 |
# $patron, $different_patron, $items (same bib number), $different_item |
| 235 |
my $patron = $builder->build({source => 'Borrower'}); |
235 |
my $patron = $builder->build({source => 'Borrower'}); |
| 236 |
my $patron_d = $builder->build({source => 'Borrower'}); |
236 |
my $patron_d = $builder->build({source => 'Borrower'}); |
| 237 |
my $item_1 = $builder->build({source => 'Item'}); |
237 |
|
|
|
238 |
my $biblio = $builder->build_sample_biblio; |
| 239 |
$biblio->serial(0)->store; |
| 240 |
my $item_1 = $builder->build({ |
| 241 |
source => 'Item', |
| 242 |
value => { biblionumber => $biblio->biblionumber } |
| 243 |
}); |
| 238 |
my $item_2 = $builder->build({ |
244 |
my $item_2 = $builder->build({ |
| 239 |
source => 'Item', |
245 |
source => 'Item', |
| 240 |
value => { biblionumber => $item_1->{biblionumber} }, |
246 |
value => { biblionumber => $biblio->biblionumber }, |
| 241 |
}); |
247 |
}); |
| 242 |
my $item_d = $builder->build({source => 'Item'}); |
248 |
my $item_d = $builder->build({source => 'Item'}); |
| 243 |
|
249 |
|
|
Lines 440-442
map {
Link Here
|
| 440 |
|
446 |
|
| 441 |
$schema->storage->txn_rollback; |
447 |
$schema->storage->txn_rollback; |
| 442 |
|
448 |
|
| 443 |
- |
449 |
subtest 'Check previous checkouts for serial' => sub { |
|
|
450 |
plan tests => 2; |
| 451 |
$schema->storage->txn_begin; |
| 452 |
|
| 453 |
my $library = $builder->build_object({ class => 'Koha::Libraries'}); |
| 454 |
|
| 455 |
my $patron = $builder->build_object({ |
| 456 |
class => 'Koha::Patrons', |
| 457 |
value => { |
| 458 |
branchcode => $library->branchcode |
| 459 |
} |
| 460 |
}); |
| 461 |
t::lib::Mocks::mock_userenv({ patron => $patron }); |
| 462 |
|
| 463 |
my $biblio = $builder->build_sample_biblio; |
| 464 |
$biblio->serial(1)->store; |
| 465 |
|
| 466 |
my $item1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
| 467 |
my $item2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
| 468 |
|
| 469 |
AddIssue($patron->unblessed, $item1->barcode); |
| 470 |
|
| 471 |
is($patron->do_check_for_previous_checkout($item1->unblessed), 1, 'Check only one item if bibliographic record is serial'); |
| 472 |
is($patron->do_check_for_previous_checkout($item2->unblessed), 0, 'Check only one item if bibliographic record is serial'); |
| 473 |
|
| 474 |
$schema->storage->txn_rollback; |
| 475 |
} |