Bug 5981 - OPAC: Add limits to search history
authorAlex Arnaud <alex.arnaud@biblibre.com>
Sun, 10 Jun 2012 11:14:24 +0000 (13:14 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 4 Jul 2012 14:26:33 +0000 (16:26 +0200)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed a conflict in updatedatabase and removed kohaversion.pl from the patch.

Patch works nicely, tested with different searches and limits.

Note: Sort options don't get into the history still.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
installer/data/mysql/kohastructure.sql
installer/data/mysql/updatedatabase.pl
opac/opac-search.pl

index e1105a5..593c404 100644 (file)
@@ -1746,7 +1746,7 @@ CREATE TABLE IF NOT EXISTS `search_history` (
   `userid` int(11) NOT NULL,
   `sessionid` varchar(32) NOT NULL,
   `query_desc` varchar(255) NOT NULL,
-  `query_cgi` varchar(255) NOT NULL,
+  `query_cgi` text NOT NULL,
   `total` int(11) NOT NULL,
   `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
   KEY `userid` (`userid`),
index 4da22e7..9563de0 100755 (executable)
@@ -5452,6 +5452,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.09.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE search_history MODIFY COLUMN query_cgi text NOT NULL");
+    print "Upgrade to $DBversion done (Change search_history.query_cgi type to text. bug 5981)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
index 7eeebbd..404b48d 100755 (executable)
@@ -589,6 +589,12 @@ for (my $i=0;$i<@servers;$i++) {
             }
 
             # Adding the new search if needed
+            my $path_info = $cgi->url(-path_info=>1);
+            $query_cgi = $cgi->url(-query=>1);
+            $query_cgi =~ s/^$path_info\?//;
+            $query_cgi =~ s/;/&/g;
+            $query_desc .= ", $limit_desc";
+
             if (!$borrowernumber || $borrowernumber eq '') {
                 # To a cookie (the user is not logged in)
                 if (($params->{'offset'}||'') eq '') {