Bugzilla – Attachment 60528 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: Add a "cash register" feature to the fine payment form.
Bug-11373-Add-a-cash-register-feature-to-the-fine-.patch (text/plain), 8.70 KB, created by
Mehdi Hamidi
on 2017-02-21 15:47:57 UTC
(
hide
)
Description:
Bug 11373: Add a "cash register" feature to the fine payment form.
Filename:
MIME Type:
Creator:
Mehdi Hamidi
Created:
2017-02-21 15:47:57 UTC
Size:
8.70 KB
patch
obsolete
>From 3f66935c68b3c54200d911b98f4609ad1f10ffcb 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: Add a "cash register" feature to the fine payment > form. > >If the amount received is greater than the amount to pay, a message is >shown to tell the employee how much money to give back. > >Signed-off-by: Joel Aloi <aloi54@live.fr> >--- > .../prog/en/modules/members/paycollect.tt | 88 +++++++++++++++++----- > members/paycollect.pl | 34 +++++++-- > 2 files changed, 97 insertions(+), 25 deletions(-) > >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 069ad69..6ed1376 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -5,13 +5,6 @@ > [% INCLUDE 'doc-head-close.inc' %] > <script type= "text/javascript"> > //<![CDATA[ >-$(document).ready(function() { >- $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit(); >-}); >-//]]> >-</script> >-<script type= "text/javascript"> >-//<![CDATA[ > function moneyFormat(textObj) { > var newValue = textObj.value; > var decAmount = ""; >@@ -60,6 +53,10 @@ function moneyFormat(textObj) { > > textObj.value = dolAmount + "." + decAmount; > } >+ >+$(document).ready(function() { >+ $('#payform, #woindivfine').preventDoubleFormSubmit(); >+}); > //]]> > </script> > </head> >@@ -93,14 +90,32 @@ function moneyFormat(textObj) { > </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') %]. >+ <span>The amount paid can't be negative!</span> > </div> > [% END %] > >+[% IF (error_collected_less) %] >+ <div id="error_message" class="dialog alert"> >+ <span>The amount collected can't be lower than the amount paid!</span> >+ </div> >+[% END %] >+ >+[% UNLESS (writeoff_individual) %] >+ <form name="payform" id="payform" action="/cgi-bin/koha/members/paycollect.pl" method="post"> >+[% END %] >+ >+[% IF (give_change) %] >+ <div id="change_message" class="dialog message"> >+ <span>The amount collected is greater than the total amount paid.</span><br /> >+ <strong>Change to give back: [% give_change %]</strong><br /><br /> >+ <input type="submit" name="submitbutton" value="Confirm payment" /> >+ <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a> >+ </div> >+[% END %] >+ > [% IF ( pay_individual ) %] >- <form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl"> > <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" /> > <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" /> > <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" /> >@@ -142,12 +157,32 @@ function moneyFormat(textObj) { > </table> > > <ol> >- >+ [% IF ( give_change ) %] > <li> >- <label for="paid">Collect from patron: </label> >- <!-- default to paying all --> >- <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/> >+ <label for="paid">Amount paid:</label> >+ <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" /> >+ <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" /> >+ [% amount_paid %] > </li> >+ <li> >+ <label>Collect from patron:</label> >+ [% amount_collected %] >+ </li> >+ <li> >+ <label>Change to give back:</label> >+ [% give_change %] >+ </li> >+ [% ELSE %] >+ <li> >+ <label for="paid">Amount paid :</label> >+ <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/> >+ [% amount_paid %] >+ </li> >+ <li> >+ <label for="collected">Collect from patron:</label> >+ <input name="collected" id="collected" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)" /> >+ </li> >+ [% END %] > </ol> > </fieldset> > >@@ -196,7 +231,6 @@ function moneyFormat(textObj) { > </form> > [% ELSE %] > >- <form name="payfine" id="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl"> > <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" /> > <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" /> > <input type="hidden" name="total" id="total" value="[% total %]" /> >@@ -208,11 +242,31 @@ function moneyFormat(textObj) { > <span class="label">Total amount outstanding: </span> > <span class="debit">[% total | format('%.2f') %]</span> > </li> >+ [% IF ( give_change ) %] >+ <li> >+ <label for="paid">Amount paid:</label> >+ <!-- default to paying all --> >+ <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)"/> >+ </li> >+ <li> >+ <label>Collect from patron:</label> >+ [% amount_collected %] >+ </li> >+ <li> >+ <label>Change to give back:</label> >+ [% give_change %] >+ </li> >+ [% ELSE %] >+ <li> >+ <label for="paid">Amount paid :</label> >+ <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.paid)" /> >+ </li> > <li> >- <label for="paid">Collect from patron: </label> >+ <label for="collected">Collect from patron:</label> > <!-- default to paying all --> >- <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/> >+ <input name="collected" id="collected" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payform.collected)"/> > </li> >+ [% END %] > <li> > <label for="selected_accts_notes">Note: </label> > <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea> >diff --git a/members/paycollect.pl b/members/paycollect.pl >index ac1c281..d4c7113 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -55,11 +55,11 @@ my $branch = C4::Context->userenv->{'branch'}; > > my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); > my $total_paid = $input->param('paid'); >+my $total_collected = $input->param('collected'); > > my $individual = $input->param('pay_individual'); > my $writeoff = $input->param('writeoff_individual'); >-my $select_lines = $input->param('selected'); >-my $select = $input->param('selected_accts'); >+my $select = ($input->param('selected') || $input->param('selected_accts')); > my $payment_note = uri_unescape $input->param('payment_note'); > my $accountno; > my $accountlines_id; >@@ -94,20 +94,38 @@ if ( $individual || $writeoff ) { > notify_level => $notify_level, > 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 (($total_collected - $total_paid) < 0) { >+ $template->param( >+ error_collected_less => 1, >+ ); >+ } >+ elsif ($total_paid > $total_due) { >+ $template->param( >+ amount_paid => sprintf('%.2f', $total_due), >+ amount_collected => sprintf('%.2f', $total_collected), >+ give_change => sprintf('%.2f',($total_collected-$total_due)) >+ ); >+ } >+ elsif ($total_paid < $total_due and $total_collected ne $total_paid) { >+ $template->param( >+ amount_paid => sprintf('%.2f', $total_paid), >+ amount_collected => sprintf('%.2f', $total_collected), >+ give_change => sprintf('%.2f',($total_collected-$total_paid)) > ); > } else { > if ($individual) { >-- >1.9.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 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