From 6f8a368ef2ae8548864c1638cb163688573ea884 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 16 Dec 2011 16:32:40 -0500 Subject: [PATCH] Bug 5503 - comments shouldn't show patron's full name Content-Type: text/plain; charset="utf-8" Adding a few choices for what information can be displayed alongside comments in the OPAC: - nothing - full name - first name - last name - first name and last name first initial - username --- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 8 +++++ .../prog/en/modules/admin/preferences/opac.pref | 11 +++++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 30 ++++++++++++------- .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 16 +++++++++- opac/opac-showreviews.pl | 2 + 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 128c9b2..1f603f5 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -103,7 +103,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnBeforeExpiry',0,'If ON, checkout will be prevented if returndate is after patron card expiry',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer','full','Choose how a commenter\'s identity is presented alongside comments in the OPAC','none|full|first|surname|firstandinitial|username','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0063a75..e4266b0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4578,6 +4578,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.06.02.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(" UPDATE `koha`.`systempreferences` SET `value` = 'none', `options` = 'none|full|first|surname|firstandinitial|username', `explanation` = 'Choose how a commenter\'s identity is presented alongside comments in the OPAC', `type` = 'Choice' WHERE `systempreferences`.`variable` = 'ShowReviewer' AND `systempreferences`.`variable` = 0"); + $dbh->do(" UPDATE `koha`.`systempreferences` SET `value` = 'full', `options` = 'none|full|first|surname|firstandinitial|username', `explanation` = 'Choose how a commenter\'s identity is presented alongside comments in the OPAC', `type` = 'Choice' WHERE `systempreferences`.`variable` = 'ShowReviewer' AND `systempreferences`.`variable` = 1"); + print "Adding additional options for the display of commenter's identity in the OPAC: Full name, first name, last name, first name and last name first initial, username, or no information\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) 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 d6ae2b2..cd051de 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 @@ -270,11 +270,16 @@ OPAC: no: "Don't allow" - patrons to make comments on items on the OPAC. - + - Show - pref: ShowReviewer choices: - yes: Show - no: Hide - - reviewer's name above comments in OPAC. + none: no name + full: full name + first: first name + surname: last name + firstandinitial: first name and last name initial + username: username + - of commenter with comments in OPAC. - - pref: ShowReviewerPhoto choices: 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 d1b6570..ba987c9 100755 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -865,18 +865,26 @@ YAHOO.util.Event.onContentReady("furtherm", function () {

[% ELSE %]
- [% IF ( ShowReviewer ) %] - [% IF ( review.avatarurl ) %] - - [% END %] -
- Comment by - [% review.title %] - [% review.firstname %] - [% review.surname %] -
+ [% IF ( ShowReviewer != "none" ) %] + [% IF ( review.avatarurl ) %] + + [% END %] + [% SWITCH ShowReviewer %] + [% CASE 'full' %] +
Comment by [% review.title %] [% review.firstname %] [% review.surname %]
+ [% CASE 'first' %] +
Comment by [% review.firstname %]
+ [% CASE 'surname' %] +
Comment by [% review.surname %]
+ [% CASE 'firstandinitial' %] +
Comment by [% review.firstname %] [% review.surname|truncate(2,'.') %]
+ [% CASE 'username' %] +
Comment by [% review.userid %]
+ [% END %] + [% review.datereviewed %] + [% ELSIF ( ShowReviewer == "none") %] +
Patron comment on [% review.datereviewed %]
[% END %] - [% review.datereviewed %]

[% review.review %]

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt index d9a630f..9370767 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt @@ -52,8 +52,20 @@ $(document).ready(function(){ [% END %] [% review.review |html %] Added [% review.datereviewed %] [% IF ( review.your_comment ) %] by you[% ELSE %] - [% IF ( ShowReviewer ) %] by - [% review.firstname %] [% review.surname %][% END %][% END %]

+ [% IF ( ShowReviewer != "none" ) %] by + [% SWITCH ShowReviewer %] + [% CASE 'full' %] + [% review.borrtitle %] [% review.firstname %] [% review.surname %] + [% CASE 'first' %] + [% review.firstname %] + [% CASE 'surname' %] + [% review.surname %] + [% CASE 'firstandinitial' %] + [% review.firstname %] [% review.surname|truncate(2,'.') %] + [% CASE 'username' %] + [% review.userid %] + [% END %] + [% END %][% END %]

diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 74f4684..449ffcd 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -101,8 +101,10 @@ for my $result (@$reviews){ $result->{size} = $bib->{'size'}; $result->{notes} = $bib->{'notes'}; $result->{timestamp} = $bib->{'timestamp'}; + $result->{borrtitle} = $borr->{'title'}; $result->{firstname} = $borr->{'firstname'}; $result->{surname} = $borr->{'surname'}; + $result->{userid} = $borr->{'userid'}; if ($libravatar_enabled and $borr->{'email'}) { $result->{avatarurl} = libravatar_url(email => $borr->{'email'}, size => 40, https => $ENV{HTTPS}); } -- 1.7.5.4