Bugzilla – Attachment 117980 Details for
Bug 23260
Anonymize (remove) patron data from items_last_borrower
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23260: (follow-up) Add AnonymiseLastBorrower and AnonymiseLastBorrowerDays sysprefs
Bug-23260-follow-up-Add-AnonymiseLastBorrower-and-.patch (text/plain), 6.03 KB, created by
Nick Clemens (kidclamp)
on 2021-03-09 14:42:43 UTC
(
hide
)
Description:
Bug 23260: (follow-up) Add AnonymiseLastBorrower and AnonymiseLastBorrowerDays sysprefs
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-03-09 14:42:43 UTC
Size:
6.03 KB
patch
obsolete
>From 10f7b2ee22480f1689c0f079aeddf7c00b7efc2d Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 30 Oct 2020 15:17:25 -0300 >Subject: [PATCH] Bug 23260: (follow-up) Add AnonymiseLastBorrower and > AnonymiseLastBorrowerDays sysprefs > >--- > installer/data/mysql/atomicupdate/bug_23260.perl | 9 ++- > installer/data/mysql/mandatory/sysprefs.sql | 2 + > .../prog/en/modules/admin/preferences/patrons.pref | 8 +++ > misc/cronjobs/anonymise_last_borrowers.pl | 75 ++++++++++++++++++++++ > 4 files changed, 92 insertions(+), 2 deletions(-) > create mode 100755 misc/cronjobs/anonymise_last_borrowers.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_23260.perl b/installer/data/mysql/atomicupdate/bug_23260.perl >index b758f58b33..2e66865b19 100644 >--- a/installer/data/mysql/atomicupdate/bug_23260.perl >+++ b/installer/data/mysql/atomicupdate/bug_23260.perl >@@ -3,6 +3,11 @@ if( CheckVersion( $DBversion ) ) { > # you can use $dbh here like: > $dbh->do( "ALTER TABLE items_last_borrower MODIFY COLUMN `borrowernumber` int(11) default NULL" ); > >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23260 - make borrowernumber from items_last_borrower nullable)\n"; >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('AnonymiseLastBorrower','0',NULL,'If enabled, anonymise item\'s last borrower','YesNo'), >+ ('AnonymiseLastBorrowerDays','0',NULL,'Item\'s last borrower older than this preference will be anonymised','Integer') >+ }); >+ >+ NewVersion( $DBversion, 23260, "Make borrowernumber from items_last_borrower nullable, and add AnonymiseLastBorrower and AnonymiseLastBorrowerDays preferences"); > } >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 3ead03b283..94a60693d0 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -53,6 +53,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AmazonCoverImages','0','','Display Cover Images in staff interface from Amazon Web Services','YesNo'), > ('AmazonLocale','US','US|CA|DE|FR|IN|JP|UK','Use to set the Locale of your Amazon.com Web Services','Choice'), > ('AnonSuggestions','0',NULL,'Set to enable Anonymous suggestions to AnonymousPatron borrowernumber','YesNo'), >+('AnonymiseLastBorrower','0',NULL,'If enabled, anonymise item\'s last borrower','YesNo'), >+('AnonymiseLastBorrowerDays','0',NULL,'Item\'s last borrower older than this preference will be anonymised','Integer'), > ('AnonymousPatron','0',NULL,'Set the identifier (borrowernumber) of the anonymous patron. Used for suggestion and checkout history privacy',''), > ('ArticleRequests', '0', NULL, 'Enables the article request feature', 'YesNo'), > ('ArticleRequestsLinkControl', 'calc', 'always|calc', 'Control display of article request link on search results', 'Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 0792cba7c7..da4210d0e0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -334,6 +334,14 @@ Patrons: > - days and remove anonymized patron accounts after > - pref: PatronRemovalDelay > - "days.<br>IMPORTANT: No action is performed when these delays are empty (no text). But a zero value ('0') is interpreted as no delay (do it now)! The actions are performed by the cleanup database cron job." >+ - >+ - pref: AnonymiseLastBorrower >+ choices: >+ yes: Anonymise >+ no: "Don't anonymise" >+ - " item's last borrower after " >+ - pref: AnonymiseLastBorrowerDays >+ - days. > Security: > - > - Login passwords for staff and patrons must be at least >diff --git a/misc/cronjobs/anonymise_last_borrowers.pl b/misc/cronjobs/anonymise_last_borrowers.pl >new file mode 100755 >index 0000000000..a2dd57da43 >--- /dev/null >+++ b/misc/cronjobs/anonymise_last_borrowers.pl >@@ -0,0 +1,75 @@ >+ >+#!/usr/bin/perl >+ >+# Copyright 2011, ByWater Solutions. >+# >+# This file is part of Koha. >+# >+# 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 3 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, see <http://www.gnu.org/licenses>. >+ >+use strict; >+use warnings; >+use Carp; >+ >+BEGIN { >+ >+ # find Koha's Perl modules >+ # test carefully before changing this >+ use FindBin; >+ eval { require "$FindBin::Bin/../kohalib.pl" }; >+} >+ >+use Koha::Script -cron; >+use C4::Context; >+use Koha::Patrons; >+use Getopt::Long; >+use C4::Log; >+ >+ >+sub usage { >+ print STDERR <<USAGE; >+Usage: $0 --days DAYS [-h|--help] >+ -v --verbose gives a little more information >+ -h --help prints this help message, and exits, ignoring all >+ other options >+Note: If the system preference 'AnonymousPatron' is not defined, NULL will be used. >+USAGE >+ exit $_[0]; >+} >+ >+my ( $help, $days, $verbose ); >+ >+GetOptions( >+ 'h|help' => \$help, >+ 'v|verbose' => \$verbose, >+) || usage(1); >+ >+if ($help) { >+ usage(0); >+} >+ >+my $pref = C4::Context->preference("AnonymiseLastBorrower"); >+ >+ >+if( !$pref ) { >+ print "Preference 'AnonymiseLastBorrower' must be enabled to anonymise item's last borrower\n\n"; >+ usage(1); >+} >+ >+cronlogaction(); >+ >+my $rows = Koha::Patrons->anonymise_last_borrowers(); >+$verbose and print int($rows) . " item's last borrowers anonymised.\n"; >+ >+exit(0); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23260
:
92863
|
92864
|
93052
|
94858
|
94859
|
95033
|
95457
|
95458
|
95459
|
95460
|
95651
|
95698
|
95699
|
95700
|
95701
|
95769
|
95770
|
95771
|
95772
|
96791
|
97841
|
97842
|
98044
|
98053
|
98054
|
98064
|
98282
|
98349
|
98352
|
112734
|
112735
|
112736
|
112737
|
112738
|
112739
|
112740
|
112741
|
112742
|
112743
|
117974
|
117975
|
117976
|
117977
|
117978
|
117979
|
117980
|
117981
|
117982
|
117983
|
120522
|
120523
|
120524
|
120525
|
120526
|
120527
|
120528
|
120529
|
120530
|
120531
|
122963
|
122964
|
122965
|
122966
|
122967
|
122968
|
122969
|
122970
|
122971
|
122972
|
145175
|
145176
|
145177
|
145178
|
145179
|
145180
|
145181
|
145182
|
145183
|
145184
|
157106
|
157107
|
157108
|
157109
|
157110
|
157111
|
157112
|
157113
|
157114
|
157115
|
157116
|
159291
|
159292
|
159293
|
159294
|
159298
|
159299
|
159300
|
159301
|
164129
|
164130
|
164131
|
164132
|
164133