Bugzilla – Attachment 16023 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 finalizing QA
Bug-9367-Followup-finalizing-QA.patch (text/plain), 1.98 KB, created by
Marcel de Rooy
on 2013-03-11 12:10:11 UTC
(
hide
)
Description:
Bug 9367: Followup finalizing QA
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-03-11 12:10:11 UTC
Size:
1.98 KB
patch
obsolete
>From fa5495f9e064bc293a30f462ea54e979d7c99b76 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 11 Mar 2013 12:13:29 +0100 >Subject: [PATCH] Bug 9367: Followup finalizing QA >Content-Type: text/plain; charset="utf-8" > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Keeping fetchrow close to its execute worked even better in GetReserveStatus. >Instead of returning undef, I return empty string. >I checked all calls; this value is mostly not checked for undef. >So we eliminate a lot of warnings in log. >--- > C4/Reserves.pm | 17 ++++++++++------- > 1 files changed, 10 insertions(+), 7 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index ded88c8..ba12cf5 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -749,23 +749,26 @@ sub GetReserveStatus { > > my $dbh = C4::Context->dbh; > >- my ($sth, $found, $priority) = (undef, q{}, 0); >+ my ($sth, $found, $priority); > if ( $itemnumber ) { > $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE itemnumber = ? order by priority LIMIT 1"); > $sth->execute($itemnumber); >+ ($found, $priority) = $sth->fetchrow_array; > } > > if ( $biblionumber and not defined $found and not defined $priority ) { > $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE biblionumber = ? order by priority LIMIT 1"); > $sth->execute($biblionumber); >+ ($found, $priority) = $sth->fetchrow_array; > } >- ($found, $priority) = $sth->fetchrow_array; > >- return unless defined $found; >- return 'Waiting' if $found eq 'W' and $priority == 0; >- return 'Finished' if $found eq 'F'; >- return 'Reserved' if $priority > 0; >- return; >+ if(defined $found) { >+ return 'Waiting' if $found eq 'W' and $priority == 0; >+ return 'Finished' if $found eq 'F'; >+ return 'Reserved' if $priority > 0; >+ } >+ return ''; >+ #empty string here will remove need for checking undef, or less log lines > } > > =head2 CheckReserves >-- >1.7.7.6
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