Bugzilla – Attachment 79759 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), 7.72 KB, created by
Pierre-Marc Thibault
on 2018-10-01 18:48: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-10-01 18:48:07 UTC
Size:
7.72 KB
patch
obsolete
>From 0d693140a2359991d799c8b80c47e63243f96225 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. >- Click on Yes in the dialog box. >- Confirm that the payment has been made (example : last amount = 3$). >- 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 inputs paid and change are 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 | 1 + > 3 files changed, 95 insertions(+), 1 deletion(-) > >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..f5ff194 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -98,11 +98,26 @@ > > <ol> > >+ [% IF FineChange %] >+ <li> >+ <label for="paid">Amount paid: </label> >+ <input name="paid" id="paid" value="[% amountoutstanding | $Price %]"/> >+ </li> >+ <li> >+ <label for="collected">Collect from patron: </label> >+ <input id="collected" value="[% amountoutstanding | $Price %]"/> >+ </li> >+ <li> >+ <label>Change to give: </label> >+ <input id="change" value="0.00" disabled/> >+ </li> >+ [% ELSE %] > <li> > <label for="paid">Collect from patron: </label> > <!-- default to paying all --> > <input name="paid" id="paid" value="[% amountoutstanding | html %]" /> > </li> >+ [% END %] > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] > <li> >@@ -191,6 +206,24 @@ > <span class="label">Total amount outstanding: </span> > <span class="debit">[% total | format('%.2f') %]</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 %] >+ <input id="collected" value="[% total | $Price %]"/> >+ </li> >+ <li> >+ <label>Change to give: </label> >+ <input id="change" value="0.00" disabled/> >+ </li> >+ [% ELSE %] > <li> > [% IF type == 'writeoff' %] > <label for="paid">Writeoff amount: </label> >@@ -200,6 +233,7 @@ > <!-- default to paying all --> > <input name="paid" id="paid" value="[% total | format('%.2f') %]" /> > </li> >+ [% END %] > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] > <li> >@@ -233,14 +267,54 @@ > </div> > </div> > >+<!-- Modal --> >+<a class="hidden" href="#confirm_change_form" data-toggle="modal"></a> >+<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h3>Amount collected higher than paid</h3> >+ </div> >+ <div class="modal-body"> >+ <p>The amount collected from the patron is higher than the amount paid.</p> >+ <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p> >+ <p>Do you still confirm the payment?</p> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button> >+ <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button> >+ </div> >+ </div> >+ </div> >+</div> >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") | $raw %] > <script type= "text/javascript"> > $(document).ready(function() { >+ var forms = $('#payindivfine, #payfine'); >+ var change = $('#change')[0]; >+ > $('#payindivfine, #payfine').preventDoubleFormSubmit(); >- $("#paid").on("change",function(){ >+ $("#paid, #collected").on("change",function() { > moneyFormat( this ); >+ if (change != undefined) { >+ updateChangeValues(); >+ } >+ }); >+ >+ if (change != undefined) { >+ forms.bind('submit', function(e) { >+ if (change.value > change.defaultValue) { >+ e.preventDefault(); >+ $('a[href="#confirm_change_form"]').click(); >+ } >+ }); >+ } >+ >+ $('#modal_submit').click(function() { >+ forms[0].submit(); > }); > }); > >@@ -310,6 +384,19 @@ > > textObj.value = dolAmount + "." + decAmount; > } >+ >+ function updateChangeValues() { >+ 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); >+ } >+ >+ $('#modal_change').html(change.value); >+ } > </script> > [% END %] > >diff --git a/members/paycollect.pl b/members/paycollect.pl >index a15267f..4f6584f 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -194,6 +194,7 @@ $template->param( > patron => $patron, > total => $total_due, > ExtendedPatronAttributes => C4::Context->preference('ExtendedPatronAttributes'), >+ FineChange => C4::Context->preference('FineChange'), > > 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