Lines 2260-2266
subtest 'store() tests' => sub {
Link Here
|
2260 |
|
2260 |
|
2261 |
subtest '_set_found_trigger() tests' => sub { |
2261 |
subtest '_set_found_trigger() tests' => sub { |
2262 |
|
2262 |
|
2263 |
plan tests => 9; |
2263 |
plan tests => 13; |
2264 |
|
2264 |
|
2265 |
$schema->storage->txn_begin; |
2265 |
$schema->storage->txn_begin; |
2266 |
|
2266 |
|
Lines 2337-2342
subtest 'store() tests' => sub {
Link Here
|
2337 |
$messages = $item->object_messages; |
2337 |
$messages = $item->object_messages; |
2338 |
is( scalar @{$messages}, 0, 'This item has no history, no associated lost fines, presumed not lost by patron, no messages returned'); |
2338 |
is( scalar @{$messages}, 0, 'This item has no history, no associated lost fines, presumed not lost by patron, no messages returned'); |
2339 |
|
2339 |
|
|
|
2340 |
# NoRefundOnLostFinesPaidAge |
2341 |
t::lib::Mocks::mock_preference( 'NoRefundOnLostFinesPaidAge', 10 ); |
2342 |
$mocked_circ_rules->mock( 'get_lostreturn_policy', sub { return { lostreturn => 'refund' }; } ); |
2343 |
|
2344 |
$item = $builder->build_sample_item( { itemlost => 1, itemlost_on => dt_from_string() } ); |
2345 |
my $fine = Koha::Account::Line->new( |
2346 |
{ |
2347 |
borrowernumber => $patron->id, |
2348 |
date => '1970-01-01 14:00:01', |
2349 |
amount => 5, |
2350 |
amountoutstanding => 0, |
2351 |
interface => 'commandline', |
2352 |
debit_type_code => 'LOST', |
2353 |
itemnumber => $item->itemnumber |
2354 |
} |
2355 |
)->store(); |
2356 |
my $payment = Koha::Account::Line->new( |
2357 |
{ |
2358 |
borrowernumber => $patron->id, |
2359 |
date => '1970-01-01 14:00:01', |
2360 |
amountoutstanding => 0, |
2361 |
amount => -5, |
2362 |
interface => 'commandline', |
2363 |
credit_type_code => 'PAYMENT' |
2364 |
} |
2365 |
)->store(); |
2366 |
my $offset = Koha::Account::Offset->new( |
2367 |
{ |
2368 |
credit_id => $payment->id, |
2369 |
debit_id => $fine->id, |
2370 |
type => 'APPLY', |
2371 |
amount => -5, |
2372 |
created_on => '1971-01-01 14:00:01' |
2373 |
} |
2374 |
)->store(); |
2375 |
|
2376 |
$item->set( { itemlost => 0 } )->store; |
2377 |
|
2378 |
$messages = $item->object_messages; |
2379 |
|
2380 |
is( |
2381 |
scalar @{$messages}, 1, |
2382 |
'This item has one message assigned' |
2383 |
); |
2384 |
|
2385 |
my $message = $messages->[0]; |
2386 |
is( $message->type, 'info', 'type is correct' ); |
2387 |
is( $message->message, 'payment_not_refunded', 'message is correct' ); |
2388 |
is( $message->payload, undef, 'no payload' ); |
2389 |
|
2340 |
$schema->storage->txn_rollback; |
2390 |
$schema->storage->txn_rollback; |
2341 |
}; |
2391 |
}; |
2342 |
|
2392 |
|
2343 |
- |
|
|