Bugzilla – Attachment 68296 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), 7.24 KB, created by
Simon Pouchol
on 2017-10-19 12:47:36 UTC
(
hide
)
Description:
Bug 11373: Add a "cash register" feature to the fine payment form.
Filename:
MIME Type:
Creator:
Simon Pouchol
Created:
2017-10-19 12:47:36 UTC
Size:
7.24 KB
patch
obsolete
>From cc6222502b69d717ed15e695532443d09c537951 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. > >Works as intended. > >Signed-off-by: Simon Pouchol <simon.pouchol@biblibre.com> >--- > .../prog/en/modules/members/paycollect.tt | 80 +++++++++++++++++++--- > members/paycollect.pl | 31 +++++++-- > 2 files changed, 97 insertions(+), 14 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 a1458b5..384e09a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -60,6 +60,10 @@ function moneyFormat(textObj) { > > textObj.value = dolAmount + "." + decAmount; > } >+ >+$(document).ready(function() { >+ $('#payform, #woindivfine').preventDoubleFormSubmit(); >+}); > //]]> > </script> > </head> >@@ -93,12 +97,31 @@ function moneyFormat(textObj) { > </li> > </ul> > <div class="tabs-container"> >-[% IF ( error_over ) %] >+[% IF (error_negative) %] >+ <div id="error_message" class="dialog alert"> >+ <span>The amount paid can't be negative!</span> >+ </div> >+[% END %] >+ >+[% IF (error_collected_less) %] > <div id="error_message" class="dialog alert"> >- You must pay a value less than or equal to [% total_due | format('%.2f') %]. >+ <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" method="post" action="/cgi-bin/koha/members/paycollect.pl"> > <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" /> >@@ -141,12 +164,32 @@ function moneyFormat(textObj) { > </table> > > <ol> >- >+ [% IF ( give_change ) %] >+ <li> >+ <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 for="paid">Collect from patron: </label> >- <!-- default to paying all --> >- <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" /> >+ <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> > >@@ -206,11 +249,32 @@ 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> >+ <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" /> >+ [% amount_paid %] >+ </li> >+ <li> >+ <label>Collected from patron:</label> >+ <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" /> >+ [% 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') %]" /> >+ <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 f880f57..e69a1de 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -64,6 +64,7 @@ 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'); >@@ -100,20 +101,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 and $total_collected ne $total_paid) { >+ $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) { >-- >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