From 1cd7af657ae821ed9a7e818779ec4b3a83c4fc4b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 31 Jul 2020 12:05:55 +0200 Subject: [PATCH] Bug 11469: Allow search by publication years with number of digits != 4 The adv search did not allow publication years prior to 1000 We are now ready for year 10000 Test plan: Having some book with a publication year=123 (3 digits) Search this book by publication year => Search result must return it Signed-off-by: Martin Renvoize --- catalogue/search.pl | 2 +- opac/opac-search.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 1fd012d8df..b2f7864d32 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -393,7 +393,7 @@ $template->param(available => $available); my $limit_yr; my $limit_yr_value; if ($params->{'limit-yr'}) { - if ($params->{'limit-yr'} =~ /\d{4}/) { + if ($params->{'limit-yr'} =~ /^\d+$/) { $limit_yr = "yr,st-numeric=$params->{'limit-yr'}"; $limit_yr_value = $params->{'limit-yr'}; } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index cf2e9e966e..2ea1467973 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -514,7 +514,7 @@ $template->param(available => $available); # append year limits if they exist if ($params->{'limit-yr'}) { - if ($params->{'limit-yr'} =~ /\d{4}/) { + if ($params->{'limit-yr'} =~ /^\d+$/) { push @limits, "yr,st-numeric=$params->{'limit-yr'}"; } else { -- 2.20.1