Bugzilla – Attachment 57998 Details for
Bug 17729
Replace IsItemOnHoldAndFound with $item->holds->filter_by_found->count
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17729: Move IsItemOnHoldAndFound to Koha::Holds
Bug-17729-Move-IsItemOnHoldAndFound-to-KohaHolds.patch (text/plain), 2.82 KB, created by
Jonathan Druart
on 2016-12-06 11:15:21 UTC
(
hide
)
Description:
Bug 17729: Move IsItemOnHoldAndFound to Koha::Holds
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-06 11:15:21 UTC
Size:
2.82 KB
patch
obsolete
>From 02d47e15eb39035bafb3be511fbddf49fdcdb741 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Dec 2016 12:14:28 +0100 >Subject: [PATCH] Bug 17729: Move IsItemOnHoldAndFound to Koha::Holds > >I don't think this is ready yet, since we are in loops, that can >introduce speed improvement regressions >--- > C4/Circulation.pm | 3 ++- > C4/Reserves.pm | 29 ++--------------------------- > 2 files changed, 4 insertions(+), 28 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b505031..96c7dcc 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2781,8 +2781,9 @@ sub CanBookBeRenewed { > foreach my $b (@borrowernumbers) { > my ($borr) = C4::Members::GetMember( borrowernumber => $b); > foreach my $i (@itemnumbers) { >+ my $hold = Koha::Holds->find( { itemnumber => $i } ); > my $item = GetItem($i); >- if ( !IsItemOnHoldAndFound($i) >+ if ( ( not $hold or not $hold->is_found ) > && IsAvailableForItemLevelRequest( $item, $borr ) > && CanItemBeReserved( $b, $i ) ) > { >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 9ef33ad..62f7163 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -145,8 +145,6 @@ BEGIN { > > &GetReservesControlBranch > >- IsItemOnHoldAndFound >- > GetMaxPatronHoldsForRecord > ); > @EXPORT_OK = qw( MergeHolds ); >@@ -1512,12 +1510,13 @@ sub IsAvailableForItemLevelRequest { > my $any_available = 0; > > foreach my $i (@items) { >+ my $hold = Koha::Holds->find( { itemnumber => $i } ); > $any_available = 1 > unless $i->itemlost > || $i->{notforloan} > 0 > || $i->withdrawn > || $i->onloan >- || IsItemOnHoldAndFound( $i->id ) >+ || ( $hold and $hold->is_found ) > || ( $i->damaged > && !C4::Context->preference('AllowHoldsOnDamagedItems') ) > || Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan; >@@ -2445,30 +2444,6 @@ sub CalculatePriority { > return @row ? $row[0]+1 : 1; > } > >-=head2 IsItemOnHoldAndFound >- >- my $bool = IsItemFoundHold( $itemnumber ); >- >- Returns true if the item is currently on hold >- and that hold has a non-null found status ( W, T, etc. ) >- >-=cut >- >-sub IsItemOnHoldAndFound { >- my ($itemnumber) = @_; >- >- my $rs = Koha::Database->new()->schema()->resultset('Reserve'); >- >- my $found = $rs->count( >- { >- itemnumber => $itemnumber, >- found => { '!=' => undef } >- } >- ); >- >- return $found; >-} >- > =head2 GetMaxPatronHoldsForRecord > > my $holds_per_record = ReservesControlBranch( $borrowernumber, $biblionumber ); >-- >2.9.3
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 17729
:
57998
|
171053
|
171061
|
171065
|
171069