2 # This script lets the users change their privacy rules
4 # copyright 2009, BibLibre, paul.poulain@biblibre.com
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
22 use C4
::Auth
; # checkauth, getborrowernumber.
30 # if OPACPrivacy is disabled, leave immediately
31 if ( ! C4
::Context
->preference('OPACPrivacy') || ! C4
::Context
->preference('opacreadinghistory') ) {
32 print $query->redirect("/cgi-bin/koha/errors/404.pl");
36 my $dbh = C4
::Context
->dbh;
38 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
40 template_name
=> "opac-privacy.tt",
48 my $op = $query->param("op");
49 my $privacy = $query->param("privacy");
51 if ($op eq "update_privacy")
53 ModPrivacy
($borrowernumber,$privacy);
54 $template->param('privacy_updated' => 1);
56 if ($op eq "delete_record") {
57 # delete all reading records for items returned
58 # uses a hardcoded date ridiculously far in the future
59 my ($rows,$err_history_not_deleted) = AnonymiseIssueHistory
('2999-12-12',$borrowernumber);
60 # confirm the user the deletion has been done
61 if ( !$err_history_not_deleted ) {
62 $template->param( 'deleted' => 1 );
65 $template->param( 'err_history_not_deleted' => 1 );
69 # get borrower privacy ....
70 my $borr = C4
::Members
::GetMember
( borrowernumber
=> $borrowernumber );
72 $template->param( 'Ask_data' => '1',
73 'privacy'.$borr->{'privacy'} => 1,
74 'firstname' => $borr->{'firstname'},
75 'surname' => $borr->{'surname'},
79 output_html_with_http_headers
$query, $cookie, $template->output, undef, { force_no_caching
=> 1 };