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

(-)a/t/db_dependent/Circulation.t (-17 / +12 lines)
Lines 3005-3011 $cache->clear_from_cache('single_holidays'); Link Here
3005
3005
3006
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
3006
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
3007
3007
3008
    plan tests => 13;
3008
    plan tests => 10;
3009
3009
3010
    $schema->storage->txn_begin;
3010
    $schema->storage->txn_begin;
3011
3011
Lines 3065-3098 subtest 'AddRenewal and AddIssuingCharge tests' => sub { Link Here
3065
    # The following will fail if run on 00:00:00
3065
    # The following will fail if run on 00:00:00
3066
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3066
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3067
3067
3068
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3069
    $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );
3070
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3071
    AddRenewal( $patron->id, $item->id, $library->id );
3072
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3073
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3074
3075
    my $lines = Koha::Account::Lines->search({
3068
    my $lines = Koha::Account::Lines->search({
3076
        borrowernumber => $patron->id,
3069
        borrowernumber => $patron->id,
3077
        itemnumber     => $item->id
3070
        itemnumber     => $item->id
3078
    });
3071
    });
3079
3072
3080
    is( $lines->count, 3 );
3073
    is( $lines->count, 2 );
3081
3074
3082
    my $line = $lines->next;
3075
    my $line = $lines->next;
3083
    is( $line->accounttype, 'Rent',       'The issuing charge generates an accountline' );
3076
    is( $line->accounttype, 'RENT',       'The issue of item with issueing charge generates an accountline of the correct type' );
3084
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3077
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3085
    is( $line->description, 'Rental',     'AddIssuingCharge set a hardcoded description for the accountline' );
3078
    is( $line->description, '',     'AddIssue does not set a hardcoded description for the accountline' );
3086
3079
3087
    $line = $lines->next;
3080
    $line = $lines->next;
3088
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3081
    is( $line->accounttype, 'RENT_RENEW', 'The renewal of item with issuing charge generates an accountline of the correct type' );
3089
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3082
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3090
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3083
    is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' );
3091
3084
3092
    $line = $lines->next;
3085
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3093
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3086
    $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );
3094
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3087
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3095
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3088
    AddRenewal( $patron->id, $item->id, $library->id );
3089
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3090
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3096
3091
3097
    $schema->storage->txn_rollback;
3092
    $schema->storage->txn_rollback;
3098
};
3093
};
(-)a/t/db_dependent/Circulation/Returns.t (-1 / +1 lines)
Lines 277-283 subtest 'Handle ids duplication' => sub { Link Here
277
    my $issue_id = $original_checkout->issue_id;
277
    my $issue_id = $original_checkout->issue_id;
278
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id });
278
    my $account_lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber, issue_id => $issue_id });
279
    is( $account_lines->count, 1, '1 account line should exist for this issue_id' );
279
    is( $account_lines->count, 1, '1 account line should exist for this issue_id' );
280
    is( $account_lines->next->description, 'Rental', 'patron has been charged the rentalcharge' );
280
    is( $account_lines->next->accounttype, 'RENT', 'patron has been charged the rentalcharge' );
281
    $account_lines->delete;
281
    $account_lines->delete;
282
282
283
    # Create an existing entry in old_issue
283
    # 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