From 9c01d7c7a2122458d70ed8e5fb95d3ac01f377c0 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 15 Oct 2012 11:29:55 +1300 Subject: [PATCH 01/10] Bug 8917 : Creating tables and system pref, no functional changes at all Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov --- installer/data/mysql/kohastructure.sql | 20 ++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 21 +++++++++++++++++++ .../en/modules/admin/preferences/opac.pref | 8 +++++++ 4 files changed, 50 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ed673da455..d004fe1d64 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3056,6 +3056,26 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` ( KEY `borrowernumber` (`borrowernumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Table structure for table linktracker +-- This stores clicks to external links +-- + +DROP TABLE IF EXISTS linktracker; +CREATE TABLE linktracker ( + id int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier + biblionumber int(11) DEFAULT NULL, -- biblionumber of the record the link is from + itemnumber int(11) DEFAULT NULL, -- itemnumber if applicable that the link was from + borrowernumber int(11) DEFAULT NULL, -- borrowernumber who clicked the link + url text, -- the link itself + timeclicked datetime DEFAULT NULL, -- the date and time the link was clicked + PRIMARY KEY (id), + KEY bibidx (biblionumber), + KEY itemidx (itemnumber), + KEY borridx (borrowernumber), + KEY dateidx (timeclicked) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 40bbfed3d8..cad409c53d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -417,3 +417,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TrackClicks','0','Track links clicked',NULL,'Integer'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4fa2fccf4c..eb8ce80073 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6444,6 +6444,27 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("CREATE TABLE linktracker ( + id int(11) NOT NULL AUTO_INCREMENT, + biblionumber int(11) DEFAULT NULL, + itemnumber int(11) DEFAULT NULL, + borrowernumber int(11) DEFAULT NULL, + url text, + timeclicked datetime DEFAULT NULL, + PRIMARY KEY (id), + KEY bibidx (biblionumber), + KEY itemidx (itemnumber), + KEY borridx (borrowernumber), + KEY dateidx (timeclicked) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $dbh->do(" + INSERT INTO systempreferences (variable,value,explanation,options,type) + VALUES('TrackClicks','0','Track links clicked',NULL,'Integer')"); + print "Upgrade to $DBversion done (Adds feature Bug 8917, the ability to track links clicked)"; + SetVersion ($DBversion); +} $DBversion = "3.11.00.024"; if ( CheckVersion($DBversion) ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index f1be4494ab..57df5127a6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -525,6 +525,14 @@ OPAC: - pref: AnonymousPatron class: integer - as the Anonymous Patron (for anonymous suggestions and reading history) + - + - pref: TrackClicks + default: 0 + choices: + anonymous: "Track anonymously" + track: "Track" + no: "Don't track" + - links that patrons click on Shelf Browser: - From 8fa0082188f26ced2f0cc72a1501800cfb60aacb Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 15 Oct 2012 11:55:51 +1300 Subject: [PATCH 02/10] Bug 8917 : Adding link tracking to the opac detail page, without xslt Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- .../opac-tmpl/prog/en/modules/opac-detail.tt | 21 ++++++++++++++++++- opac/opac-detail.pl | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index cd58cb5738..7757c5b004 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -716,7 +716,19 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% END %] - [% IF ( OPACURLOpenInNewWindow ) %][% ELSE %][% END %] + [% IF ( OPACurlOpenInNewWindow ) %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + + [% ELSE %] + + [% END %] + [% END %] [% MARCurl.linktext %] [% IF ( MARCurl.notes ) %]
    [% FOREACH note IN MARCurl.notes %]
  • [% note.note %]
  • [% END %]
[% END %] @@ -1476,6 +1488,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( itemdata_ccode ) %][% ITEM_RESULT.ccode %][% END %] [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %] [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] + [% IF ( itemdata_uri ) %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + Link to resource + [% ELSE %] + [% ITEM_RESULT.uri %] + [% END %] + [% END %] [% IF ( itemdata_uri ) %][% ITEM_RESULT.uri %][% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index bb9cbd5d7b..5b2da845d5 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1006,5 +1006,6 @@ $template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopup if (C4::Context->preference('OpacHighlightedWords')) { $template->{VARS}->{query_desc} = $query->param('query_desc'); } +$template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks'); output_html_with_http_headers $query, $cookie, $template->output; From 81de735f131f940489d5be4298639525167aac80 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 15 Oct 2012 13:16:17 +1300 Subject: [PATCH 03/10] Bug 8917 : Script to log link clicks Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- opac/tracklinks.pl | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 opac/tracklinks.pl diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl new file mode 100755 index 0000000000..cc1d5e3b4d --- /dev/null +++ b/opac/tracklinks.pl @@ -0,0 +1,77 @@ +#!/usr/bin/perl + +# script to log clicks on links to external urls + +# Copyright 2012 Catalyst IT +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +use C4::Context; +use C4::Auth qw(checkauth); +use CGI; + +my $trackinglinks = C4::Context->preference('TrackClicks'); + +my $cgi = new CGI; +my $uri = $cgi->param('uri') || ''; + +if ($uri) { + if ( $trackinglinks eq 'track' || $trackinglinks eq 'anonymous' ) { + my $borrowernumber = 0; + + # we have a uri and we want to track + if ( $trackinglinks eq 'track' ) { + my ( $user, $cookie, $sessionID, $flags ) = + checkauth( $cgi, 1, '', 'opac' ); + my $userenv = C4::Context->userenv; + + if ( defined($userenv) + && ref($userenv) eq 'HASH' + && $userenv->{number} ) + { + $borrowernumber = $userenv->{number}; + } + + # get borrower info + } + my $biblionumber = $cgi->param('biblionumber') || 0; + my $itemnumber = $cgi->param('itemnumber') || 0; + + trackclick( $uri, $biblionumber, $borrowernumber, $itemnumber ); + print $cgi->redirect($uri); + } + else { + + # We have a valid url, but we shouldn't track it, just redirect + print $cgi->redirect($uri); + } +} +else { + + # we shouldn't be here, bail out + print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early + exit; +} + +sub trackclick { + my ( $uri, $biblionumber, $borrowernumber, $itemnumber ) = @_; + my $dbh = C4::Context->dbh(); + my $query = "INSERT INTO linktracker (biblionumber,itemnumber,borrowernumber + ,url,timeclicked) VALUES (?,?,?,?,now())"; + my $sth = $dbh->prepare($query); + $sth->execute( $biblionumber, $itemnumber, $borrowernumber, $uri ); + +} From 57c6b26df09007539acf63a66f4d727074f4dc23 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 15 Oct 2012 15:39:08 +1300 Subject: [PATCH 04/10] Bug 8917 : Link tracking, changes to XSLT Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- C4/XSLT.pm | 3 ++- .../opac-tmpl/prog/en/modules/opac-detail.tt | 9 ++++--- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 15 ++++++++++- .../prog/en/xslt/MARC21slim2OPACResults.xsl | 27 +++++++++++++++++-- 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 6600045a34..ffdc3ab975 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -189,7 +189,8 @@ sub XSLTParse4Display { Display856uAsImage OPACDisplay856uAsImage UseControlNumber IntranetBiblioDefaultView BiblioDefaultView singleBranchMode OPACItemLocation - AlternateHoldingsField AlternateHoldingsSeparator / ) + AlternateHoldingsField AlternateHoldingsSeparator + TrackClicks / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 7757c5b004..ac5c0b78b1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -718,13 +718,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( OPACurlOpenInNewWindow ) %] [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - + [% ELSE %] [% END %] [% ELSE %] [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - + [% ELSE %] [% END %] @@ -1490,11 +1490,12 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] [% IF ( itemdata_uri ) %] [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - Link to resource + Link to resource [% ELSE %] [% ITEM_RESULT.uri %] [% END %] - [% END %] + + [% END %] [% IF ( itemdata_uri ) %][% ITEM_RESULT.uri %][% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index 31cbb362ce..5130e8b11d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -26,6 +26,8 @@ + + { @@ -550,7 +552,18 @@ Online resources: - + + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + + + _blank diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index cfcc2dd773..4335e504dc 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -29,6 +29,7 @@ + @@ -950,7 +951,18 @@ - + + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + + + 100 @@ -974,7 +986,18 @@ - + + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + /cgi-bin/koha/tracklinks.pl?uri=;biblionumber= + + + + + 100 From c50cd65704e55048eb64085ea337d91c98de1cfd Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Wed, 27 Feb 2013 09:32:24 +1300 Subject: [PATCH 05/10] Bug 8917 : Fixing a bug bgkriegel spotted and removing tabs Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- installer/data/mysql/updatedatabase.pl | 37 ++++++++++++++------------ opac/tracklinks.pl | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index eb8ce80073..b28b75fbb3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6446,24 +6446,27 @@ if ( CheckVersion($DBversion) ) { $DBversion = "3.11.00.XXX"; if ( CheckVersion($DBversion) ) { - $dbh->do("CREATE TABLE linktracker ( - id int(11) NOT NULL AUTO_INCREMENT, - biblionumber int(11) DEFAULT NULL, - itemnumber int(11) DEFAULT NULL, - borrowernumber int(11) DEFAULT NULL, - url text, - timeclicked datetime DEFAULT NULL, - PRIMARY KEY (id), - KEY bibidx (biblionumber), - KEY itemidx (itemnumber), - KEY borridx (borrowernumber), - KEY dateidx (timeclicked) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); - $dbh->do(" + $dbh->do( + "CREATE TABLE linktracker ( + id int(11) NOT NULL AUTO_INCREMENT, + biblionumber int(11) DEFAULT NULL, + itemnumber int(11) DEFAULT NULL, + borrowernumber int(11) DEFAULT NULL, + url text, + timeclicked datetime DEFAULT NULL, + PRIMARY KEY (id), + KEY bibidx (biblionumber), + KEY itemidx (itemnumber), + KEY borridx (borrowernumber), + KEY dateidx (timeclicked) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" + ); + $dbh->do( " INSERT INTO systempreferences (variable,value,explanation,options,type) - VALUES('TrackClicks','0','Track links clicked',NULL,'Integer')"); - print "Upgrade to $DBversion done (Adds feature Bug 8917, the ability to track links clicked)"; - SetVersion ($DBversion); + VALUES('TrackClicks','0','Track links clicked',NULL,'Integer')" ); + print +"Upgrade to $DBversion done (Adds feature Bug 8917, the ability to track links clicked)"; + SetVersion($DBversion); } $DBversion = "3.11.00.024"; diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index cc1d5e3b4d..5c07cddee1 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -35,7 +35,7 @@ if ($uri) { # we have a uri and we want to track if ( $trackinglinks eq 'track' ) { my ( $user, $cookie, $sessionID, $flags ) = - checkauth( $cgi, 1, '', 'opac' ); + checkauth( $cgi, 1, {}, 'opac' ); my $userenv = C4::Context->userenv; if ( defined($userenv) From 673e674b75c61f362e903ee9f10558e55c9ecae3 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sat, 2 Mar 2013 09:50:07 +1300 Subject: [PATCH 06/10] Bug 8917 : Shifting db dependent code to a module Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- Koha/Linktracker.pm | 69 +++++++++++++++++++++++++++++++++++++++++++++ opac/tracklinks.pl | 31 ++++++++++---------- 2 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 Koha/Linktracker.pm diff --git a/Koha/Linktracker.pm b/Koha/Linktracker.pm new file mode 100644 index 0000000000..52e68be19e --- /dev/null +++ b/Koha/Linktracker.pm @@ -0,0 +1,69 @@ +package Koha::Linktracker; + +# Copyright 2013 chris@bigballofwax.co.nz +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +=head1 NAME + +Koha::Linktracker + +=head1 SYNOPSIS + + use Koha::Linktracker; + my $tracker = Koha::Linktracker->new(); + $tracker->trackclick( $linkinfo ); + +=head1 DESCRIPTION + +=head1 FUNCTIONS + +=cut + +use Modern::Perl; +use Carp; +use C4::Context; +use base qw(Class::Accessor); + +__PACKAGE__->mk_accessors(qw( trackingmethod )); + +sub trackclick { + my ( $self, $linkinfo ) = @_; + my $dbh = C4::Context->dbh(); + my $query = "INSERT INTO linktracker (biblionumber,itemnumber,borrowernumber + ,url,timeclicked) VALUES (?,?,?,?,now())"; + my $sth = $dbh->prepare($query); + $sth->execute( + $linkinfo->{biblionumber}, $linkinfo->{itemnumber}, + $linkinfo->{borrowernumber}, $linkinfo->{uri} + ); + +} + +=head2 EXPORT + +None by default. + + +=head1 AUTHOR + +Chris Cormack, Echris@bigballofwax.co.nzE + +=cut + +1; + +__END__ diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl index 5c07cddee1..7182fdb4ee 100755 --- a/opac/tracklinks.pl +++ b/opac/tracklinks.pl @@ -21,19 +21,23 @@ use Modern::Perl; use C4::Context; use C4::Auth qw(checkauth); +use Koha::Linktracker; use CGI; -my $trackinglinks = C4::Context->preference('TrackClicks'); - my $cgi = new CGI; my $uri = $cgi->param('uri') || ''; +my $tracker = Koha::Linktracker->new( + { trackingmethod => C4::Context->preference('TrackClicks') } ); + if ($uri) { - if ( $trackinglinks eq 'track' || $trackinglinks eq 'anonymous' ) { + if ( $tracker->trackingmethod() eq 'track' + || $tracker->trackingmethod() eq 'anonymous' ) + { my $borrowernumber = 0; # we have a uri and we want to track - if ( $trackinglinks eq 'track' ) { + if ( $tracker->trackingmethod() eq 'track' ) { my ( $user, $cookie, $sessionID, $flags ) = checkauth( $cgi, 1, {}, 'opac' ); my $userenv = C4::Context->userenv; @@ -50,7 +54,14 @@ if ($uri) { my $biblionumber = $cgi->param('biblionumber') || 0; my $itemnumber = $cgi->param('itemnumber') || 0; - trackclick( $uri, $biblionumber, $borrowernumber, $itemnumber ); + $tracker->trackclick( + { + uri => $uri, + biblionumber => $biblionumber, + borrowernumber => $borrowernumber, + itemnumber => $itemnumber + } + ); print $cgi->redirect($uri); } else { @@ -65,13 +76,3 @@ else { print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } - -sub trackclick { - my ( $uri, $biblionumber, $borrowernumber, $itemnumber ) = @_; - my $dbh = C4::Context->dbh(); - my $query = "INSERT INTO linktracker (biblionumber,itemnumber,borrowernumber - ,url,timeclicked) VALUES (?,?,?,?,now())"; - my $sth = $dbh->prepare($query); - $sth->execute( $biblionumber, $itemnumber, $borrowernumber, $uri ); - -} From 44861cd64d3278ac2e6cc8d98ff9a2dfff205619 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sat, 2 Mar 2013 10:09:22 +1300 Subject: [PATCH 07/10] Bug 8917 : Follow up fixing bad behaviour that existed prior to this feature But the bug only becomes visible with link tracking on Prior to this patch it would put an empty link in the html Signed-off-by: Bernardo Gonzalez Kriegel General comment: Work as described. No errors. Tested all preference values with and without logged in user. Signed-off-by: Jonathan Druart --- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index ac5c0b78b1..04c0811b42 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1489,14 +1489,15 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %] [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] [% IF ( itemdata_uri ) %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - Link to resource - [% ELSE %] - [% ITEM_RESULT.uri %] + [% IF ITEM_RESULT.uri %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + Link to resource + [% ELSE %] + [% ITEM_RESULT.uri %] + [% END %] [% END %] [% END %] - [% IF ( itemdata_uri ) %][% ITEM_RESULT.uri %][% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] From 7047b7eea0a0125cfbcdfec409d824389e900592 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Fri, 1 Mar 2013 19:54:37 -0300 Subject: [PATCH 08/10] Bug 8917 : [ Sign followup ] Track clicks to links external to Koha Remove empty pod section in Koha/Linktracker.pm to make koha-qa happy. Add missing "\n" in installer/data/mysql/updatedatabase.pl Signed-off-by: Jonathan Druart --- Koha/Linktracker.pm | 2 -- installer/data/mysql/updatedatabase.pl | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Koha/Linktracker.pm b/Koha/Linktracker.pm index 52e68be19e..5255d06660 100644 --- a/Koha/Linktracker.pm +++ b/Koha/Linktracker.pm @@ -27,8 +27,6 @@ Koha::Linktracker my $tracker = Koha::Linktracker->new(); $tracker->trackclick( $linkinfo ); -=head1 DESCRIPTION - =head1 FUNCTIONS =cut diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index b28b75fbb3..1137c00b70 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6465,7 +6465,7 @@ if ( CheckVersion($DBversion) ) { INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TrackClicks','0','Track links clicked',NULL,'Integer')" ); print -"Upgrade to $DBversion done (Adds feature Bug 8917, the ability to track links clicked)"; +"Upgrade to $DBversion done (Adds feature Bug 8917, the ability to track links clicked)\n"; SetVersion($DBversion); } From 41929aa8eecdcdf21f1a73525226fc1e69dee247 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Mar 2013 16:43:38 +0100 Subject: [PATCH 09/10] Bug 8917: replaces tab with spaces Signed-off-by: Jonathan Druart --- .../opac-tmpl/prog/en/modules/opac-detail.tt | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 04c0811b42..6321efd3e9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -715,21 +715,21 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
  • [% IF ( MARCurl.part ) %][% MARCurl.part %]
    [% END %] - + [% IF ( OPACurlOpenInNewWindow ) %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - - [% ELSE %] - - [% END %] - [% END %] - + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + + [% ELSE %] + + [% END %] + [% END %] + [% MARCurl.linktext %] [% IF ( MARCurl.notes ) %]
      [% FOREACH note IN MARCurl.notes %]
    • [% note.note %]
    • [% END %]
    [% END %]
  • [% END %] @@ -1488,16 +1488,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( itemdata_ccode ) %][% ITEM_RESULT.ccode %][% END %] [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %] [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] - [% IF ( itemdata_uri ) %] - [% IF ITEM_RESULT.uri %] - [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] - Link to resource - [% ELSE %] - [% ITEM_RESULT.uri %] - [% END %] - [% END %] - - [% END %] + [% IF ( itemdata_uri ) %] + [% IF ITEM_RESULT.uri %] + [% IF trackclicks == 'track' || trackclicks == 'anonymous' %] + Link to resource + [% ELSE %] + [% ITEM_RESULT.uri %] + [% END %] + [% END %] + + [% END %] [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] From 65522e25ca8dd90b52e206288b6d0e51213a5b63 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 7 Mar 2013 11:16:43 -0500 Subject: [PATCH 10/10] Bug 8917: Increment version number Database update for bug 8917 has been given version 3.11.00.025 --- installer/data/mysql/updatedatabase.pl | 2 +- kohaversion.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1137c00b70..405e033cec 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6444,7 +6444,7 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } -$DBversion = "3.11.00.XXX"; +$DBversion = "3.11.00.025"; if ( CheckVersion($DBversion) ) { $dbh->do( "CREATE TABLE linktracker ( diff --git a/kohaversion.pl b/kohaversion.pl index 015f9d3415..7276d74785 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.11.00.024'; + our $VERSION = '3.11.00.025'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install