View | Details | Raw Unified | Return to bug 11573
Collapse All | Expand All

(-)a/t/db_dependent/Circulation.t (-17 / +12 lines)
Lines 2959-2965 $cache->clear_from_cache('single_holidays'); Link Here
2959
2959
2960
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
2960
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
2961
2961
2962
    plan tests => 13;
2962
    plan tests => 10;
2963
2963
2964
    $schema->storage->txn_begin;
2964
    $schema->storage->txn_begin;
2965
2965
Lines 3019-3052 subtest 'AddRenewal and AddIssuingCharge tests' => sub { Link Here
3019
    # The following will fail if run on 00:00:00
3019
    # The following will fail if run on 00:00:00
3020
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3020
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3021
3021
3022
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3023
    $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } );
3024
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3025
    AddRenewal( $patron->id, $item->id, $library->id );
3026
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3027
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3028
3029
    my $lines = Koha::Account::Lines->search({
3022
    my $lines = Koha::Account::Lines->search({
3030
        borrowernumber => $patron->id,
3023
        borrowernumber => $patron->id,
3031
        itemnumber     => $item->id
3024
        itemnumber     => $item->id
3032
    });
3025
    });
3033
3026
3034
    is( $lines->count, 3 );
3027
    is( $lines->count, 2 );
3035
3028
3036
    my $line = $lines->next;
3029
    my $line = $lines->next;
3037
    is( $line->accounttype, 'Rent',       'The issuing charge generates an accountline' );
3030
    is( $line->accounttype, 'RENT',       'The issue of item with issueing charge generates an accountline of the correct type' );
3038
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3031
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3039
    is( $line->description, 'Rental',     'AddIssuingCharge set a hardcoded description for the accountline' );
3032
    is( $line->description, '',     'AddIssue does not set a hardcoded description for the accountline' );
3040
3033
3041
    $line = $lines->next;
3034
    $line = $lines->next;
3042
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3035
    is( $line->accounttype, 'RENT_RENEW', 'The renewal of item with issuing charge generates an accountline of the correct type' );
3043
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3036
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3044
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3037
    is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' );
3045
3038
3046
    $line = $lines->next;
3039
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3047
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3040
    $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } );
3048
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3041
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3049
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3042
    AddRenewal( $patron->id, $item->id, $library->id );
3043
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3044
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3050
3045
3051
    $schema->storage->txn_rollback;
3046
    $schema->storage->txn_rollback;
3052
};
3047
};
(-)a/t/db_dependent/Circulation/Returns.t (-1 / +1 lines)
Lines 321-327 subtest 'Handle ids duplication' => sub { Link Here
321
    my $issue_id = $original_checkout->issue_id;
321
    my $issue_id = $original_checkout->issue_id;
322
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id });
322
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id });
323
    is( $account_lines->count, 1, '1 account line should exist for this issue_id' );
323
    is( $account_lines->count, 1, '1 account line should exist for this issue_id' );
324
    is( $account_lines->next->description, 'Rental', 'patron has been charged the rentalcharge' );
324
    is( $account_lines->next->accounttype, 'RENT', 'patron has been charged the rentalcharge' );
325
    $account_lines->delete;
325
    $account_lines->delete;
326
326
327
    # Create an existing entry in old_issue
327
    # Create an existing entry in old_issue
(-)a/t/db_dependent/Circulation/issue.t (-2 / +1 lines)
Lines 211-217 $sth->execute; Link Here
211
my $countaccount = $sth->fetchrow_array;
211
my $countaccount = $sth->fetchrow_array;
212
is ($countaccount,0,"0 accountline exists");
212
is ($countaccount,0,"0 accountline exists");
213
my $checkout = Koha::Checkouts->find( $issue_id1 );
213
my $checkout = Koha::Checkouts->find( $issue_id1 );
214
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10 );
214
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10, 'rent' );
215
is( ref( $charge ), 'Koha::Account::Line', "An issuing charge has been added" );
215
is( ref( $charge ), 'Koha::Account::Line', "An issuing charge has been added" );
216
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
216
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
217
my $offset = Koha::Account::Offsets->find( { debit_id => $charge->id } );
217
my $offset = Koha::Account::Offsets->find( { debit_id => $charge->id } );
218
- 

Return to bug 11573