Bugzilla – Attachment 139664 Details for
Bug 24295
C4::Circulation::GetTransfers should be removed, use Koha::Item->get_transfer instead
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24295: Remove GetTransfers call from C4/HoldsQueue.pm
Bug-24295-Remove-GetTransfers-call-from-C4HoldsQue.patch (text/plain), 3.54 KB, created by
Martin Renvoize (ashimema)
on 2022-08-23 11:23:35 UTC
(
hide
)
Description:
Bug 24295: Remove GetTransfers call from C4/HoldsQueue.pm
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-08-23 11:23:35 UTC
Size:
3.54 KB
patch
obsolete
>From a4203e400aea0aae80b0af7e6d691c15f306612a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 16 Mar 2021 10:12:39 +0000 >Subject: [PATCH] Bug 24295: Remove GetTransfers call from C4/HoldsQueue.pm >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch removes the GetTransfers call from >GetItemsAvailableToFillHoldRequestsForBib instead replacing it with an >inline JOIN in the initial query. > >Test plan >1/ Run the holds queue >2/ Check the results >3/ Put one of the items in the holds queue into transit >4/ Run the holds queue again >5/ Check that the results do not contain the item that is in transit >6/ Apply the patch >7/ Run the holds queue again >8/ Check that the results still do not contain the item that is in >transit > >Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/HoldsQueue.pm | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index f2eb1ee4b8..8173efaae8 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -23,7 +23,7 @@ use strict; > use warnings; > > use C4::Context; >-use C4::Circulation qw( GetTransfers GetBranchItemRule ); >+use C4::Circulation qw( GetBranchItemRule ); > use Koha::DateUtils qw( dt_from_string ); > use Koha::Items; > use Koha::Patrons; >@@ -314,7 +314,7 @@ sub GetItemsAvailableToFillHoldRequestsForBib { > my ($biblionumber, $branches_to_use) = @_; > > my $dbh = C4::Context->dbh; >- my $items_query = "SELECT itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype >+ my $items_query = "SELECT items.itemnumber, homebranch, holdingbranch, itemtypes.itemtype AS itype > FROM items "; > > if (C4::Context->preference('item-level_itypes')) { >@@ -323,14 +323,17 @@ sub GetItemsAvailableToFillHoldRequestsForBib { > $items_query .= "JOIN biblioitems USING (biblioitemnumber) > LEFT JOIN itemtypes USING (itemtype) "; > } >- $items_query .= "WHERE items.notforloan = 0 >+ $items_query .= " LEFT JOIN branchtransfers ON (items.itemnumber = branchtransfers.itemnumber)"; >+ $items_query .= " WHERE items.notforloan = 0 > AND holdingbranch IS NOT NULL > AND itemlost = 0 > AND withdrawn = 0"; >+ $items_query .= " AND branchtransfers.datearrived IS NULL >+ AND branchtransfers.datecancelled IS NULL"; > $items_query .= " AND damaged = 0" unless C4::Context->preference('AllowHoldsOnDamagedItems'); > $items_query .= " AND items.onloan IS NULL > AND (itemtypes.notforloan IS NULL OR itemtypes.notforloan = 0) >- AND itemnumber NOT IN ( >+ AND items.itemnumber NOT IN ( > SELECT itemnumber > FROM reserves > WHERE biblionumber = ? >@@ -348,12 +351,11 @@ sub GetItemsAvailableToFillHoldRequestsForBib { > $sth->execute(@params); > > my $itm = $sth->fetchall_arrayref({}); >- my @items = grep { ! scalar C4::Circulation::GetTransfers($_->{itemnumber}) } @$itm; > return [ grep { > my $rule = C4::Circulation::GetBranchItemRule($_->{homebranch}, $_->{itype}); > $_->{holdallowed} = $rule->{holdallowed}; > $_->{hold_fulfillment_policy} = $rule->{hold_fulfillment_policy}; >- } @items ]; >+ } @{$itm} ]; > } > > =head2 _checkHoldPolicy >-- >2.20.1
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 24295
:
118242
|
118243
|
118244
|
118245
|
118246
|
118247
|
118248
|
118249
|
118250
|
118287
|
118295
|
118296
|
118297
|
118298
|
118299
|
118300
|
118301
|
118302
|
118303
|
118304
|
118305
|
118306
|
118307
|
118308
|
118309
|
118310
|
119854
|
119855
|
119856
|
119857
|
119858
|
119859
|
119860
|
119861
|
119862
|
119863
|
119864
|
119866
|
119867
|
127465
|
127466
|
127467
|
127468
|
127469
|
127470
|
127471
|
127472
|
127473
|
127474
|
127475
|
127476
|
127477
|
130430
|
130431
|
130432
|
130433
|
130434
|
130435
|
130436
|
130437
|
130438
|
130439
|
130440
|
130441
|
130442
|
139546
|
139547
|
139548
|
139549
|
139550
|
139551
|
139552
|
139553
|
139554
|
139555
|
139556
|
139557
|
139558
|
139655
|
139656
|
139657
|
139658
|
139659
|
139660
|
139661
|
139662
|
139663
| 139664 |
139665
|
139666
|
139667