From ce9b5d8904c0d46350418ed2252fd06910c01b8c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 3 Jul 2015 11:02:22 +0200 Subject: [PATCH] Bug 14382: [QA Follow-up] Bad regex alarm The regex /|date>>/ will match much more than you like :) The unescaped pipe is bad, but you also need to remove the >> because the split a few lines above it removes them already. This allows you to recover from an error like this one, running another report with a string parameter: The given date (india%) does not match the date format (us) at Koha/DateUtils.pm line 144. Signed-off-by: Marcel de Rooy Amended for possible spaces around the word date. Signed-off-by: Tomas Cohen Arazi (cherry picked from commit bfea40b6e8161629c11d97be5eeba56fb6d59ba3) Signed-off-by: Chris Cormack --- reports/guided_reports.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 0fbd8c532f..197ea62dbf 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -752,7 +752,7 @@ elsif ($phase eq 'Run this report'){ my $quoted = $sql_params[$i]; # if there are special regexp chars, we must \ them $split[$i*2+1] =~ s/(\||\?|\.|\*|\(|\)|\%)/\\$1/g; - if ($split[$i*2+1] =~ /|date>>/) { + if ($split[$i*2+1] =~ /\|\s*date\s*$/) { $quoted = output_pref({ dt => dt_from_string($quoted), dateformat => 'iso', dateonly => 1 }) if $quoted; } $quoted = C4::Context->dbh->quote($quoted); -- 2.39.5