Bugzilla – Attachment 139417 Details for
Bug 31395
Checking in non-existent barcodes makes Koha explode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31395: Only try to cancel holds if item found
Bug-31395-Only-try-to-cancel-holds-if-item-found.patch (text/plain), 1.80 KB, created by
ByWater Sandboxes
on 2022-08-18 19:55:29 UTC
(
hide
)
Description:
Bug 31395: Only try to cancel holds if item found
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2022-08-18 19:55:29 UTC
Size:
1.80 KB
patch
obsolete
>From 2068662bab854b7b0c4d858322540de12d9cd1c6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 18 Aug 2022 14:00:54 -0300 >Subject: [PATCH] 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> >--- > circ/returns.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/circ/returns.pl b/circ/returns.pl >index ac3260a5e9..108d7bf68c 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -348,11 +348,11 @@ if ($barcode) { > > # is there a waiting hold for the item, for which cancellation > # has been requested? >- my $waiting_holds_to_be_cancelled = >- Koha::Holds->waiting->search( { itemnumber => $item->id } ) >- ->filter_by_has_cancellation_requests; >- while ( my $hold = $waiting_holds_to_be_cancelled->next ) { >- $hold->cancel; >+ if ($item) { >+ my $waiting_holds_to_be_cancelled = $item->holds->waiting->filter_by_has_cancellation_requests; >+ while ( my $hold = $waiting_holds_to_be_cancelled->next ) { >+ $hold->cancel; >+ } > } > > # do the return >-- >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 31395
:
139407
|
139417
|
139485