Bugzilla – Attachment 181002 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: store PseudonymizedTransaction before adding related entries
Bug-39652-store-PseudonymizedTransaction-before-ad.patch (text/plain), 3.34 KB, created by
Pedro Amorim
on 2025-04-16 11:46:35 UTC
(
hide
)
Description:
Bug 39652: store PseudonymizedTransaction before adding related entries
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-04-16 11:46:35 UTC
Size:
3.34 KB
patch
obsolete
>From 48d5a93018cf50727e11c5ef0415aac2693ff7a8 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 16 Apr 2025 11:45:27 +0000 >Subject: [PATCH] Bug 39652: store PseudonymizedTransaction before adding > related entries > >Test plan: >Run the tests before and after applying this patch: >perl t/db_dependent/Koha/Pseudonymization.t > >They should fail before this patch and pass after applying patch. >--- > Koha/BackgroundJob/PseudonymizeStatistic.pm | 2 +- > Koha/PseudonymizedTransaction.pm | 2 ++ > t/db_dependent/Koha/Pseudonymization.t | 6 +++--- > 3 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/Koha/BackgroundJob/PseudonymizeStatistic.pm b/Koha/BackgroundJob/PseudonymizeStatistic.pm >index a1dd525b941..822ee6c8564 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)->store(); >+ Koha::PseudonymizedTransaction->new_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 ee243d76e67..f456c4d8403 100644 >--- a/Koha/PseudonymizedTransaction.pm >+++ b/Koha/PseudonymizedTransaction.pm >@@ -96,6 +96,8 @@ sub new_from_statistic { > > my $self = $class->SUPER::new($values); > >+ $self->store(); >+ > if ($patron) { > my $extended_attributes = $patron->extended_attributes->unblessed; > for my $attribute (@$extended_attributes) { >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index 36cfd57355f..3f73c778f4f 100755 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -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)->store; >+ my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($statistic); > > isnt( > $pseudonymized->id, >@@ -223,7 +223,7 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > } > ); > >- my $p = Koha::PseudonymizedTransaction->new_from_statistic($statistic)->store; >+ my $p = Koha::PseudonymizedTransaction->new_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)->store; >+ my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($second_statistic); > my $next_attributes = > Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') > ->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } ); >-- >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