|
Lines 158-164
subtest 'outstanding_credits() tests' => sub {
Link Here
|
| 158 |
|
158 |
|
| 159 |
subtest 'add_credit() tests' => sub { |
159 |
subtest 'add_credit() tests' => sub { |
| 160 |
|
160 |
|
| 161 |
plan tests => 16; |
161 |
plan tests => 17; |
| 162 |
|
162 |
|
| 163 |
$schema->storage->txn_begin; |
163 |
$schema->storage->txn_begin; |
| 164 |
|
164 |
|
|
Lines 231-248
subtest 'add_credit() tests' => sub {
Link Here
|
| 231 |
is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); |
231 |
is( $offset_2->debit_id, undef, 'No debit_id is set for credits' ); |
| 232 |
|
232 |
|
| 233 |
my $line_3 = $account->add_credit( |
233 |
my $line_3 = $account->add_credit( |
| 234 |
{ amount => 20, |
234 |
{ |
|
|
235 |
amount => 20, |
| 235 |
description => 'Manual credit applied', |
236 |
description => 'Manual credit applied', |
| 236 |
library_id => $patron->branchcode, |
237 |
library_id => $patron->branchcode, |
| 237 |
user_id => $patron->id, |
238 |
user_id => $patron->id, |
| 238 |
type => 'forgiven', |
239 |
type => 'forgiven', |
| 239 |
interface => 'commandline' |
240 |
interface => 'intranet' |
| 240 |
} |
241 |
} |
| 241 |
); |
242 |
); |
| 242 |
|
243 |
|
| 243 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Log was added' ); |
244 |
is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Log was added' ); |
| 244 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'No action added to statistics, because of credit type' ); |
245 |
is( $schema->resultset('Statistic')->count(), $statistics + 2, 'No action added to statistics, because of credit type' ); |
| 245 |
|
246 |
|
|
|
247 |
# Enable cash registers |
| 248 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
| 249 |
throws_ok { |
| 250 |
$account->add_credit( |
| 251 |
{ |
| 252 |
amount => 20, |
| 253 |
description => 'Cash payment without cash register', |
| 254 |
library_id => $patron->branchcode, |
| 255 |
user_id => $patron->id, |
| 256 |
payment_type => 'CASH', |
| 257 |
interface => 'intranet' |
| 258 |
} |
| 259 |
); |
| 260 |
} |
| 261 |
'Koha::Exceptions::Account::RegisterRequired', |
| 262 |
'Exception thrown if cash regisers are enabled, a CASH payemtn type is used and not register is passed'; |
| 263 |
|
| 264 |
# Disable cash registers |
| 265 |
t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); |
| 266 |
|
| 246 |
$schema->storage->txn_rollback; |
267 |
$schema->storage->txn_rollback; |
| 247 |
}; |
268 |
}; |
| 248 |
|
269 |
|
| 249 |
- |
|
|