From bf11ff02d000aa63a49537732ccca788bbb18bbd Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 10 Jan 2017 00:11:52 +0000 Subject: [PATCH] [SIGNED-OFF] Bug 15702: Trim whitespace from fields with non-whitespace data Since space may be a valid value for something, trimming what has non-whitespace was done. TEST PLAN --------- 1) Enter patron with spaces before, after, and both. 2) Apply patch. 3) Attempt to enter another patron with spaces before, after, and both. -- attempting to edit after saving will demonstrate the spaces were trimmed. 4) Attempt to edit the patron initially entered. -- while there may be spaces before, after, and both initially, after saving and trying to edit again, there will not be. 5) run koha qa test tools. Signed-off-by: Owen Leonard --- members/memberentry.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/members/memberentry.pl b/members/memberentry.pl index 2fcaa72..d5d4df7 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -176,6 +176,9 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) if (defined $input->param($key)) { $newdata{$key} = $input->param($key); $newdata{$key} =~ s/\"/"/g unless $key eq 'borrowernotes' or $key eq 'opacnote'; + if (defined $newdata{$key} && $newdata{$key} =~ /\S/) { + $newdata{$key} =~ s/^\s*|\s*$//g; # trim whitespace if non-whitespace present. + } } } -- 2.1.4