Bug 11552: (follow-up) fix a typo in a comment
[koha.git] / opac / opac-privacy.pl
blob22fe694e58596d07f6f19fb276cc908191c07a26
1 #!/usr/bin/perl
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 under the
7 # terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
9 # version.
11 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with Koha; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 use strict;
20 use CGI;
22 use C4::Auth; # checkauth, getborrowernumber.
23 use C4::Context;
24 use C4::Circulation;
25 use C4::Members;
26 use C4::Output;
27 use C4::Dates;
29 my $query = new CGI;
30 my $dbh = C4::Context->dbh;
32 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34 template_name => "opac-privacy.tmpl",
35 query => $query,
36 type => "opac",
37 authnotrequired => 0,
38 flagsrequired => { borrow => 1 },
39 debug => 1,
43 my $op = $query->param("op");
44 my $privacy = $query->param("privacy");
46 if ($op eq "update_privacy")
48 ModPrivacy($borrowernumber,$privacy);
49 $template->param('privacy_updated' => 1);
51 if ($op eq "delete_record") {
52 # delete all reading records for items returned
53 # uses a hardcoded date ridiculously far in the future
54 my ($rows,$err_history_not_deleted) = AnonymiseIssueHistory('2999-12-12',$borrowernumber);
55 # confirm the user the deletion has been done
56 if ( !$err_history_not_deleted ) {
57 $template->param( 'deleted' => 1 );
59 else {
60 $template->param( 'err_history_not_deleted' => 1 );
63 # get borrower privacy ....
64 my ( $borr ) = GetMemberDetails( $borrowernumber );
66 $template->param( 'Ask_data' => '1',
67 'privacy'.$borr->{'privacy'} => 1,
68 'firstname' => $borr->{'firstname'},
69 'surname' => $borr->{'surname'},
70 'privacyview' => 1,
73 output_html_with_http_headers $query, $cookie, $template->output;