A valid test of this patch is this command:
perl -MC4::Output -e 'print 
pagination_bar("my/script?query=foobar",5,2,"page"),"\n";'

The output before patch begins:
        &nbsp;<a href="my/script?query=foobar?page=1" rel="start">&lt;&lt;</a>
and AFTER patch:
        &nbsp;<a href="my/script?query=foobar&amp;page=1" 
rel="start">&lt;&lt;</a>

The double "?" in QUERY_STRING are now avoided.
---
 C4/Output.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/C4/Output.pm b/C4/Output.pm
index ea889e4..fd32541 100644
--- a/C4/Output.pm
+++ b/C4/Output.pm
@@ -240,7 +240,7 @@ sub pagination_bar {
        $base_url =~ s/$delim;//g;              # remove empties
        $base_url =~ s/$delim$//;               # remove trailing delim
 
-    my $url = $base_url . ( $base_url =~ m/$delim/ ? '&amp;' : '?' ) . 
$startfrom_name . '=';
+    my $url = $base_url . (($base_url =~ m/$delim/ or $base_url =~ m/\?/) ? 
'&amp;' : '?' ) . $startfrom_name . '=';
     my $pagination_bar = '';
 
     # navigation bar useful only if more than one page to display !
-- 
1.5.5.GIT

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to