Bugzilla – Attachment 190474 Details for
Bug 41444
Fetch transfers directly for search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41444: Search for transfers directly
Bug-41444-Search-for-transfers-directly.patch (text/plain), 2.08 KB, created by
David Nind
on 2025-12-13 00:26:34 UTC
(
hide
)
Description:
Bug 41444: Search for transfers directly
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-12-13 00:26:34 UTC
Size:
2.08 KB
patch
obsolete
>From 7958b36bd9b4bffae713c95096ae0d0e83297d9f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 12 Dec 2025 20:18:26 +0000 >Subject: [PATCH] Bug 41444: Search for transfers directly > >This patch removes a fetch of the item object followed but get_transfer to simply search the >transfers by itemnumber and status > >To test: >1 - Add many items to your records > https://github.com/kidclamp/handy-koha-script/blob/main/randitems.pl > NOTE: this script makes a lot of items withdrawn or damaged, undo that for more dramatic difference > UPDATE items SET withdrawn=0,damaged=0 > perl misc/search_tools/rebuild_elasticsearch -v >2 - Set Koha system preferences to display more results and check more items: > maxItemsInSearchResults 60 > numSearchResults 50 >3 - Do a search, several times, note the time it takes >4 - Apply patch, restart all >5 - Repeat search several times, note the time it takes >6 - Confirm it is better after the patch > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Search.pm | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 5d6f3c6e33..ab85159012 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1977,8 +1977,10 @@ sub searchResults { > # the in transit status count as unavailable for search limiting, > # should map transit status to record indexed in Zebra. > >- my $item_object = Koha::Items->find( $item->{itemnumber} ); >- my $transfer = defined($item_object) ? $item_object->get_transfer : undef; >+ my $transfer = Koha::Item::Transfers->search( >+ { itemnumber => $item->{itemnumber}, datearrived => undef, datecancelled => undef }, >+ { order_by => [ { '-desc' => 'datesent' }, { '-asc' => 'daterequested' } ] } >+ )->next; > ( $transfertwhen, $transfertfrom, $transfertto ) = defined($transfer) > ? ( > $transfer->datesent, $transfer->frombranch, >-- >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 41444
:
190469
| 190474