Bug 27004: Prevent claim resolution to fail
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 21 Dec 2020 10:05:26 +0000 (11:05 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 5 Jan 2021 08:34:53 +0000 (09:34 +0100)
commit8e3f33e5d6e79d2df1a5077e4dc68364867566c9
treeeca963804bf7dd0eb1cef6538c618943b62b8d26
parentf1b6a5321b6593e54b2870229404df8544f37e9e
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 92dbe809021ea1f7ee44e51387b48d9ffbda1fea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Checkouts/ReturnClaim.pm
t/db_dependent/api/v1/return_claims.t