Bugzilla – Attachment 114733 Details for
Bug 27004
Deleting a staff account who have created claims returned causes problem in the return_claims table because of a NULL value in return_claims.created_by.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27004: Prevent claim resolution to fail
Bug-27004-Prevent-claim-resolution-to-fail.patch (text/plain), 2.21 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-12-29 17:42:28 UTC
(
hide
)
Description:
Bug 27004: Prevent claim resolution to fail
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-12-29 17:42:28 UTC
Size:
2.21 KB
patch
obsolete
>From b8c61da13495ec7183e53dbe9ea8a5f7eddb9fff Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 21 Dec 2020 11:05:26 +0100 >Subject: [PATCH] Bug 27004: Prevent claim resolution to fail > >If the account of the patron who created a claim is removed, then the >claim won't be resolvable. >Trying to resolve the claim will result in a 500: >[2020/12/21 10:05:55] [ERROR] PUT /api/v1/return_claims/1/resolve: unhandled exception (Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy)<<[created_by is mandatory]>> Koha::REST::Plugin::Exceptions::__ANON > >We should not check if created_by exist when we update an existing hold, >only when we create it. > >Test plan: >- Login with patron A >- set a value to syspref ClaimReturnedLostValue >- Check an item out >- Claim returned it >- Login with patron B >- Delete patron A >- Resolve the claim >- ERROR in api-error.log an UI never confirming the resolution >- apply patch & restart services >- Resolve the claim >- it works > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Checkouts/ReturnClaim.pm | 2 +- > t/db_dependent/api/v1/return_claims.t | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > >diff --git a/Koha/Checkouts/ReturnClaim.pm b/Koha/Checkouts/ReturnClaim.pm >index 92ab38f08d..624c725949 100644 >--- a/Koha/Checkouts/ReturnClaim.pm >+++ b/Koha/Checkouts/ReturnClaim.pm >@@ -48,7 +48,7 @@ exceptions as needed. > sub store { > my ( $self ) = @_; > >- unless ( $self->created_by ) { >+ unless ( $self->in_storage || $self->created_by ) { > Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy->throw(); > } > >diff --git a/t/db_dependent/api/v1/return_claims.t b/t/db_dependent/api/v1/return_claims.t >index f0d8b1f24f..1664102c6f 100755 >--- a/t/db_dependent/api/v1/return_claims.t >+++ b/t/db_dependent/api/v1/return_claims.t >@@ -204,6 +204,8 @@ subtest 'resolve_claim() tests' => sub { > > my $claim_id = $claim->id; > >+ $claim->created_by(undef)->store; # resolve the claim must work even if the created_by patron has been removed >+ > # Resolve a claim > $t->put_ok( > "//$userid:$password@/api/v1/return_claims/$claim_id/resolve" => json => { >-- >2.29.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 27004
:
114547
|
114573
|
114732
| 114733