@@ -, +, @@ form. --- .../prog/en/modules/members/paycollect.tt | 80 +++++++++++++++++++--- members/paycollect.pl | 31 +++++++-- 2 files changed, 97 insertions(+), 14 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ a/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(); +}); //]]> @@ -93,12 +97,31 @@ function moneyFormat(textObj) {
-[% IF ( error_over ) %] +[% IF (error_negative) %] +
+ The amount paid can't be negative! +
+[% END %] + +[% IF (error_collected_less) %]
- 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!
[% END %] +[% UNLESS (writeoff_individual) %] +
+[% END %] + +[% IF (give_change) %] +
+ The amount collected is greater than the total amount paid.
+ Change to give back: [% give_change %]

+ + Cancel +
+[% END %] + [% IF ( pay_individual ) %] @@ -141,12 +164,32 @@ function moneyFormat(textObj) {
    - + [% IF ( give_change ) %] +
  1. + + + + [% amount_paid %] +
  2. - - - + + [% amount_collected %]
  3. +
  4. + + [% give_change %] +
  5. + [% ELSE %] +
  6. + + + [% amount_paid %] +
  7. +
  8. + + +
  9. + [% END %]
@@ -206,11 +249,32 @@ function moneyFormat(textObj) { Total amount outstanding: [% total | format('%.2f') %] + [% IF ( give_change ) %] +
  • + + + [% amount_paid %] +
  • +
  • + + + [% amount_collected %] +
  • +
  • + + [% give_change %] +
  • + [% ELSE %] +
  • + + +
  • - + - +
  • + [% END %]
  • --- a/members/paycollect.pl +++ a/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) { --