From 00f3d12eb40d0e69e21346a9328f8bca45cb0e56 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 6 Jul 2015 11:00:38 -0400 Subject: [PATCH] Bug 14498 - uri_escape error triggered by duplicate accountno's for patron If a patron has duplicate accountno's for two different fines in Koha this will trigger the error usi_escape: Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ])/ at (eval 133) line 1. upon attempt to pay. How those accountno's get duplicated is unknown, but considering accountno is somewhat vestigial at this point in time, it would be much more sensible to use accountlines_id which is has guaranteed uniqueness at the database level. Test Plan: 1) Create a patron with 2 fines 2) Edit the accountno's for those fines and set them to 0 3) Attempt to pay one, note the error 4) Apply this patch 5) Refesh the page 6) Attempt to pay one, no error this time! 7) Test Pay, Write off, Pay amount, Write off all, and Pay selected --- .../intranet-tmpl/prog/en/modules/members/pay.tt | 29 +++++++++---------- members/pay.pl | 7 ++--- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index 18b857c..64a0f68 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -94,25 +94,24 @@ function enableCheckboxActions(){ [% IF ( line.amountoutstanding > 0 ) %] - + [% END %] [% IF ( line.amountoutstanding > 0 ) %] - - [% IF CAN_user_updatecharges_writeoff %][% END %] + + [% IF CAN_user_updatecharges_writeoff %][% END %] [% END %] - - - - - - - - - - - + + + + + + + + + + [% SWITCH line.accounttype %] @@ -139,7 +138,7 @@ function enableCheckboxActions(){ [%- IF line.description %], [% line.description %][% END %] [% IF line.title %]([% line.title %])[% END %] - + [% line.accounttype %] [% line.notify_id %] [% line.notify_level %] diff --git a/members/pay.pl b/members/pay.pl index 07217fd..826ec29 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -56,6 +56,7 @@ our ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my @names = $input->param; +warn "NAMES: " . Data::Dumper::Dumper( \@names ); our $borrowernumber = $input->param('borrowernumber'); if ( !$borrowernumber ) { @@ -170,7 +171,6 @@ sub redirect_to_paycollect { $redirect .= get_for_redirect( 'amount', "amount$line_no", 1 ); $redirect .= get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 ); - $redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 ); $redirect .= get_for_redirect( 'title', "title$line_no", 0 ); $redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 ); $redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 ); @@ -184,7 +184,7 @@ sub redirect_to_paycollect { sub writeoff_all { my @params = @_; - my @wo_lines = grep { /^accountno\d+$/ } @params; + my @wo_lines = grep { /^accountlines_id\d+$/ } @params; for (@wo_lines) { if (/(\d+)/) { my $value = $1; @@ -193,7 +193,6 @@ sub writeoff_all { # my $borrowernum = $input->param("borrowernumber$value"); my $itemno = $input->param("itemnumber$value"); my $amount = $input->param("amountoutstanding$value"); - my $accountno = $input->param("accountno$value"); my $accountlines_id = $input->param("accountlines_id$value"); my $payment_note = $input->param("payment_note_$value"); WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount, $branch, $payment_note ); @@ -250,7 +249,7 @@ sub payselected { foreach (@params) { if (/^incl_par_(\d+)$/) { my $index = $1; - push @lines_to_pay, $input->param("accountno$index"); + push @lines_to_pay, $input->param("accountlines_id$index"); $amt += $input->param("amountoutstanding$index"); } } -- 1.7.2.5