Bugzilla – Attachment 88222 Details for
Bug 22729
flgAnonymized shouldn't be NULL and should be renamed anonymized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22729: Adapt Koha::Patron(s) and tests
Bug-22729-Adapt-KohaPatrons-and-tests.patch (text/plain), 4.20 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-04-17 18:18:01 UTC
(
hide
)
Description:
Bug 22729: Adapt Koha::Patron(s) and tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-04-17 18:18:01 UTC
Size:
4.20 KB
patch
obsolete
>From 221efa856f3c71b4e120e00ce31637c933e26e8c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 17 Apr 2019 15:03:25 -0300 >Subject: [PATCH] Bug 22729: Adapt Koha::Patron(s) and tests > >This patch adapts the Koha::Patron(s) code to the column change. >To test: >- Apply this patches >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Patrons.t >=> SUCCESS: Tests pass! >- Sign off :-D >--- > Koha/Patron.pm | 4 ++-- > Koha/Patrons.pm | 4 ++-- > t/db_dependent/Koha/Patrons.t | 10 +++++----- > 3 files changed, 9 insertions(+), 9 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index c3326285b9..6a25d717c1 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1362,12 +1362,12 @@ sub anonymize { > split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') }; > $mandatory->{userid} = 1; # needed since sub store does not clear field > my @columns = $self->_result->result_source->columns; >- @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|flags|updated_on|lastseen|lang|login_attempts|flgAnonymized/ } @columns; >+ @columns = grep { !/borrowernumber|branchcode|categorycode|^date|password|flags|updated_on|lastseen|lang|login_attempts|anonymized/ } @columns; > push @columns, 'dateofbirth'; # add this date back in > foreach my $col (@columns) { > $self->_anonymize_column($col, $mandatory->{lc $col} ); > } >- $self->flgAnonymized(1)->store; >+ $self->anonymized(1)->store; > } > > sub _anonymize_column { >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index b35e6cc4a8..7510093185 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -293,7 +293,7 @@ sub search_anonymize_candidates { > my $dt = dt_from_string()->subtract( days => $delay ); > my $str = $parser->format_datetime($dt); > $cond->{dateexpiry} = { '<=' => $str }; >- $cond->{flgAnonymized} = [ undef, 0 ]; # not yet done >+ $cond->{anonymized} = 0; # not yet done > if( $params->{locked} ) { > my $fails = C4::Context->preference('FailedLoginAttempts'); > $cond->{login_attempts} = [ -and => { '!=' => undef }, { -not_in => [0, 1..$fails-1 ] } ]; # -not_in does not like undef >@@ -324,7 +324,7 @@ sub search_anonymized { > my $dt = dt_from_string()->subtract( days => $delay ); > my $str = $parser->format_datetime($dt); > $cond->{dateexpiry} = { '<=' => $str }; >- $cond->{flgAnonymized} = 1; >+ $cond->{anonymized} = 1; > return $class->search( $cond ); > } > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index b248729de0..7e4a535f9e 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1663,9 +1663,9 @@ subtest 'search_anonymize_candidates' => sub { > plan tests => 5; > my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); > my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); >- $patron1->flgAnonymized(0); >+ $patron1->anonymized(0); > $patron1->dateexpiry( dt_from_string->add(days => 1) )->store; >- $patron2->flgAnonymized(undef); >+ $patron2->anonymized(0); > $patron2->dateexpiry( dt_from_string->add(days => 1) )->store; > > t::lib::Mocks::mock_preference( 'PatronAnonymizeDelay', q{} ); >@@ -1713,9 +1713,9 @@ subtest 'search_anonymized' => sub { > > t::lib::Mocks::mock_preference( 'PatronRemovalDelay', 1 ); > $patron1->dateexpiry( dt_from_string ); >- $patron1->flgAnonymized(0)->store; >+ $patron1->anonymized(0)->store; > my $cnt = Koha::Patrons->search_anonymized->count; >- $patron1->flgAnonymized(1)->store; >+ $patron1->anonymized(1)->store; > is( Koha::Patrons->search_anonymized->count, $cnt, 'Number unchanged' ); > $patron1->dateexpiry( dt_from_string->subtract(days => 1) )->store; > is( Koha::Patrons->search_anonymized->count, $cnt+1, 'Found patron1' ); >@@ -1775,7 +1775,7 @@ subtest 'anonymize' => sub { > my $surname = $patron1->surname; # expect change, no clear > my $branchcode = $patron1->branchcode; # expect skip > $patron1->anonymize; >- is($patron1->flgAnonymized, 1, 'Check flag' ); >+ is($patron1->anonymized, 1, 'Check flag' ); > > is( $patron1->dateofbirth, undef, 'Birth date cleared' ); > is( $patron1->firstname, undef, 'First name cleared' ); >-- >2.21.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 22729
:
88222
|
88223
|
88224
|
88337
|
88338
|
88339
|
88340
|
88349
|
88350
|
88351
|
88352
|
88353
|
88692
|
88693
|
88694
|
88695
|
88696
|
88745