Bugzilla – Attachment 16016 Details for
Bug 9367
Code optimization: CheckReserves is too often called
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9367: Followup: Code optimization: CheckReserves is too often called
Bug-9367-Followup-Code-optimization-CheckReserves-.patch (text/plain), 2.48 KB, created by
Jonathan Druart
on 2013-03-11 10:34:05 UTC
(
hide
)
Description:
Bug 9367: Followup: Code optimization: CheckReserves is too often called
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-03-11 10:34:05 UTC
Size:
2.48 KB
patch
obsolete
>From b8ebd3b6dc5a543cf16ac2132ca91d9be0dfd28b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 11 Mar 2013 11:33:05 +0100 >Subject: [PATCH] Bug 9367: Followup: Code optimization: CheckReserves is too > often called > >--- > C4/Circulation.pm | 9 ++++----- > C4/Reserves.pm | 14 +++++++++++--- > 2 files changed, 15 insertions(+), 8 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 0999acf..abd4981 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2473,18 +2473,17 @@ sub CanBookBeRenewed { > > $sthcount->execute( $borrowernumber, $itemnumber ); > if ( my $data1 = $sthcount->fetchrow_hashref ) { >- > if ( ( $data1->{renewalsallowed} && $data1->{renewalsallowed} > $data1->{renewals} ) || $override_limit ) { > $renewokay = 1; > } > else { >- $error="too_many"; >- } >- >+ $error = "too_many"; >+ } >+ > my $resstatus = C4::Reserves::GetReserveStatus($itemnumber); > if ( $resstatus eq "Waiting" or $resstatus eq "Reserved" ) { > $renewokay = 0; >- $error->{message} = "on_reserve"; >+ $error = "on_reserve"; > } > } > return ($renewokay,$error); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index ee31ea9..644be68 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -735,12 +735,21 @@ sub GetReservesForBranch { > return (@transreserv); > } > >+=head2 GetReserveStatus >+ >+ $reservestatus = GetReserveStatus($itemnumber, $biblionumber); >+ >+Take an itemnumber or a biblionumber and return the status of the reserve places on it. >+If several reserves exist, the reserve with the lower priority is given. >+ >+=cut >+ > sub GetReserveStatus { > my ($itemnumber, $biblionumber) = @_; > > my $dbh = C4::Context->dbh; > >- my ($sth, $found, $priority); >+ my ($sth, $found, $priority) = (undef, q{}, 0); > if ( $itemnumber ) { > $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE itemnumber = ? order by priority LIMIT 1"); > $sth->execute($itemnumber); >@@ -1455,8 +1464,7 @@ sub IsAvailableForItemLevelRequest { > if (C4::Context->preference('AllowOnShelfHolds')) { > return $available_per_item; > } else { >- my $status = GetReserveStatus($itemnumber); >- return ($available_per_item and ($item->{onloan} or $status eq "Waiting" or $status = "Reserved")); >+ return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "Waiting")); > } > } > >-- >1.7.10.4
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 9367
:
14471
|
14544
|
16016
|
16018
|
16021
|
16022
|
16023