Bugzilla – Attachment 82816 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]
[18.05.x] Bug 18805: Add ability to use up account credits
Bug-18805-Add-ability-to-use-up-account-credits.patch (text/plain), 4.20 KB, created by
Kyle M Hall (khall)
on 2018-11-30 20:19:57 UTC
(
hide
)
Description:
[18.05.x] Bug 18805: Add ability to use up account credits
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-11-30 20:19:57 UTC
Size:
4.20 KB
patch
obsolete
>From 0cb0668c02d0c2805fda9c8a026da03f897f1076 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 'Apply credits' button is displayed. >- On the 'create manual credit' tab, create a couple credits. >- Go to the 'Pay fines' >=> SUCCESS: 'Apply credits' button is displayed >- Click on 'Apply credits' >=> 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 > >Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/modules/members/pay.tt | 10 ++++++++++ > members/pay.pl | 20 ++++++++++++++++++- > 2 files changed, 29 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 80abac023e..80d4efda9d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -51,7 +51,11 @@ > <tfoot> > <tr> > <td class="total" colspan="6">Total due:</td> >+[% IF outstanding_credits.total_outstanding < 0 %] >+ <td style="text-align: right;">[% total + outstanding_credits.total_outstanding | $Price %]</td> >+[% ELSE %] > <td style="text-align: right;">[% total | $Price %]</td> >+[% END %] > </tr> > </tfoot> > <tbody> >@@ -108,6 +112,12 @@ > <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td> > </tr> > [% END %] >+[% IF outstanding_credits.total_outstanding < 0 %] >+<tr> >+ <td class="total" colspan="6">Outstanding credits could be applied <input type="submit" id="apply_credits" name="apply_credits" value="Apply credits" class="submit" /></td> >+ <td class="credit" style="text-align: right;">[% outstanding_credits.total_outstanding | $Price %]</td> >+</tr> >+[% END %] > [% IF ( account_grp.total ) %] > <tr> > >diff --git a/members/pay.pl b/members/pay.pl >index 505843a1d7..e5cca521aa 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -88,6 +88,8 @@ if ($payselected) { > my $writeoff_all = $input->param('woall'); # writeoff all fines > if ($writeoff_all) { > writeoff_all(@names); >+} elsif ( $input->param('apply_credits') ) { >+ apply_credits({ patron => $patron, cgi => $input }); > } elsif ($writeoff_item) { > my $accountlines_id = $input->param('accountlines_id'); > my $amount = $input->param('amountwrittenoff'); >@@ -141,7 +143,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 ) { >@@ -160,7 +164,9 @@ sub add_accounts_to_template { > patron => $patron, > accounts => \@accounts, > total => $total, >+ outstanding_credits => $outstanding_credits > ); >+ > return; > > } >@@ -279,3 +285,15 @@ sub payselected { > print $input->redirect($redirect); > return; > } >+ >+sub apply_credits { >+ my ($args) = @_; >+ >+ my $patron = $args->{patron}; >+ my $cgi = $args->{cgi}; >+ >+ $patron->account->reconcile_balance(); >+ >+ print $cgi->redirect("/cgi-bin/koha/members/pay.pl?borrowernumber=" . $patron->borrowernumber ); >+ return; >+} >-- >2.17.2 (Apple Git-113)
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