Bug 31395: Only try to cancel holds if item found
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 18 Aug 2022 17:00:54 +0000 (14:00 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 19 Aug 2022 12:56:43 +0000 (09:56 -0300)
commit1eb2c4337b736cc53a72b76a4b2f6700c410b915
tree71b0dd8029f432877dacab84967e2943c4e4446a
parent9afbe872b7e63ce1d88cf6896df3b1046529212b
Bug 31395: Only try to cancel holds if item found

This patch makes the code dealing with waiting holds with cancellation
requests be dependent on the fact an item has been found.

The returns.pl controller is a bit messy as the real return takes place
outside the main `if ($item)` block. This should be refactored and
probably run inside a transaction...

In the meantime this patch will make the job.

To test:
1. Try to return an invalid barcode (e.g. ASDQWE)
=> FAIL: Things explode
2. Apply this patch
3. Repeat 1
=> SUCCESS: Doesn't explode!
4. Verify that returning an item with a waiting hold with cancellation
   requests still cancells the hold.
=> SUCCESS: It does!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
circ/returns.pl