Bugzilla – Attachment 79538 Details for
Bug 11373
Add "change calculation" feature to the fine payment forms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11373: Show the difference between the amount collected and the amount paid of a fine payment.
Bug-11373-Show-the-difference-between-the-amount-c.patch (text/plain), 10.31 KB, created by
Pierre-Marc Thibault
on 2018-09-27 15:57:07 UTC
(
hide
)
Description:
Bug 11373: Show the difference between the amount collected and the amount paid of a fine payment.
Filename:
MIME Type:
Creator:
Pierre-Marc Thibault
Created:
2018-09-27 15:57:07 UTC
Size:
10.31 KB
patch
obsolete
>From eb552fa485979455c7b14db1dc25a495b7d7cbaa Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= <frederick.capovilla@libeo.com> >Date: Tue, 10 Dec 2013 16:51:39 -0500 >Subject: [PATCH] Bug 11373: Show the difference between the amount collected > and the amount paid of a fine payment. > >This patch adds a feature in the fine payment section. It allows to see the change due to patrons when the amount collected is higher than the amount paid. This includes also a new system preference called FineChange which enables or disables the feature. > >Test plan : >- Apply patch. >- Make sure FineChange is at ENABLE in System preferences > Patrons. >- Select a patron with a fine. >- Go to Fines > Pay fines. >- Click the button pay. >- Choose the amount paid equal to the outstanding amount (exemple : 3$). >- Choose the amount collected to be more than the outstanding amount (exemple : 5$) >- Confirm that the change is correct (example : 5$ - 3$ = 2$) >- Click the button confirm. >- Confirm that the payment has been made. >- Make sure FineChange is at DISABLE in System preferences > Patrons. >- Select a patron with a fine and go to Fines > Pay fines. >- Confirm that the input change is gone. >- Choose an amount collected (exemple : 3$). >- Click the button confirm. >- Confirm that the payment has been made. >--- > .../prog/en/modules/admin/preferences/patrons.pref | 6 ++ > .../prog/en/modules/members/paycollect.tt | 89 ++++++++++++++++++---- > members/paycollect.pl | 19 +++-- > 3 files changed, 93 insertions(+), 21 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 8c8227d4..2a6dbaf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -213,6 +213,12 @@ Patrons: > yes: Allow only superlibrarians > no: Allow all permitted users > - "to access/change superlibrarian privileges. Note: A permitted user needs to have the 'permissions' flag (if no superlibrarian)." >+ - >+ - pref: FineChange >+ choices: >+ yes: Enable >+ no: Disable >+ - fine change display when a user pays a fine. > Privacy: > - > - Use the following URL >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index 14384b3..62cd227 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -54,12 +54,22 @@ > </li> > </ul> > <div class="tabs-container"> >-[% IF ( error_over ) %] >+[% IF (error_negative) %] > <div id="error_message" class="dialog alert"> >- You must pay a value less than or equal to [% total_due | format('%.2f') %]. >+ The amount paid can't be negative. > </div> > [% END %] > >+[% IF (error_collected_less) %] >+ <div id="error_message" class="dialog alert"> >+ The amount collected can't be lower than the amount paid. >+ </div> >+[% END %] >+ >+[% UNLESS (writeoff_individual) %] >+ <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post"> >+[% END %] >+ > [% IF ( pay_individual ) %] > <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl"> > <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" /> >@@ -84,25 +94,38 @@ > <th>Amount outstanding</th> > </tr></thead> > <tfoot> >- <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td> >+ <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td> > </tfoot> > <tbody><tr> > <td> > [% individual_description | html %] > </td> > <td>[% accounttype | html %]</td> >- <td class="debit">[% amount | format('%.2f') %]</td> >- <td class="debit">[% amountoutstanding | format('%.2f') %]</td> >+ <td class="debit">[% amount | $Price %]</td> >+ <td class="debit">[% amountoutstanding | $Price %]</td> > </tr></tbody> > </table> > > <ol> >- >+ [% IF FineChange %] >+ <li> >+ <label for="paid">Amount paid:</label> >+ <input name="paid" id="paid" value="[% amountoutstanding | $Price %]"/> >+ </li> > <li> >- <label for="paid">Collect from patron: </label> >- <!-- default to paying all --> >- <input name="paid" id="paid" value="[% amountoutstanding | html %]" /> >+ <label for="collected">Collect from patron:</label> >+ <input name="collected" id="collected" value="[% amountoutstanding | $Price %]"/> > </li> >+ <li> >+ <label>Change to give back:</label> >+ <input id="change" value="0.00" disabled/> >+ </li> >+ [% ELSE %] >+ <li> >+ <label for="paid">Collect from patron:</label> >+ <input name="paid" id="collected" value="[% amountoutstanding | $Price %]"/> >+ </li> >+ [% END %] > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] > <li> >@@ -144,12 +167,12 @@ > <th>Amount</th> > <th>Amount outstanding</th> > </tr></thead> >- <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot> >+ <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tfoot> > <tbody><tr> > <td>[% description | html %] [% title | html %]</td> > <td>[% accounttype | html %]</td> >- <td class="debit">[% amount | format('%.2f') %]</td> >- <td class="debit">[% amountoutstanding | format('%.2f') %]</td> >+ <td class="debit">[% amount | $Price %]</td> >+ <td class="debit">[% amountoutstanding | $Price %]</td> > </tr></tbody> > </table> > >@@ -189,8 +212,27 @@ > <ol> > <li> > <span class="label">Total amount outstanding: </span> >- <span class="debit">[% total | format('%.2f') %]</span> >+ <span class="debit">[% total | $Price %]</span> > </li> >+ [% IF FineChange %] >+ <li> >+ <label for="paid">Amount paid :</label> >+ <input name="paid" id="paid" value="[% total | $Price %]"/> >+ </li> >+ <li> >+ [% IF type == 'writeoff' %] >+ <label for="collected">Writeoff amount: </label> >+ [% ELSE %] >+ <label for="collected">Collect from patron: </label> >+ [% END %] >+ <!-- default to paying all --> >+ <input name="collected" id="collected" value="[% total | $Price %]"/> >+ </li> >+ <li> >+ <label>Change to give back:</label> >+ <input id="change" value="0.00" disabled/> >+ </li> >+ [% ELSE %] > <li> > [% IF type == 'writeoff' %] > <label for="paid">Writeoff amount: </label> >@@ -198,8 +240,9 @@ > <label for="paid">Collect from patron: </label> > [% END %] > <!-- default to paying all --> >- <input name="paid" id="paid" value="[% total | format('%.2f') %]" /> >+ <input name="paid" id="paid" value="[% total | $Price %]"/> > </li> >+ [% END %] > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] > <li> >@@ -238,9 +281,14 @@ > [% Asset.js("js/members-menu.js") | $raw %] > <script type= "text/javascript"> > $(document).ready(function() { >- $('#payindivfine, #payfine').preventDoubleFormSubmit(); >+ $('#payindivfine, #payfine, #payform').preventDoubleFormSubmit(); > $("#paid").on("change",function(){ > moneyFormat( this ); >+ updateChangeInput(); >+ }); >+ $("#collected").on("change",function(){ >+ moneyFormat( this ); >+ updateChangeInput(); > }); > }); > >@@ -310,6 +358,17 @@ > > textObj.value = dolAmount + "." + decAmount; > } >+ >+ function updateChangeInput() { >+ var change = $('#change')[0]; >+ change.value = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100; >+ >+ if (change.value < 0) { >+ change.value = change.defaultValue; >+ } else { >+ moneyFormat(change); >+ } >+ } > </script> > [% END %] > >diff --git a/members/paycollect.pl b/members/paycollect.pl >index a15267f..57290d5 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -61,7 +61,9 @@ my $user = $input->remote_user; > my $branch = C4::Context->userenv->{'branch'}; > my $total_due = $patron->account->outstanding_debits->total_outstanding; > >+my $fine_change = C4::Context->preference('FineChange'); > my $total_paid = $input->param('paid'); >+my $total_collected = $input->param('collected'); > > my $individual = $input->param('pay_individual'); > my $writeoff = $input->param('writeoff_individual'); >@@ -96,20 +98,24 @@ if ( $individual || $writeoff ) { > individual_description => $description, > payment_note => $payment_note, > ); >-} elsif ($select_lines) { >- $total_due = $input->param('amt'); >+} elsif ($select) { >+ $total_due = ($input->param('amt') || $input->param('total')); > $template->param( >- selected_accts => $select_lines, >+ selected_accts => $select, > amt => $total_due, > selected_accts_notes => scalar $input->param('notes'), > ); > } > > if ( $total_paid and $total_paid ne '0.00' ) { >- if ( $total_paid < 0 or $total_paid > $total_due ) { >+ if ( $total_paid < 0 ) { > $template->param( >- error_over => 1, >- total_due => $total_due >+ error_negative => 1, >+ ); >+ } >+ elsif ($fine_change and ($total_collected - $total_paid) < 0) { >+ $template->param( >+ error_collected_less => 1, > ); > } else { > die "Wrong CSRF token" >@@ -194,6 +200,7 @@ $template->param( > patron => $patron, > total => $total_due, > ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), >+ FineChange => $fine_change, > > csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $input->cookie('CGISESSID') }), > ); >-- >2.7.4
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 11373
:
23382
|
26103
|
26108
|
29757
|
29938
|
36875
|
36876
|
36877
|
60528
|
60529
|
61233
|
61234
|
67348
|
68296
|
70043
|
71975
|
71976
|
77584
|
77585
|
79122
|
79171
|
79188
|
79507
|
79509
|
79529
|
79530
|
79538
|
79549
|
79759
|
79944
|
79951
|
80414
|
80986
|
82420
|
82797
|
83804
|
83812
|
83813
|
84653
|
84654