Bug 29843: Use in opac/opac-privacy.pl

This patch makes the opac/opac-privacy.pl OPAC page use the new
anonymize method.

To test:
1. Have some checked-in materiales
2. Have OPACPrivacy enabled
3. Notice your checkouts history contains what you expect
4. Go to 'your privacy'
5. Click on 'Delete checkout history'
=> SUCCESS: It works, no crash.
6. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomás Cohen Arazi 2022-01-10 11:44:07 -03:00 committed by Fridolin Somers
parent daff241b1d
commit 9e2432bc63

View file

@ -40,13 +40,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
my $patron = Koha::Patrons->find( $borrowernumber );
my $op = $query->param("op");
my $privacy = $query->param("privacy");
my $privacy_guarantor_checkouts = $query->param("privacy_guarantor_checkouts");
my $privacy_guarantor_fines = $query->param("privacy_guarantor_fines");
my $patron = Koha::Patrons->find( $borrowernumber );
if ( $op eq "update_privacy" ) {
if ( $patron ) {
$patron->set({
@ -69,10 +69,7 @@ elsif ( $op eq "delete_record" ) {
if ( $all or $checkouts ) {
# delete all reading records for items returned
my $rows = eval {
Koha::Patrons->search( { 'me.borrowernumber' => $borrowernumber } )
->anonymise_issue_history;
};
my $rows = eval { $patron->old_checkouts->anonymize + 0 };
$template->param(
(