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 3454-3460
subtest 'Incremented fee tests' => sub {
Link Here
|
3454 |
my $library = |
3459 |
my $library = |
3455 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3460 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3456 |
|
3461 |
|
3457 |
my $module = new Test::MockModule('C4::Context'); |
|
|
3458 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3462 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3459 |
|
3463 |
|
3460 |
my $patron = $builder->build_object( |
3464 |
my $patron = $builder->build_object( |
Lines 3733-3738
subtest "Test Backdating of Returns" => sub {
Link Here
|
3733 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3737 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3734 |
}; |
3738 |
}; |
3735 |
|
3739 |
|
|
|
3740 |
subtest 'AddIssue records issuer if appropriate' => sub { |
3741 |
plan tests => 2; |
3742 |
|
3743 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
3744 |
|
3745 |
my $library = |
3746 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3747 |
my $patron = $builder->build_object( |
3748 |
{ |
3749 |
class => 'Koha::Patrons', |
3750 |
value => { categorycode => $patron_category->{categorycode} } |
3751 |
} |
3752 |
)->store; |
3753 |
my $issuer = $builder->build_object( |
3754 |
{ |
3755 |
class => 'Koha::Patrons', |
3756 |
value => { categorycode => $patron_category->{categorycode} } |
3757 |
} |
3758 |
)->store; |
3759 |
my $item = $builder->build_sample_item( |
3760 |
{ |
3761 |
library => $library->{branchcode} |
3762 |
} |
3763 |
); |
3764 |
|
3765 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
3766 |
|
3767 |
my $dt_from = dt_from_string(); |
3768 |
my $dt_to = dt_from_string()->add( days => 7 ); |
3769 |
|
3770 |
my $issue = |
3771 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3772 |
|
3773 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
3774 |
|
3775 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
3776 |
|
3777 |
my $issue2 = |
3778 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
3779 |
|
3780 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
3781 |
}; |
3782 |
|
3736 |
$schema->storage->txn_rollback; |
3783 |
$schema->storage->txn_rollback; |
3737 |
C4::Context->clear_syspref_cache(); |
3784 |
C4::Context->clear_syspref_cache(); |
3738 |
$cache->clear_from_cache('single_holidays'); |
3785 |
$cache->clear_from_cache('single_holidays'); |