From af0441d6139d6bf7bc1f5fc70f2ff869cac34b37 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Jan 2020 12:23:39 +0000 Subject: [PATCH] Bug 22359: Prevent undercollection at the server This patch adds some additional handling to prevent undercollection of fees at the server side. Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- .../intranet-tmpl/prog/en/modules/members/paycollect.tt | 5 +++++ members/paycollect.pl | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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 c996bc1ea8..54eec334b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -65,6 +65,11 @@ You must pay a value less than or equal to [% total_due | format('%.2f') %]. [% END %] +[% IF ( error_under ) %] +
+ You must collect a value greater than or equal to [% total_paid | format('%.2f') %]. +
+[% END %] [% IF ( pay_individual ) %] [% IF ( error_registers ) %] diff --git a/members/paycollect.pl b/members/paycollect.pl index 8590765263..b95a5708d5 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -67,7 +67,8 @@ my $user = $input->remote_user; my $library_id = C4::Context->userenv->{'branch'}; my $total_due = $account->outstanding_debits->total_outstanding; -my $total_paid = $input->param('paid'); +my $total_paid = $input->param('paid'); +my $total_collected = $input->param('collected'); my $selected_lines = $input->param('selected'); # comes from pay.pl my $pay_individual = $input->param('pay_individual'); @@ -164,6 +165,11 @@ if ( $total_paid and $total_paid ne '0.00' ) { error_over => 1, total_due => $total_due ); + } elsif ( $total_collected < $total_paid && !( $writeoff_individual || $type eq 'writeoff') ) { + $template->param( + error_under => 1, + total_paid => $total_paid + ); } else { output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' ) unless Koha::Token->new->check_csrf( { -- 2.39.5