This came up in a project where Koha is used for old manuscripts. The publication date range search will not work if a user enters years < 1000: opac-search.pl: 418 # append year limits if they exist 419 if ($params->{'limit-yr'}) { 420 if ($params->{'limit-yr'} =~ /\d{4}-\d{4}/) { 421 my ($yr1,$yr2) = split(/-/, $params->{'limit-yr'}); 422 push @limits, "yr,st-numeric,ge=$yr1 and yr,st-numeric,le=$yr2"; 423 } 424 elsif ($params->{'limit-yr'} =~ /\d{4}/) { 425 push @limits, "yr,st-numeric=$params->{'limit-yr'}"; 426 } 427 else { 428 #FIXME: Should return a error to the user, incorect date format specified 429 } 430 }
Created attachment 107628 [details] [review] 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
Created attachment 107848 [details] [review] 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 <martin.renvoize@ptfs-europe.com>
Simple patch that works as expected.. must admit I was expecting us to be doing something 'clever' like catching double-digit dates adding a prefix to make it up to four digits.. but as we're not doing anything like that already this patch seems perfect. Signing off.
> The adv search did not allow publication years prior to 1000 > We are now ready for year 10000 We might be - but MARC definitely is not :)
Before patch, on opac, search 'Date range: 1990-2000' Succeeds After: fails
Created attachment 107939 [details] [review] Bug 11469: Fix search by date range
Did some more testing, now -2007 doesn't seem to work with the patches :(