From 64aa406edd48b29643381c50ba34fb3507360ae4 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Mon, 17 Dec 2007 19:22:41 -0600 Subject: [PATCH] fix limit-yr compatibility with sort_by option Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- catalogue/search.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 01f8252ad5..83fe35bf54 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -387,17 +387,20 @@ foreach my $limit(@limits) { $template->param(available => $available); # append year limits if they exist +my $limit_yr; +my $limit_yr_value; if ($params->{'limit-yr'}) { if ($params->{'limit-yr'} =~ /\d{4}-\d{4}/) { my ($yr1,$yr2) = split(/-/, $params->{'limit-yr'}); - push @limits, "yr,st-numeric,ge=$yr1 and yr,st-numeric,le=$yr2"; + $limit_yr = "yr,st-numeric,ge=$yr1 and yr,st-numeric,le=$yr2"; + $limit_yr_value = "$yr1-$yr2"; } elsif ($params->{'limit-yr'} =~ /\d{4}/) { - push @limits, "yr,st-numeric=$params->{'limit-yr'}"; - } - else { - #FIXME: Should return a error to the user, incorect date format specified + $limit_yr = "yr,st-numeric=$params->{'limit-yr'}"; + $limit_yr_value = $params->{'limit-yr'}; } + push @limits,$limit_yr; + #FIXME: Should return a error to the user, incorect date format specified } # Params that can only have one value @@ -434,6 +437,11 @@ $template->param ( QUERY_INPUTS => \@query_inputs ); my @limit_inputs; for my $this_cgi ( split('&',$limit_cgi) ) { next unless $this_cgi; + # handle special case limit-yr + if ($this_cgi =~ /yr,st-numeric/) { + push @limit_inputs, { input_name => 'limit-yr', input_value => $limit_yr_value }; + next; + } $this_cgi =~ m/(.*=)(.*)/; my $input_name = $1; my $input_value = $2; -- 2.39.5