Bugzilla – Attachment 139407 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.75 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-08-18 17:19:39 UTC
(
hide
)
Description:
Bug 31395: Only try to cancel holds if item found
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-08-18 17:19:39 UTC
Size:
1.75 KB
patch
obsolete
>From 6dace1b29efcd37756f4f045f6e1bc4d78ad4544 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> >--- > circ/returns.pl | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/circ/returns.pl b/circ/returns.pl >index ac3260a5e92..108d7bf68cd 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.37.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