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

(-)a/t/db_dependent/Circulation.t (-17 / +12 lines)
Lines 3093-3099 subtest 'AddReturn should clear items.onloan for unissued items' => sub { Link Here
3093
3093
3094
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
3094
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
3095
3095
3096
    plan tests => 13;
3096
    plan tests => 10;
3097
3097
3098
3098
3099
    t::lib::Mocks::mock_preference('item-level_itypes', 1);
3099
    t::lib::Mocks::mock_preference('item-level_itypes', 1);
Lines 3152-3185 subtest 'AddRenewal and AddIssuingCharge tests' => sub { Link Here
3152
    # The following will fail if run on 00:00:00
3152
    # The following will fail if run on 00:00:00
3153
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3153
    unlike ( $checkouts->next->lastreneweddate, qr/00:00:00/, 'AddRenewal should set the renewal date with the time part');
3154
3154
3155
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3156
    $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );
3157
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3158
    AddRenewal( $patron->id, $item->id, $library->id );
3159
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3160
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3161
3162
    my $lines = Koha::Account::Lines->search({
3155
    my $lines = Koha::Account::Lines->search({
3163
        borrowernumber => $patron->id,
3156
        borrowernumber => $patron->id,
3164
        itemnumber     => $item->id
3157
        itemnumber     => $item->id
3165
    });
3158
    });
3166
3159
3167
    is( $lines->count, 3 );
3160
    is( $lines->count, 2 );
3168
3161
3169
    my $line = $lines->next;
3162
    my $line = $lines->next;
3170
    is( $line->accounttype, 'Rent',       'The issuing charge generates an accountline' );
3163
    is( $line->accounttype, 'RENT',       'The issue of item with issueing charge generates an accountline of the correct type' );
3171
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3164
    is( $line->branchcode,  $library->id, 'AddIssuingCharge correctly sets branchcode' );
3172
    is( $line->description, 'Rental',     'AddIssuingCharge set a hardcoded description for the accountline' );
3165
    is( $line->description, '',     'AddIssue does not set a hardcoded description for the accountline' );
3173
3166
3174
    $line = $lines->next;
3167
    $line = $lines->next;
3175
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3168
    is( $line->accounttype, 'RENT_RENEW', 'The renewal of item with issuing charge generates an accountline of the correct type' );
3176
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3169
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3177
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3170
    is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' );
3178
3171
3179
    $line = $lines->next;
3172
    t::lib::Mocks::mock_preference( 'RenewalLog', 1 );
3180
    is( $line->accounttype, 'Rent', 'Fine on renewed item is closed out properly' );
3173
    $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );
3181
    is( $line->branchcode,  $library->id, 'AddRenewal correctly sets branchcode' );
3174
    $old_log_size = Koha::ActionLogs->count( \%params_renewal );
3182
    is( $line->description, "Renewal of Rental Item $title $barcode", 'AddRenewal set a hardcoded description for the accountline' );
3175
    AddRenewal( $patron->id, $item->id, $library->id );
3176
    $new_log_size = Koha::ActionLogs->count( \%params_renewal );
3177
    is( $new_log_size, $old_log_size + 1, 'renew log successfully added' );
3183
3178
3184
};
3179
};
3185
3180
(-)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