Bugzilla – Attachment 95772 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: (QA follow-up) Use ->update instead of ->next
Bug-23260-QA-follow-up-Use--update-instead-of--nex.patch (text/plain), 2.50 KB, created by
Marcel de Rooy
on 2019-11-25 09:05:33 UTC
(
hide
)
Description:
Bug 23260: (QA follow-up) Use ->update instead of ->next
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-11-25 09:05:33 UTC
Size:
2.50 KB
patch
obsolete
>From 458a381fe74d67e21f91993a9466cfb56e24ddb3 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 21 Nov 2019 09:22:28 +0000 >Subject: [PATCH] Bug 23260: (QA follow-up) Use ->update instead of ->next >Content-Type: text/plain; charset=utf-8 > >Also moves initialization of $anonymous_patron closer to associated comment >lines. >And removes the unneeded changes from Koha::Patrons. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Please see comment34 on use of update method. >--- > Koha/Item/LastPatrons.pm | 10 ++++------ > Koha/Patrons.pm | 2 -- > 2 files changed, 4 insertions(+), 8 deletions(-) > >diff --git a/Koha/Item/LastPatrons.pm b/Koha/Item/LastPatrons.pm >index 7ed7c8fd5d..62dd878349 100644 >--- a/Koha/Item/LastPatrons.pm >+++ b/Koha/Item/LastPatrons.pm >@@ -56,8 +56,9 @@ sub anonymise_items_last_borrower { > # The default of 0 does not work due to foreign key constraints > # The anonymisation should not fail quietly if AnonymousPatron is not a valid entry > # Set it to undef (NULL) >+ my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; >+ > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >- my $nb_rows = 0; > my $last_borrowers = $self->search( > { > ( >@@ -68,11 +69,8 @@ sub anonymise_items_last_borrower { > ) > } > ); >- my $anonymous_patron = C4::Context->preference('AnonymousPatron') || undef; >- while(my $last_borrower = $last_borrowers->next) { >- $last_borrower->borrowernumber( $anonymous_patron )->store; >- $nb_rows++; >- } >+ my $nb_rows = $last_borrowers->count; # unaffected by update >+ $last_borrowers->update({ borrowernumber => $anonymous_patron }); > return $nb_rows; > } > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 1935dd8d48..fbe696ec7a 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -31,7 +31,6 @@ use Koha::Patron; > use Koha::Exceptions::Patron; > use Koha::Patron::Categories; > use Date::Calc qw( Today Add_Delta_YMD ); >-use Koha::Item::LastPatrons; > > use base qw(Koha::Objects); > >@@ -140,7 +139,6 @@ sub search_patrons_to_anonymise { > my ( $class, $params ) = @_; > my $older_than_date = $params->{before}; > my $library = $params->{library}; >- > $older_than_date = $older_than_date ? dt_from_string($older_than_date) : dt_from_string; > $library ||= > ( C4::Context->preference('IndependentBranches') && C4::Context->userenv && !C4::Context->IsSuperLibrarian() && C4::Context->userenv->{branch} ) >-- >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