Bugzilla – Attachment 31984 Details for
Bug 12980
GetHistory does useless processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12980: GetHistory does useless processing
PASSED-QA-Bug-12980-GetHistory-does-useless-proces.patch (text/plain), 5.09 KB, created by
Kyle M Hall (khall)
on 2014-10-03 13:55:41 UTC
(
hide
)
Description:
[PASSED QA] Bug 12980: GetHistory does useless processing
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-10-03 13:55:41 UTC
Size:
5.09 KB
patch
obsolete
>From f0a330a4b04fe658121607fc75283e36f3816c10 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 23 Sep 2014 13:02:51 +0200 >Subject: [PATCH] [PASSED QA] Bug 12980: GetHistory does useless processing > >GetHistory iterated on the orders to calculate the quantity and price. >These values are never used by the called. >It can be removed. > >Test plan: >Verify there is no regression on acqui/histsearch.pl and >catalogue/detail.pl >Actually you just have to check that the total quantity and price are >not displayed on these views. > >QA: note that 'count' and 'toggle' are never used in the template. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Acquisition.pm | 19 +++---------------- > acqui/histsearch.pl | 7 ++----- > catalogue/detail.pl | 2 +- > t/db_dependent/Acquisition.t | 4 ++-- > 4 files changed, 8 insertions(+), 24 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index e8c7790..4905828 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2246,7 +2246,7 @@ sub GetLateOrders { > > =head3 GetHistory > >- (\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( %params ); >+ \@order_loop = GetHistory( %params ); > > Retreives some acquisition history information > >@@ -2286,9 +2286,6 @@ returns: > 'quantityreceived' => undef, > 'title' => 'The Adventures of Huckleberry Finn' > } >- $total_qty is the sum of all of the quantities in $order_loop >- $total_price is the cost of each in $order_loop times the quantity >- $total_qtyreceived is the sum of all of the quantityreceived entries in $order_loop > > =cut > >@@ -2457,18 +2454,8 @@ sub GetHistory { > } > } > $query .= " ORDER BY id"; >- my $sth = $dbh->prepare($query); >- $sth->execute( @query_params ); >- my $cnt = 1; >- while ( my $line = $sth->fetchrow_hashref ) { >- $line->{count} = $cnt++; >- $line->{toggle} = 1 if $cnt % 2; >- push @order_loop, $line; >- $total_qty += ( $line->{quantity} ) ? $line->{quantity} : 0; >- $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0; >- $total_price += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0; >- } >- return \@order_loop, $total_qty, $total_price, $total_qtyreceived; >+ >+ return $dbh->selectall_arrayref( $query, { Slice => {} }, @query_params ); > } > > =head2 GetRecentAcqui >diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl >index b474ac1..376681f 100755 >--- a/acqui/histsearch.pl >+++ b/acqui/histsearch.pl >@@ -103,10 +103,10 @@ if ( $d = $input->param('iso') ) { > $to_iso = C4::Dates->new($d)->output('iso'); > } > >-my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ); >+my $order_loop; > # If we're supplied any value then we do a search. Otherwise we don't. > if ($do_search) { >- ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory( >+ $order_loop = GetHistory( > title => $title, > author => $author, > isbn => $isbn, >@@ -139,9 +139,6 @@ for my $bp ( @{$budgetperiods} ) { > > $template->param( > order_loop => $order_loop, >- total_qty => $total_qty, >- total_qtyreceived => $total_qtyreceived, >- total_price => sprintf( "%.2f", $total_price ), > numresults => $order_loop ? scalar(@$order_loop) : undef, > title => $title, > author => $author, >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 967d71d..f33e263 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -168,7 +168,7 @@ foreach my $subscription (@subscriptions) { > > # Get acquisition details > if ( C4::Context->preference('AcquisitionDetails') ) { >- my ( $orders, $qty, $price, $received ) = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 ); >+ my $orders = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 ); > $template->param( > orders => $orders, > ); >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 1570480..8f52633 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -820,9 +820,9 @@ is( $neworder->{'budget_id'}, $budgetid, 'Budget on new order is unchanged' ); > is( $neworder->{ordernumber}, $new_ordernumber, 'Split: test ordernumber' ); > is( $neworder->{parent_ordernumber}, $ordernumbers[1], 'Split: test parent_ordernumber' ); > >-my ( $orders ) = GetHistory( ordernumber => $ordernumbers[1] ); >+my $orders = GetHistory( ordernumber => $ordernumbers[1] ); > is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order' ); >-( $orders ) = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 ); >+$orders = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 ); > is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' ); > > my $budgetid2 = C4::Budgets::AddBudget( >-- >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 12980
:
31832
|
31900
| 31984