Lines 117-122
$cache->clear_from_cache('single_holidays');
Link Here
|
117 |
$dbh->do('DELETE FROM issues'); |
117 |
$dbh->do('DELETE FROM issues'); |
118 |
$dbh->do('DELETE FROM borrowers'); |
118 |
$dbh->do('DELETE FROM borrowers'); |
119 |
|
119 |
|
|
|
120 |
# Disable recording of issuer until we're ready for it |
121 |
t::lib::Mocks::mock_preference('RecordIssuer', 0); |
122 |
|
123 |
my $module = new Test::MockModule('C4::Context'); |
124 |
|
120 |
my $library = $builder->build({ |
125 |
my $library = $builder->build({ |
121 |
source => 'Branch', |
126 |
source => 'Branch', |
122 |
}); |
127 |
}); |
Lines 3103-3109
subtest 'Incremented fee tests' => sub {
Link Here
|
3103 |
my $library = |
3108 |
my $library = |
3104 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3109 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3105 |
|
3110 |
|
3106 |
my $module = new Test::MockModule('C4::Context'); |
|
|
3107 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3111 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3108 |
|
3112 |
|
3109 |
my $patron = $builder->build_object( |
3113 |
my $patron = $builder->build_object( |
Lines 3384-3389
subtest "Test Backdating of Returns" => sub {
Link Here
|
3384 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3388 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3385 |
}; |
3389 |
}; |
3386 |
|
3390 |
|
|
|
3391 |
subtest 'AddIssue records issuer if appropriate' => sub { |
3392 |
plan tests => 2; |
3393 |
|
3394 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
3395 |
|
3396 |
my $library = |
3397 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3398 |
my $patron = $builder->build_object( |
3399 |
{ |
3400 |
class => 'Koha::Patrons', |
3401 |
value => { categorycode => $patron_category->{categorycode} } |
3402 |
} |
3403 |
)->store; |
3404 |
my $issuer = $builder->build_object( |
3405 |
{ |
3406 |
class => 'Koha::Patrons', |
3407 |
value => { categorycode => $patron_category->{categorycode} } |
3408 |
} |
3409 |
)->store; |
3410 |
my $item = $builder->build_sample_item( |
3411 |
{ |
3412 |
library => $library->{branchcode} |
3413 |
} |
3414 |
); |
3415 |
|
3416 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
3417 |
|
3418 |
my $dt_from = dt_from_string(); |
3419 |
my $dt_to = dt_from_string()->add( days => 7 ); |
3420 |
|
3421 |
my $issue = |
3422 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3423 |
|
3424 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
3425 |
|
3426 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
3427 |
|
3428 |
my $issue2 = |
3429 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3430 |
|
3431 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
3432 |
}; |
3433 |
|
3387 |
$schema->storage->txn_rollback; |
3434 |
$schema->storage->txn_rollback; |
3388 |
C4::Context->clear_syspref_cache(); |
3435 |
C4::Context->clear_syspref_cache(); |
3389 |
$cache->clear_from_cache('single_holidays'); |
3436 |
$cache->clear_from_cache('single_holidays'); |