Bugzilla – Attachment 88731 Details for
Bug 6759
Use a different account type for account renewals than for new accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6759: Split account creation and renewal charges
Bug-6759-Split-account-creation-and-renewal-charge.patch (text/plain), 6.69 KB, created by
Martin Renvoize (ashimema)
on 2019-04-25 09:17:22 UTC
(
hide
)
Description:
Bug 6759: Split account creation and renewal charges
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-25 09:17:22 UTC
Size:
6.69 KB
patch
obsolete
>From d9cb03bc28a8ade8618f98d886719569761064ec Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 24 Apr 2019 11:08:49 +0100 >Subject: [PATCH] Bug 6759: Split account creation and renewal charges > >Test plan: >1. Enable charging for patron enrolement >2. Add a new patron where the category is charged for >3. Note the charge of type 'Account management fee' >4. Renew the patron >5. Note the next charge of type 'Account management fee' >6. Apply patch >7. Repeat steps 1-6 and note the first charge will be of type 'Account >creation fee' and the second of type 'Account renewal fee' >8. Bonus points, enable 'FeeOnChangePatronCategory' and check that when >changing a patron from a free category to a charged one that a new >'Account renewal fee' is charged. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > 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(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 7018a2c183..bcb91709c3 100644 >--- a/Koha/Account.pm >+++ b/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', >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index c3326285b9..3c1cb9ed74 100644 >--- a/Koha/Patron.pm >+++ b/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 > } > ); > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >index fb8dabda89..29ce3078bf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc >@@ -6,7 +6,8 @@ > [%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2) > [%- CASE 'N' -%]<span>New card > [%- CASE 'OVERDUE' -%]<span>Fine >- [%- CASE 'A' -%]<span>Account management fee >+ [%- CASE 'ACCOUNT' -%]<span>Account creation fee >+ [%- CASE 'ACCOUNT_RENEW' -%]<span>Account renewal fee > [%- CASE 'M' -%]<span>Sundry > [%- CASE 'LOST' -%]<span>Lost item > [%- CASE 'W' -%]<span>Writeoff >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt >index 7ce2a42997..909776197b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt >+++ b/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 %] > <script> >- var type_fees = {'LOST':'','OVERDUE':'','A':'','N':'','M':''}; >+ var type_fees = {'LOST':'','OVERDUE':'','ACCOUNT':'','ACCOUNT_RENEW':'','N':'','M':''}; > [% FOREACH invoice_types_loo IN invoice_types_loop %] > type_fees['[% invoice_types_loo.authorised_value | html %]'] = "[% invoice_types_loo.lib | html %]"; > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >index 32c12f9971..6f15ba0fc7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc >@@ -36,7 +36,8 @@ > [% CASE 'VOID' %]Voided > [% CASE 'N' %]New card > [% CASE 'OVERDUE' %]Fine >- [% CASE 'A' %]Account management fee >+ [% CASE 'ACCOUNT' %]Account creation fee >+ [% CASE 'ACCOUNT_RENEW' %]Account renewal fee > [% CASE 'M' %]Sundry > [% CASE 'LOST' %]Lost item > [% CASE 'W' %]Writeoff >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6759
:
88614
|
88615
|
88731
|
88732
|
91533
|
91534
|
91662
|
91663
|
92765
|
92766
|
92767