Bugzilla – Attachment 75260 Details for
Bug 19792
Reduce number of SQL calls in GetBudgetHierarchy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19792: Few minor fixes
Bug-19792-Few-minor-fixes.patch (text/plain), 2.58 KB, created by
Marcel de Rooy
on 2018-05-11 07:58:12 UTC
(
hide
)
Description:
Bug 19792: Few minor fixes
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-05-11 07:58:12 UTC
Size:
2.58 KB
patch
obsolete
>From 2e776ed4dd55c83c79ef1f33393892b0b703af85 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 5 Jan 2018 13:29:06 -0300 >Subject: [PATCH] Bug 19792: Few minor fixes >Content-Type: text/plain; charset=utf-8 > >- No string extrapolation needed on SQL queries >- '== undef' must be written 'if not defined' > >Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Budgets.pm | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index c59d86a..644c5e5 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -544,28 +544,28 @@ sub GetBudgetHierarchy { > } > > # Get all the budgets totals in as few queries as possible >- my $hr_budget_spent = $dbh->selectall_hashref(qq| >+ my $hr_budget_spent = $dbh->selectall_hashref(q| > SELECT aqorders.budget_id, aqbudgets.budget_parent_id, > SUM( COALESCE(unitprice_tax_included, ecost_tax_included) * quantity ) AS budget_spent > FROM aqorders JOIN aqbudgets USING (budget_id) > WHERE quantityreceived > 0 AND datecancellationprinted IS NULL > GROUP BY budget_id > |, 'budget_id'); >- my $hr_budget_ordered = $dbh->selectall_hashref(qq| >+ my $hr_budget_ordered = $dbh->selectall_hashref(q| > SELECT aqorders.budget_id, aqbudgets.budget_parent_id, > SUM(ecost_tax_included * quantity) AS budget_ordered > FROM aqorders JOIN aqbudgets USING (budget_id) > WHERE quantityreceived = 0 AND datecancellationprinted IS NULL > GROUP BY budget_id > |, 'budget_id'); >- my $hr_budget_spent_shipment = $dbh->selectall_hashref(qq| >+ my $hr_budget_spent_shipment = $dbh->selectall_hashref(q| > SELECT shipmentcost_budgetid as budget_id, > SUM(shipmentcost) as shipmentcost > FROM aqinvoices > WHERE closedate IS NOT NULL > GROUP BY shipmentcost_budgetid > |, 'budget_id'); >- my $hr_budget_ordered_shipment = $dbh->selectall_hashref(qq| >+ my $hr_budget_ordered_shipment = $dbh->selectall_hashref(q| > SELECT shipmentcost_budgetid as budget_id, > SUM(shipmentcost) as shipmentcost > FROM aqinvoices >@@ -575,7 +575,7 @@ sub GetBudgetHierarchy { > > > foreach my $budget (@sort) { >- if ($budget->{budget_parent_id} == undef) { >+ if ( not defined $budget->{budget_parent_id} ) { > _recursiveAdd( $budget, undef, $hr_budget_spent, $hr_budget_spent_shipment, $hr_budget_ordered, $hr_budget_ordered_shipment ); > } > } >-- >2.1.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 19792
:
69702
|
69960
|
70296
|
70297
|
70298
|
70306
|
71989
|
71990
|
71991
|
74983
|
74984
|
74985
|
75258
|
75259
| 75260