Bugzilla – Attachment 14679 Details for
Bug 7887
Add Option To Include Items That Will Be Available When Calculating Holds Ratios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition.
Bug-7887---Followup---Make-use-of-aqorders-conditi.patch (text/plain), 1.92 KB, created by
Kyle M Hall
on 2013-01-17 16:51:13 UTC
(
hide
)
Description:
Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition.
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-01-17 16:51:13 UTC
Size:
1.92 KB
patch
obsolete
>From 351820e654a63972089427fd02ab5e2faa0acc7f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 13 Aug 2012 09:06:52 -0400 >Subject: [PATCH] Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition. > >COALESCE is an ANSI-compliant SQL function, which returns the first >non-null value passed to it. I have verified it is available in both >MySQL and Postgres. >--- > circ/reserveratios.pl | 13 +++++++------ > 1 files changed, 7 insertions(+), 6 deletions(-) > >diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl >index 24cd60e..d501c3e 100755 >--- a/circ/reserveratios.pl >+++ b/circ/reserveratios.pl >@@ -104,7 +104,8 @@ if ($order eq "biblio") { > $sqlorderby = " ORDER BY reservecount DESC "; > } > >-my $on_order_sql = ( $include_on_order_items ) ? "+ aqorders.quantity" : ""; >+my $on_order_sql1 = ( $include_on_order_items ) ? "+ COALESCE(aqorders.quantity, 0)" : q{}; >+my $on_order_sql2 = ( $include_on_order_items ) ? "LEFT JOIN aqorders ON reserves.biblionumber=aqorders.biblionumber" : q{}; > my $not_for_loan_comparison = ( $include_will_be_available ) ? "<=" : "="; > > my $strsth = >@@ -127,13 +128,13 @@ my $strsth = > reserves.found, > biblio.title, > biblio.author, >- count(DISTINCT reserves.borrowernumber) as reservecount, >- count(DISTINCT items.itemnumber) $on_order_sql as itemcount >+ count(DISTINCT reserves.borrowernumber) as reservecount, >+ count(DISTINCT items.itemnumber) $on_order_sql1 as itemcount > FROM reserves >- LEFT JOIN items ON items.biblionumber=reserves.biblionumber >+ LEFT JOIN items ON items.biblionumber=reserves.biblionumber > LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber >- LEFT JOIN aqorders ON reserves.biblionumber=aqorders.biblionumber >- WHERE >+ $on_order_sql2 >+ WHERE > notforloan $not_for_loan_comparison 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0 > $sqldatewhere > "; >-- >1.7.2.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 7887
:
8806
|
11051
|
11576
|
14678
| 14679