Koha/opac/opac-privacy.pl
Ian Walls a0dc124a95 Bug 3881: OPAC Privacy reimplementation
Reimplements Paul Poulain's original OPAC Privacy patch, with some minor improvements and changes to wording

If the library enables the OPACPrivacy system preference along with the opacreadinghistory preference, and sets
an AnonymousPatron (must be a valid patron number in the database), the user will see a new tab upon login to
the OPAC, My Privacy.  From there, the user can:

- Set their OPAC Privacy to one of three values
  0 - Forever.  This keeps their reading history unless they explicitly delete it; the bulk anonymiser won't touch it
  1 - Default.  Keep reading history until either they delete it or the library does
  2 - Never.    Instantly anonymises reading history upon item return

- Instantly delete their reading history
  There is a warning and a popup to confirm.  I've removed Paul's extra confirm checkbox, which seemed redundant

A note of which preference the patron has selected is added to the Patorn Details page in the staff client.  This is read-only.

This patch also consolidates Privacy system preferences into the Privacy section of the OPAC tab.

Thank you to BibLibre for the original implmentation of this patch, and Los Gatos Public Library for funding and
testing the reimplementation.

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-01-31 22:23:50 +13:00

68 lines
2.1 KiB
Perl
Executable file

#!/usr/bin/perl
# This script lets the users change their privacy rules
#
# copyright 2009, BibLibre, paul.poulain@biblibre.com
#
# 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., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Context;
use C4::Circulation;
use C4::Members;
use C4::Output;
use C4::Dates;
my $query = new CGI;
my $dbh = C4::Context->dbh;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-privacy.tmpl",
query => $query,
type => "opac",
authnotrequired => 0,
flagsrequired => { borrow => 1 },
debug => 1,
}
);
my $op = $query->param("op");
my $privacy = $query->param("privacy");
if ($op eq "update_privacy")
{
ModPrivacy($borrowernumber,$privacy);
$template->param('privacy_updated' => 1);
}
if ($op eq "delete_record") {
# delete all reading records for items returned
# uses a hardcoded date ridiculously far in the future
AnonymiseIssueHistory('2999-12-12',$borrowernumber);
# confirm the user the deletion has been done
$template->param('deleted' => 1);
}
# get borrower privacy ....
my ( $borr ) = GetMemberDetails( $borrowernumber );
$template->param( 'Ask_data' => '1',
'privacy'.$borr->{'privacy'} => 1,
'firstname' => $borr->{'firstname'},
'surname' => $borr->{'surname'},
'privacyview' => 1,
);
output_html_with_http_headers $query, $cookie, $template->output;