|
Lines 121-126
for my $branch ( $branches->next ) {
Link Here
|
| 121 |
$dbh->do('DELETE FROM issues'); |
121 |
$dbh->do('DELETE FROM issues'); |
| 122 |
$dbh->do('DELETE FROM borrowers'); |
122 |
$dbh->do('DELETE FROM borrowers'); |
| 123 |
|
123 |
|
|
|
124 |
# Disable recording of issuer until we're ready for it |
| 125 |
t::lib::Mocks::mock_preference('RecordIssuer', 0); |
| 126 |
|
| 127 |
my $module = new Test::MockModule('C4::Context'); |
| 128 |
|
| 124 |
my $library = $builder->build({ |
129 |
my $library = $builder->build({ |
| 125 |
source => 'Branch', |
130 |
source => 'Branch', |
| 126 |
}); |
131 |
}); |
|
Lines 3307-3313
subtest 'Incremented fee tests' => sub {
Link Here
|
| 3307 |
my $library = |
3312 |
my $library = |
| 3308 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3313 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3309 |
|
3314 |
|
| 3310 |
my $module = new Test::MockModule('C4::Context'); |
|
|
| 3311 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3315 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
| 3312 |
|
3316 |
|
| 3313 |
my $patron = $builder->build_object( |
3317 |
my $patron = $builder->build_object( |
|
Lines 4030-4035
subtest 'transferbook tests' => sub {
Link Here
|
| 4030 |
|
4034 |
|
| 4031 |
}; |
4035 |
}; |
| 4032 |
|
4036 |
|
|
|
4037 |
subtest 'AddIssue records issuer if appropriate' => sub { |
| 4038 |
plan tests => 2; |
| 4039 |
|
| 4040 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
| 4041 |
|
| 4042 |
my $library = |
| 4043 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 4044 |
my $patron = $builder->build_object( |
| 4045 |
{ |
| 4046 |
class => 'Koha::Patrons', |
| 4047 |
value => { categorycode => $patron_category->{categorycode} } |
| 4048 |
} |
| 4049 |
)->store; |
| 4050 |
my $issuer = $builder->build_object( |
| 4051 |
{ |
| 4052 |
class => 'Koha::Patrons', |
| 4053 |
value => { categorycode => $patron_category->{categorycode} } |
| 4054 |
} |
| 4055 |
)->store; |
| 4056 |
my $item = $builder->build_sample_item( |
| 4057 |
{ |
| 4058 |
library => $library->{branchcode} |
| 4059 |
} |
| 4060 |
); |
| 4061 |
|
| 4062 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
| 4063 |
|
| 4064 |
my $dt_from = dt_from_string(); |
| 4065 |
my $dt_to = dt_from_string()->add( days => 7 ); |
| 4066 |
|
| 4067 |
my $issue = |
| 4068 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 4069 |
|
| 4070 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
| 4071 |
|
| 4072 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
| 4073 |
|
| 4074 |
my $issue2 = |
| 4075 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
| 4076 |
|
| 4077 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
| 4078 |
}; |
| 4079 |
|
| 4033 |
$schema->storage->txn_rollback; |
4080 |
$schema->storage->txn_rollback; |
| 4034 |
C4::Context->clear_syspref_cache(); |
4081 |
C4::Context->clear_syspref_cache(); |
| 4035 |
$branches = Koha::Libraries->search(); |
4082 |
$branches = Koha::Libraries->search(); |