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