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 3313-3319
subtest 'Incremented fee tests' => sub {
Link Here
|
3313 |
my $library = |
3318 |
my $library = |
3314 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3319 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
3315 |
|
3320 |
|
3316 |
my $module = new Test::MockModule('C4::Context'); |
|
|
3317 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3321 |
$module->mock( 'userenv', sub { { branch => $library->id } } ); |
3318 |
|
3322 |
|
3319 |
my $patron = $builder->build_object( |
3323 |
my $patron = $builder->build_object( |
Lines 4060-4065
subtest 'transferbook tests' => sub {
Link Here
|
4060 |
|
4064 |
|
4061 |
}; |
4065 |
}; |
4062 |
|
4066 |
|
|
|
4067 |
subtest 'AddIssue records issuer if appropriate' => sub { |
4068 |
plan tests => 2; |
4069 |
|
4070 |
$module->mock( 'userenv', sub { { branch => $library->{id} } } ); |
4071 |
|
4072 |
my $library = |
4073 |
$builder->build_object( { class => 'Koha::Libraries' } )->store; |
4074 |
my $patron = $builder->build_object( |
4075 |
{ |
4076 |
class => 'Koha::Patrons', |
4077 |
value => { categorycode => $patron_category->{categorycode} } |
4078 |
} |
4079 |
)->store; |
4080 |
my $issuer = $builder->build_object( |
4081 |
{ |
4082 |
class => 'Koha::Patrons', |
4083 |
value => { categorycode => $patron_category->{categorycode} } |
4084 |
} |
4085 |
)->store; |
4086 |
my $item = $builder->build_sample_item( |
4087 |
{ |
4088 |
library => $library->{branchcode} |
4089 |
} |
4090 |
); |
4091 |
|
4092 |
$module->mock( 'userenv', sub { { branch => $library->id, number => $issuer->{borrowernumber} } } ); |
4093 |
|
4094 |
my $dt_from = dt_from_string(); |
4095 |
my $dt_to = dt_from_string()->add( days => 7 ); |
4096 |
|
4097 |
my $issue = |
4098 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4099 |
|
4100 |
is( $issue->issuer, undef, "Issuer not recorded when RecordIssuer turned off" ); |
4101 |
|
4102 |
t::lib::Mocks::mock_preference('RecordIssuer', 1); |
4103 |
|
4104 |
my $issue2 = |
4105 |
AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); |
4106 |
|
4107 |
is( $issue->issuer, $issuer->{borrowernumber}, "Issuer recorded when RecordIssuer turned on" ); |
4108 |
}; |
4109 |
|
4063 |
$schema->storage->txn_rollback; |
4110 |
$schema->storage->txn_rollback; |
4064 |
C4::Context->clear_syspref_cache(); |
4111 |
C4::Context->clear_syspref_cache(); |
4065 |
$branches = Koha::Libraries->search(); |
4112 |
$branches = Koha::Libraries->search(); |