use JSON rather than Storable for the OPAC search history cookie
[koha.git] / opac / opac-topissues.pl
index 41d7c84..95291d0 100755 (executable)
@@ -40,6 +40,13 @@ plugin that shows a stats on borrowers
 =cut
 
 my $input = new CGI;
+
+# if OpacTopissue is disabled, leave immediately
+if ( ! C4::Context->preference('OpacTopissue') ) {
+    print $input->redirect("/cgi-bin/koha/errors/404.pl");
+    exit;
+}
+
 my $branches = GetBranches();
 my $itemtypes = GetItemTypes();
 
@@ -82,7 +89,7 @@ if($advanced_search_types eq 'ccode'){
                     GROUP BY biblio.biblionumber
                     HAVING tot >0
                     ORDER BY tot DESC
-                    LIMIT $limit
+                    LIMIT ?
                     ";
     $template->param(ccodesearch => 1);
 }else{
@@ -107,13 +114,13 @@ if($advanced_search_types eq 'ccode'){
                     GROUP BY biblio.biblionumber
                     HAVING tot >0
                     ORDER BY tot DESC
-                    LIMIT $limit
+                    LIMIT ?
                     ";
      $template->param(itemtypesearch => 1);
 }
 
 my $sth = $dbh->prepare($query);
-$sth->execute();
+$sth->execute($limit);
 my @results;
 while (my $line= $sth->fetchrow_hashref) {
     push @results, $line;