Bugzilla – Attachment 181211 Details for
Bug 39652
Pseudonymized_borrower_attributes causes subsequent pseudonymized_transactions to not be added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39652: Rename new_from_statistic
Bug-39652-Rename-newfromstatistic.patch (text/plain), 5.51 KB, created by
David Nind
on 2025-04-19 09:27:56 UTC
(
hide
)
Description:
Bug 39652: Rename new_from_statistic
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-04-19 09:27:56 UTC
Size:
5.51 KB
patch
obsolete
>From 9b1e564e54466eee963461c0a0097b5fac2e0cc9 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Thu, 17 Apr 2025 15:55:23 +0000 >Subject: [PATCH] Bug 39652: Rename new_from_statistic > >This new method name better reflects the fact that it now creates - and stores - the PseudonymizedTransaction object > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/BackgroundJob/PseudonymizeStatistic.pm | 2 +- > Koha/PseudonymizedTransaction.pm | 6 +++--- > t/db_dependent/Koha/Pseudonymization.t | 10 +++++----- > t/db_dependent/Koha/PseudonymizedTransaction.t | 6 +++--- > 4 files changed, 12 insertions(+), 12 deletions(-) > >diff --git a/Koha/BackgroundJob/PseudonymizeStatistic.pm b/Koha/BackgroundJob/PseudonymizeStatistic.pm >index 822ee6c856..550a0153bb 100644 >--- a/Koha/BackgroundJob/PseudonymizeStatistic.pm >+++ b/Koha/BackgroundJob/PseudonymizeStatistic.pm >@@ -52,7 +52,7 @@ sub process { > $self->start; > my $statistic = $args->{statistic}; > my $stat_object = Koha::Statistic->new($statistic); >- Koha::PseudonymizedTransaction->new_from_statistic($stat_object); >+ Koha::PseudonymizedTransaction->create_from_statistic($stat_object); > $self->finish( { data => "" } ); # We want to clear the job data to avoid storing patron information > > } >diff --git a/Koha/PseudonymizedTransaction.pm b/Koha/PseudonymizedTransaction.pm >index f456c4d840..526411a408 100644 >--- a/Koha/PseudonymizedTransaction.pm >+++ b/Koha/PseudonymizedTransaction.pm >@@ -33,13 +33,13 @@ Koha::PseudonymizedTransaction - Koha Koha::PseudonymizedTransaction Object clas > > =head2 Class methods > >-=head3 new_from_statistic >+=head3 create_from_statistic > >- Creates new object from a passed Koha::Statistic object >+ Creates a new object from a passed Koha::Statistic object and stores it in the database > > =cut > >-sub new_from_statistic { >+sub create_from_statistic { > my ( $class, $statistic ) = @_; > > my $values = { >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index 3f73c778f4..ca3461c119 100755 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -64,7 +64,7 @@ subtest 'Config does not exist' => sub { > ccode => $item->ccode, > } > ); >- my $pseudo = Koha::PseudonymizedTransaction->new_from_statistic($stat); >+ my $pseudo = Koha::PseudonymizedTransaction->create_from_statistic($stat); > > } catch { > ok( >@@ -119,7 +119,7 @@ subtest 'Koha::Anonymized::Transactions tests' => sub { > ["Called"], "Background job enqueued when pseudonymization enabled"; > > my $statistic = Koha::Statistics->search( { itemnumber => $item->itemnumber } )->next; >- my $pseudonymized = Koha::PseudonymizedTransaction->new_from_statistic($statistic); >+ my $pseudonymized = Koha::PseudonymizedTransaction->create_from_statistic($statistic); > like( > $pseudonymized->hashed_borrowernumber, > qr{^\$2a\$08\$}, "The hashed_borrowernumber must be a bcrypt hash" >@@ -135,7 +135,7 @@ subtest 'Koha::Anonymized::Transactions tests' => sub { > is( $pseudonymized->itemcallnumber, $item->itemcallnumber, 'itemcallnumber copied correctly' ); > is( $pseudonymized->ccode, $item->ccode, 'ccode copied correctly' ); > >- my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($statistic); >+ my $next_p = Koha::PseudonymizedTransaction->create_from_statistic($statistic); > > isnt( > $pseudonymized->id, >@@ -223,7 +223,7 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > } > ); > >- my $p = Koha::PseudonymizedTransaction->new_from_statistic($statistic); >+ my $p = Koha::PseudonymizedTransaction->create_from_statistic($statistic); > my $attributes = > Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') > ->search( { transaction_id => $p->id }, { order_by => 'attribute' } ); >@@ -258,7 +258,7 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > } > ); > >- my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($second_statistic); >+ my $next_p = Koha::PseudonymizedTransaction->create_from_statistic($second_statistic); > my $next_attributes = > Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') > ->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } ); >diff --git a/t/db_dependent/Koha/PseudonymizedTransaction.t b/t/db_dependent/Koha/PseudonymizedTransaction.t >index 11e247f6d0..162688775f 100755 >--- a/t/db_dependent/Koha/PseudonymizedTransaction.t >+++ b/t/db_dependent/Koha/PseudonymizedTransaction.t >@@ -57,7 +57,7 @@ subtest 'get_hash() tests' => sub { > ); > }; > >-subtest 'new_from_statistic() tests' => sub { >+subtest 'create_from_statistic() tests' => sub { > > plan tests => 15; > >@@ -101,7 +101,7 @@ subtest 'new_from_statistic() tests' => sub { > } > ); > >- my $pseudonymized = Koha::PseudonymizedTransaction->new_from_statistic($statistic); >+ my $pseudonymized = Koha::PseudonymizedTransaction->create_from_statistic($statistic); > > is( > $pseudonymized->hashed_borrowernumber, >@@ -124,7 +124,7 @@ subtest 'new_from_statistic() tests' => sub { > $patron->cardnumber(undef)->store; > > ok( >- !Koha::PseudonymizedTransaction->new_from_statistic($statistic)->has_cardnumber, >+ !Koha::PseudonymizedTransaction->create_from_statistic($statistic)->has_cardnumber, > 'has_cardnumber set to false' > ); > >-- >2.39.5
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 39652
:
181001
|
181002
|
181109
|
181110
|
181209
|
181210
|
181211
|
181382
|
181383
|
181384
|
181385