Bugzilla – Attachment 70306 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.44 KB, created by
Jonathan Druart
on 2018-01-05 16:42:17 UTC
(
hide
)
Description:
Bug 19792: Few minor fixes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-01-05 16:42:17 UTC
Size:
2.44 KB
patch
obsolete
>From 33baf88459d5cadeba5e6af7d818492c3b3975c4 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 > >- No string extrapolation needed on SQL queries >- '== undef' must be written 'if not defined' >--- > C4/Budgets.pm | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index c59d86ad34..644c5e59c9 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.11.0
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