Bugzilla – Attachment 152413 Details for
Bug 33885
Get HTTP 500 when retrieving orders created by a non-existent (deleted) user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33885: Make Koha::Acq::Order->creator return undef if no creator
Bug-33885-Make-KohaAcqOrder-creator-return-undef-i.patch (text/plain), 1.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-06-16 13:18:56 UTC
(
hide
)
Description:
Bug 33885: Make Koha::Acq::Order->creator return undef if no creator
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-06-16 13:18:56 UTC
Size:
1.86 KB
patch
obsolete
>From 92c3feef2399b56c8d4b495bae77885aaa5b189f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 7 Jun 2023 11:05:18 +0200 >Subject: [PATCH] Bug 33885: Make Koha::Acq::Order->creator return undef if no > creator > >If the account of the creator of an order has been deleted we should >return undef here, instead of crashing with >GET /api/v1/acquisitions/orders: unhandled exception (Mojo::Exception)<<DBIC result _type isn't of the _type Borrower at /kohadevbox/koha/Koha/Objects.pm line 445. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Acquisition/Order.pm | 1 + > t/db_dependent/Koha/Acquisition/Order.t | 6 +++++- > 2 files changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 73f3a9fdcd3..e0fea073f1a 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -425,6 +425,7 @@ Retrieves patron that created this order. > sub creator { > my ( $self ) = @_; > my $creator_rs = $self->_result->creator; >+ return unless $creator_rs; > return Koha::Patron->_new_from_dbic( $creator_rs ); > } > >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index 22e4af6225a..8a47a5cfce8 100755 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -639,7 +639,7 @@ subtest 'filter_by_current & filter_by_cancelled' => sub { > }; > > subtest 'creator ()' => sub { >- plan tests => 1; >+ plan tests => 2; > > $schema->storage->txn_begin; > >@@ -650,6 +650,10 @@ subtest 'creator ()' => sub { > > is($creator->borrowernumber, $patron->borrowernumber, 'Patron is order creator'); > >+ $creator->delete; >+ >+ is( $order->get_from_storage->creator, undef ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.2
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 33885
:
152080
|
152081
|
152137
|
152138
| 152413 |
152414