@@ -, +, @@
---
Koha/Account.pm | 5 ++++-
Koha/Patron.pm | 15 +++++++++------
.../intranet-tmpl/prog/en/includes/accounts.inc | 3 ++-
.../prog/en/modules/members/maninvoice.tt | 2 +-
.../bootstrap/en/includes/account-table.inc | 3 ++-
5 files changed, 18 insertions(+), 10 deletions(-)
--- a/Koha/Account.pm
+++ a/Koha/Account.pm
@@ -429,6 +429,7 @@ $debit_type can be any of:
- lost_item
- new_card
- account
+ - account_renew
- sundry
- processing
- rent
@@ -696,6 +697,7 @@ our $offset_type = {
'payment' => 'Payment',
'writeoff' => 'Writeoff',
'account' => 'Account Fee',
+ 'account_renew' => 'Account Fee',
'reserve' => 'Reserve Fee',
'processing' => 'Processing Fee',
'lost_item' => 'Lost Item',
@@ -725,7 +727,8 @@ our $account_type_credit = {
=cut
our $account_type_debit = {
- 'account' => 'A',
+ 'account' => 'ACCOUNT',
+ 'account_renew' => 'ACCOUNT_RENEW',
'overdue' => 'OVERDUE',
'lost_item' => 'LOST',
'new_card' => 'N',
--- a/Koha/Patron.pm
+++ a/Koha/Patron.pm
@@ -231,7 +231,7 @@ sub store {
$self = $self->SUPER::store;
- $self->add_enrolment_fee_if_needed;
+ $self->add_enrolment_fee_if_needed(0);
logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" )
if C4::Context->preference("BorrowersLog");
@@ -253,7 +253,7 @@ sub store {
and $self->category->categorycode ne
$self_from_storage->category->categorycode )
{
- $self->add_enrolment_fee_if_needed;
+ $self->add_enrolment_fee_if_needed(1);
}
# Actionlogs
@@ -716,7 +716,7 @@ sub renew_account {
$self->date_renewed( dt_from_string() );
$self->store();
- $self->add_enrolment_fee_if_needed;
+ $self->add_enrolment_fee_if_needed(1);
logaction( "MEMBERS", "RENEW", $self->borrowernumber, "Membership renewed" ) if C4::Context->preference("BorrowersLog");
return dt_from_string( $expiry_date )->truncate( to => 'day' );
@@ -840,23 +840,26 @@ sub article_requests_finished {
=head3 add_enrolment_fee_if_needed
-my $enrolment_fee = $patron->add_enrolment_fee_if_needed;
+my $enrolment_fee = $patron->add_enrolment_fee_if_needed($renewal);
Add enrolment fee for a patron if needed.
+$renewal - boolean denoting whether this is an account renewal or not
+
=cut
sub add_enrolment_fee_if_needed {
- my ($self) = @_;
+ my ($self, $renewal) = @_;
my $enrolment_fee = $self->category->enrolmentfee;
if ( $enrolment_fee && $enrolment_fee > 0 ) {
+ my $type = $renewal ? 'account_renew' : 'account';
$self->account->add_debit(
{
amount => $enrolment_fee,
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
interface => C4::Context->interface,
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
- type => 'account'
+ type => $type
}
);
}
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
@@ -6,7 +6,8 @@
[%- CASE 'Pay02' -%]Payment, thanks (credit card via SIP2)
[%- CASE 'N' -%]New card
[%- CASE 'OVERDUE' -%]Fine[%- PROCESS account_status_description account=account -%]
- [%- CASE 'A' -%]Account management fee
+ [%- CASE 'ACCOUNT' -%]Account creation fee
+ [%- CASE 'ACCOUNT_RENEW' -%]Account renewal fee
[%- CASE 'M' -%]Sundry
[%- CASE 'LOST' -%]Lost item[%- PROCESS account_status_description account=account -%]
[%- CASE 'W' -%]Writeoff[%- PROCESS account_status_description account=account -%]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt
@@ -79,7 +79,7 @@
[% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") | $raw %]