Bugzilla – Attachment 182914 Details for
Bug 40034
CheckReserves dies if itype doesn't exist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40034: Only check notforloan on itemtype if it exists
Bug-40034-Only-check-notforloan-on-itemtype-if-it-.patch (text/plain), 1.50 KB, created by
David Nind
on 2025-06-02 19:23:05 UTC
(
hide
)
Description:
Bug 40034: Only check notforloan on itemtype if it exists
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-06-02 19:23:05 UTC
Size:
1.50 KB
patch
obsolete
>From 3400e136a22351905db04ce1dafeef7e2d68c5e5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 2 Jun 2025 09:50:19 -0300 >Subject: [PATCH] Bug 40034: Only check notforloan on itemtype if it exists > >This patch makes the code in `CheckReserves` survive the non-existence >of the referenced item type in the `items` table for the passed item. > >To test: >1. Apply the regression tests >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Reserves.t >=> FAIL: Tests explode like this: > >``` >Can't call method "notforloan" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 870. >``` > >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Reserves.pm | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index cadd4d413e..d9c4ab19bb 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -865,10 +865,11 @@ sub CheckReserves { > > my $dont_trap = C4::Context->preference('TrapHoldsOnOrder') ? $item->notforloan > 0 : $item->notforloan; > if ( !$dont_trap ) { >- my $item_type = $item->effective_itemtype; >- if ($item_type) { >- return if Koha::ItemTypes->find($item_type)->notforloan; >- } >+ my $effective_item_type = $item->effective_itemtype; >+ >+ my $item_type = Koha::ItemTypes->find($effective_item_type); >+ return >+ if $item_type && $item_type->notforloan; > } else { > return; > } >-- >2.39.5
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 40034
:
182908
|
182909
|
182913
|
182914
|
183042
|
183043