Lines 32-39
if ( ! C4::Context->preference('OPACPrivacy') || ! C4::Context->preference('opac
Link Here
|
32 |
exit; |
32 |
exit; |
33 |
} |
33 |
} |
34 |
|
34 |
|
35 |
my $dbh = C4::Context->dbh; |
|
|
36 |
|
37 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
35 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
38 |
{ |
36 |
{ |
39 |
template_name => "opac-privacy.tt", |
37 |
template_name => "opac-privacy.tt", |
Lines 42-54
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Link Here
|
42 |
} |
40 |
} |
43 |
); |
41 |
); |
44 |
|
42 |
|
|
|
43 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
44 |
|
45 |
my $op = $query->param("op"); |
45 |
my $op = $query->param("op"); |
46 |
my $privacy = $query->param("privacy"); |
46 |
my $privacy = $query->param("privacy"); |
47 |
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts"); |
47 |
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts"); |
48 |
my $privacy_guarantor_fines = $query->param("privacy_guarantor_fines"); |
48 |
my $privacy_guarantor_fines = $query->param("privacy_guarantor_fines"); |
49 |
|
49 |
|
50 |
if ( $op eq "update_privacy" ) { |
50 |
if ( $op eq "update_privacy" ) { |
51 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
52 |
if ( $patron ) { |
51 |
if ( $patron ) { |
53 |
$patron->set({ |
52 |
$patron->set({ |
54 |
privacy => $privacy, |
53 |
privacy => $privacy, |
Lines 60-89
if ( $op eq "update_privacy" ) {
Link Here
|
60 |
} |
59 |
} |
61 |
elsif ( $op eq "delete_record" ) { |
60 |
elsif ( $op eq "delete_record" ) { |
62 |
|
61 |
|
63 |
# delete all reading records for items returned |
62 |
my $holds = $query->param('holds'); |
64 |
my $rows = eval { |
63 |
my $checkouts = $query->param('checkouts'); |
65 |
Koha::Patrons->search({ 'me.borrowernumber' => $borrowernumber })->anonymise_issue_history; |
64 |
my $all = $query->param('all'); |
66 |
}; |
65 |
|
67 |
$template->param( |
66 |
$template->param( delete_all_quested => 1 ) |
68 |
( |
67 |
if $all; |
69 |
$@ ? ( history_not_deleted => 1 ) |
68 |
|
70 |
: $rows ? ( deleted => int($rows) ) |
69 |
if ( $all or $checkouts ) { |
71 |
: ( nothing_to_delete => 1 ) |
70 |
|
72 |
) |
71 |
# delete all reading records for items returned |
73 |
); |
72 |
my $rows = eval { |
74 |
} |
73 |
Koha::Patrons->search( { 'me.borrowernumber' => $borrowernumber } ) |
|
|
74 |
->anonymise_issue_history; |
75 |
}; |
75 |
|
76 |
|
76 |
# get borrower privacy .... |
77 |
$template->param( |
77 |
my $borrower = Koha::Patrons->find( $borrowernumber );; |
78 |
( |
|
|
79 |
$@ ? ( error_deleting_checkouts_history => 1 ) |
80 |
: $rows ? ( deleted_checkouts => int($rows) ) |
81 |
: ( no_checkouts_to_delete => 1 ) |
82 |
), |
83 |
delete_checkouts_requested => 1, |
84 |
); |
85 |
} |
86 |
|
87 |
if ( $all or $holds ) { |
88 |
|
89 |
my $rows = eval { $patron->old_holds->anonymize + 0 }; |
90 |
|
91 |
$template->param( |
92 |
( |
93 |
$@ ? ( error_deleting_holds_history => 1 ) |
94 |
: $rows ? ( deleted_holds => int($rows) ) |
95 |
: ( no_holds_to_delete => 1 ) |
96 |
), |
97 |
delete_holds_requested => 1, |
98 |
); |
99 |
} |
100 |
} |
78 |
|
101 |
|
79 |
$template->param( |
102 |
$template->param( |
80 |
'Ask_data' => 1, |
103 |
'Ask_data' => 1, |
81 |
'privacy' . $borrower->privacy() => 1, |
104 |
'privacy' . $patron->privacy() => 1, |
82 |
'privacyview' => 1, |
105 |
'privacyview' => 1, |
83 |
'borrower' => $borrower, |
106 |
'borrower' => $patron, |
84 |
'surname' => $borrower->surname, |
107 |
'surname' => $patron->surname, |
85 |
'firstname' => $borrower->firstname, |
108 |
'firstname' => $patron->firstname, |
86 |
'has_guarantor_flag' => $borrower->guarantor_relationships->guarantors->_resultset->count |
109 |
'has_guarantor_flag' => $patron->guarantor_relationships->guarantors->_resultset->count |
87 |
); |
110 |
); |
88 |
|
111 |
|
89 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
112 |
output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; |
90 |
- |
|
|