Bugzilla – Attachment 127213 Details for
Bug 29341
If OpacRenewalBranch = opacrenew, pseudonymization process leads to "internal server error" when patrons renew the loans at OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29341: Don't modify the branchcode for stats
Bug-29341-Dont-modify-the-branchcode-for-stats.patch (text/plain), 2.46 KB, created by
Jonathan Druart
on 2021-11-02 12:02:29 UTC
(
hide
)
Description:
Bug 29341: Don't modify the branchcode for stats
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-11-02 12:02:29 UTC
Size:
2.46 KB
patch
obsolete
>From 543dd8fced6498a1793a2ba8372a45a340a37695 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 Nov 2021 13:00:08 +0100 >Subject: [PATCH] Bug 29341: Don't modify the branchcode for stats > >--- > C4/Stats.pm | 7 ++++--- > t/db_dependent/Koha/Pseudonymization.t | 7 +++++-- > 2 files changed, 9 insertions(+), 5 deletions(-) > >diff --git a/C4/Stats.pm b/C4/Stats.pm >index 352e4f92a0b..94e5dbf52db 100644 >--- a/C4/Stats.pm >+++ b/C4/Stats.pm >@@ -124,9 +124,6 @@ sub UpdateStats { > my $location = exists $params->{location} ? $params->{location} : undef; > my $ccode = exists $params->{ccode} ? $params->{ccode} : ''; > >- # If $branch is set to an invalid branchcode, like 'OPACRenew' >- $branch = undef if $branch && ! Koha::Libraries->find($branch); >- > my $dtf = Koha::Database->new->schema->storage->datetime_parser; > my $statistic = Koha::Statistic->new( > { >@@ -143,6 +140,10 @@ sub UpdateStats { > } > )->store; > >+ >+ # If $branch is set to an invalid branchcode, like 'OPACRenew' >+ $statistic->branch(undef) if $branch && ! Koha::Libraries->find($branch); >+ > Koha::PseudonymizedTransaction->new_from_statistic($statistic)->store > if C4::Context->preference('Pseudonymization') > && $borrowernumber # Not a real transaction if the patron does not exist >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index 4ca12e1cbc9..734ff81d26b 100755 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -212,7 +212,7 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > }; > > subtest 'invalid branchcode' => sub { >- plan tests => 1; >+ plan tests => 2; > > $schema->storage->txn_begin; > >@@ -239,7 +239,10 @@ subtest 'invalid branchcode' => sub { > ); > > my $stat = Koha::Statistics->search({itemnumber => $item->itemnumber}); >- is( $stat->next->branch, undef, 'UpdateStats does not explode if branchcode is invalid' ); >+ is( $stat->next->branch, $branchcode, 'UpdateStats does not explode if branchcode is invalid, and stat logs the branchcode as it' ); >+ >+ my $p = Koha::PseudonymizedTransactions->search({itemnumber => $item->itemnumber}); >+ is( $p->next->transaction_branchcode, undef, 'Pseudonymized transactions logged branchcode=NULL if invalid branchcode passed' ); > > $schema->storage->txn_rollback; > }; >-- >2.25.1
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 29341
:
127034
|
127078
|
127213
|
127350
|
127727
|
127848