Bugzilla – Attachment 79122 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), 9.41 KB, created by
Blou
on 2018-09-19 18:43:17 UTC
(
hide
)
Description:
Bug 11373: Add a "cash register" feature to the fine payment form.
Filename:
MIME Type:
Creator:
Blou
Created:
2018-09-19 18:43:17 UTC
Size:
9.41 KB
patch
obsolete
>From 5f00e5995673b67672ed3209e3c7c1241d0463bc 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 | 95 ++++++++++++++++++---- > members/paycollect.pl | 31 +++++-- > 2 files changed, 103 insertions(+), 23 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 14384b3..00d6558 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE Asset %] > [% USE Koha %] >+[% USE Price %] > [% USE Branches %] > [% USE AuthorisedValues %] > [% USE Price %] >@@ -54,12 +55,31 @@ > </li> > </ul> > <div class="tabs-container"> >-[% IF ( error_over ) %] >+[% IF (error_negative) %] >+ <div id="error_message" class="dialog alert"> >+ The amount paid can't be negative. >+ </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') %]. >+ 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 (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="csrf_token" value="[% csrf_token | html %]" /> >@@ -84,24 +104,43 @@ > <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 ( 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 | $Price %] >+ </li> >+ <li> >+ <label>Collect from patron:</label> >+ [% amount_collected | $Price %] >+ </li> >+ <li> >+ <label>Change to give back:</label> >+ [% give_change | $Price %] >+ </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 | $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 %]" onchange="moneyFormat(document.payform.collected)" /> > </li> > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] >@@ -115,6 +154,7 @@ > </select> > </li> > [% END %] >+ [% END %] > </ol> > </fieldset> > >@@ -144,12 +184,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,16 +229,36 @@ > <ol> > <li> > <span class="label">Total amount outstanding: </span> >- <span class="debit">[% total | format('%.2f') %]</span> >+ <span class="debit">[% total | $Price %]</span> > </li> >+ [% IF ( give_change ) %] >+ <li> >+ <label for="paid">Amount paid:</label> >+ <input type="hidden" name="paid" id="paid" value="[% amount_paid %]" /> >+ [% amount_paid | $Price %] >+ </li> >+ <li> >+ <label>Collected from patron:</label> >+ <input type="hidden" name="collected" id="collected" value="[% amount_paid %]" /> >+ [% amount_collected | $Price %] >+ </li> >+ <li> >+ <label>Change to give back:</label> >+ [% give_change | $Price %] >+ </li> >+ [% ELSE %] >+ <li> >+ <label for="paid">Amount paid :</label> >+ <input name="paid" id="paid" value="[% total %]" onchange="moneyFormat(document.payform.paid)" /> >+ </li> > <li> > [% IF type == 'writeoff' %] >- <label for="paid">Writeoff amount: </label> >+ <label for="collected">Writeoff amount: </label> > [% ELSE %] >- <label for="paid">Collect from patron: </label> >+ <label for="collected">Collect from patron: </label> > [% END %] > <!-- default to paying all --> >- <input name="paid" id="paid" value="[% total | format('%.2f') %]" /> >+ <input name="collected" id="collected" value="[% total %]" onchange="moneyFormat(document.payform.collected)"/> > </li> > [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] > [% IF payment_types %] >@@ -212,6 +272,7 @@ > </select> > </li> > [% END %] >+ [% END %] > <li> > <label for="selected_accts_notes">Note: </label> > <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea> >@@ -238,7 +299,7 @@ > [% 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 ); > }); >diff --git a/members/paycollect.pl b/members/paycollect.pl >index a15267f..4296208 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -62,6 +62,7 @@ my $branch = C4::Context->userenv->{'branch'}; > my $total_due = $patron->account->outstanding_debits->total_outstanding; > > 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 +97,38 @@ 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 (($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 => $total_due, >+ amount_collected => $total_collected, >+ give_change => $total_collected-$total_due, >+ ); >+ } >+ elsif ($total_paid < $total_due and $total_collected ne $total_paid) { >+ $template->param( >+ amount_paid => $total_paid, >+ amount_collected => $total_collected, >+ give_change => $total_collected-$total_paid, > ); > } else { > die "Wrong CSRF token" >-- >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