Bugzilla – Attachment 82686 Details for
Bug 18805
Currently it is impossible to apply credits against debits in patron accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18805: Add ability to use up account credits
Bug-18805-Add-ability-to-use-up-account-credits.patch (text/plain), 3.89 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-11-27 23:38:23 UTC
(
hide
)
Description:
Bug 18805: Add ability to use up account credits
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-11-27 23:38:23 UTC
Size:
3.89 KB
patch
obsolete
>From d644dd7f7b3f69d04c4989a2ee5a2cc454a990f8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 27 Nov 2018 20:28:29 -0300 >Subject: [PATCH] Bug 18805: Add ability to use up account credits > >This patch introduces a new button in the 'Pay fines' tab on the >patron's account page. This button, labeled 'Normalize account' is only >displayed when outstanding credits are available, that could be used to >pay up existing debts. > >When clicking the button, the Koha::Account::normalize_balance method >(bug 21896) is used for the purpose. > >To test: >- Apply this patch (on top of 21896) >- On a patron's 'Fines' tab, create a 'manual invoice' (maybe more than > one) >- Go to the 'Pay fines' tab >=> SUCCESS: No 'Normalize account' button is displayed. >- On the 'create manual credit' tab, create a couple credits. >- Go to the 'Pay fines' >=> SUCCESS: 'Normalize account' button is displayed >- Click on 'Normalize account' >=> SUCCESS: Outstanding credits have been used to pay up debts. >- Play with different options (credit excedes debts and vice-versa, they > match, etc) >=> SUCCESS: They all work as expected >- Sign off :-D >--- > .../prog/en/modules/members/pay.tt | 3 +++ > members/pay.pl | 21 ++++++++++++++++++- > 2 files changed, 23 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index cb49492a94..3a50f6896a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -123,6 +123,9 @@ > [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall" id="woall" value="Write off all" class="submit" />[% END %] > <input type="submit" id="payselected" name="payselected" value="Pay selected" class="submit" /> > <input type="submit" id="writeoff-selected" name="writeoff_selected" value="Write off selected" class="submit" /> >+[% IF outstanding_credits.total_outstanding < 0 %] >+<input type="submit" id="normalize_account" name="normalize_account" value="Normalize account" class="submit" /> >+[% END %] > <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a> > </fieldset> > </form> >diff --git a/members/pay.pl b/members/pay.pl >index b2216aa511..ff0796a6c7 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -87,6 +87,9 @@ elsif ( $input->param('writeoff_selected') ) { > elsif ( $input->param('woall') ) { > writeoff_all(@names); > } >+elsif ( $input->param('normalize_account') ) { >+ normalize_account({ patron => $patron, cgi => $input }); >+} > elsif ( $input->param('confirm_writeoff') ) { > my $accountlines_id = $input->param('accountlines_id'); > my $amount = $input->param('amountwrittenoff'); >@@ -138,7 +141,9 @@ output_html_with_http_headers $input, $cookie, $template->output; > sub add_accounts_to_template { > > my $patron = Koha::Patrons->find( $borrowernumber ); >- my $account_lines = $patron->account->outstanding_debits; >+ my $account = $patron->account; >+ my $outstanding_credits = $account->outstanding_credits; >+ my $account_lines = $account->outstanding_debits; > my $total = $account_lines->total_outstanding; > my @accounts; > while ( my $account_line = $account_lines->next ) { >@@ -157,7 +162,9 @@ sub add_accounts_to_template { > patron => $patron, > accounts => \@accounts, > total => $total, >+ outstanding_credits => $outstanding_credits > ); >+ > return; > > } >@@ -273,3 +280,15 @@ sub payselected { > print $input->redirect($redirect); > return; > } >+ >+sub normalize_account { >+ my ($args) = @_; >+ >+ my $patron = $args->{patron}; >+ my $cgi = $args->{cgi}; >+ >+ $patron->account->normalize_balance(); >+ >+ print $cgi->redirect("/cgi-bin/koha/members/pay.pl?borrowernumber=" . $patron->borrowernumber ); >+ return; >+} >-- >2.19.2
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 18805
:
64297
|
72025
|
80415
|
81609
|
82686
|
82711
|
82712
|
82758
|
82816