Lines 279-285
subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub {
Link Here
|
279 |
}; |
279 |
}; |
280 |
|
280 |
|
281 |
subtest 'Handle ids duplication' => sub { |
281 |
subtest 'Handle ids duplication' => sub { |
282 |
plan tests => 6; |
282 |
plan tests => 8; |
283 |
|
283 |
|
284 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
284 |
t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); |
285 |
t::lib::Mocks::mock_preference( 'CalculateFinesOnReturn', 1 ); |
285 |
t::lib::Mocks::mock_preference( 'CalculateFinesOnReturn', 1 ); |
Lines 304-311
subtest 'Handle ids duplication' => sub {
Link Here
|
304 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
304 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
305 |
|
305 |
|
306 |
my $original_checkout = AddIssue( $patron->unblessed, $item->{barcode}, dt_from_string->subtract( days => 50 ) ); |
306 |
my $original_checkout = AddIssue( $patron->unblessed, $item->{barcode}, dt_from_string->subtract( days => 50 ) ); |
307 |
|
|
|
308 |
my $issue_id = $original_checkout->issue_id; |
307 |
my $issue_id = $original_checkout->issue_id; |
|
|
308 |
my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id }); |
309 |
is( $account_lines->count, 1, '1 account line should exist for this issue_id' ); |
310 |
is( $account_lines->next->description, 'Rental', 'patron has been charged the rentalcharge' ); |
311 |
$account_lines->delete; |
312 |
|
309 |
# Create an existing entry in old_issue |
313 |
# Create an existing entry in old_issue |
310 |
$builder->build({ source => 'OldIssue', value => { issue_id => $issue_id } }); |
314 |
$builder->build({ source => 'OldIssue', value => { issue_id => $issue_id } }); |
311 |
|
315 |
|
Lines 326-332
subtest 'Handle ids duplication' => sub {
Link Here
|
326 |
is( $messages->{WasReturned}, 0, 'messages should have the WasReturned flag set to 0' ); |
330 |
is( $messages->{WasReturned}, 0, 'messages should have the WasReturned flag set to 0' ); |
327 |
is( $messages->{DataCorrupted}, 1, 'messages should have the DataCorrupted flag set to 1' ); |
331 |
is( $messages->{DataCorrupted}, 1, 'messages should have the DataCorrupted flag set to 1' ); |
328 |
|
332 |
|
329 |
my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id }); |
333 |
$account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id }); |
330 |
is( $account_lines->count, 0, 'No account lines should exist for this issue_id, patron should not have been charged' ); |
334 |
is( $account_lines->count, 0, 'No account lines should exist for this issue_id, patron should not have been charged' ); |
331 |
|
335 |
|
332 |
is( Koha::Checkouts->find( $issue_id )->issue_id, $issue_id, 'The issues entry should not have been removed' ); |
336 |
is( Koha::Checkouts->find( $issue_id )->issue_id, $issue_id, 'The issues entry should not have been removed' ); |
333 |
- |
|
|