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 |
|