View | Details | Raw Unified | Return to bug 12404
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-16 / +3 lines)
Lines 2186-2192 sub GetLateOrders { Link Here
2186
2186
2187
=head3 GetHistory
2187
=head3 GetHistory
2188
2188
2189
  (\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( %params );
2189
  \@order_loop = GetHistory( %params );
2190
2190
2191
Retreives some acquisition history information
2191
Retreives some acquisition history information
2192
2192
Lines 2226-2234 returns: Link Here
2226
                'quantityreceived' => undef,
2226
                'quantityreceived' => undef,
2227
                'title'            => 'The Adventures of Huckleberry Finn'
2227
                'title'            => 'The Adventures of Huckleberry Finn'
2228
            }
2228
            }
2229
    $total_qty is the sum of all of the quantities in $order_loop
2230
    $total_price is the cost of each in $order_loop times the quantity
2231
    $total_qtyreceived is the sum of all of the quantityreceived entries in $order_loop
2232
2229
2233
=cut
2230
=cut
2234
2231
Lines 2397-2414 sub GetHistory { Link Here
2397
        }
2394
        }
2398
    }
2395
    }
2399
    $query .= " ORDER BY id";
2396
    $query .= " ORDER BY id";
2400
    my $sth = $dbh->prepare($query);
2397
2401
    $sth->execute( @query_params );
2398
    return $dbh->selectall_arrayref( $query, { Slice => {} }, @query_params );
2402
    my $cnt = 1;
2403
    while ( my $line = $sth->fetchrow_hashref ) {
2404
        $line->{count} = $cnt++;
2405
        $line->{toggle} = 1 if $cnt % 2;
2406
        push @order_loop, $line;
2407
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2408
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2409
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2410
    }
2411
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2412
}
2399
}
2413
2400
2414
=head2 GetRecentAcqui
2401
=head2 GetRecentAcqui
(-)a/acqui/histsearch.pl (-5 / +2 lines)
Lines 103-112 if ( $d = $input->param('iso') ) { Link Here
103
    $to_iso = C4::Dates->new($d)->output('iso');
103
    $to_iso = C4::Dates->new($d)->output('iso');
104
}
104
}
105
105
106
my ( $order_loop, $total_qty, $total_price, $total_qtyreceived );
106
my $order_loop;
107
# If we're supplied any value then we do a search. Otherwise we don't.
107
# If we're supplied any value then we do a search. Otherwise we don't.
108
if ($do_search) {
108
if ($do_search) {
109
    ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
109
    $order_loop = GetHistory(
110
        title => $title,
110
        title => $title,
111
        author => $author,
111
        author => $author,
112
        isbn   => $isbn,
112
        isbn   => $isbn,
Lines 139-147 for my $bp ( @{$budgetperiods} ) { Link Here
139
139
140
$template->param(
140
$template->param(
141
    order_loop              => $order_loop,
141
    order_loop              => $order_loop,
142
    total_qty               => $total_qty,
143
    total_qtyreceived       => $total_qtyreceived,
144
    total_price             => sprintf( "%.2f", $total_price ),
145
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
142
    numresults              => $order_loop ? scalar(@$order_loop) : undef,
146
    title                   => $title,
143
    title                   => $title,
147
    author                  => $author,
144
    author                  => $author,
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 168-174 foreach my $subscription (@subscriptions) { Link Here
168
168
169
# Get acquisition details
169
# Get acquisition details
170
if ( C4::Context->preference('AcquisitionDetails') ) {
170
if ( C4::Context->preference('AcquisitionDetails') ) {
171
    my ( $orders, $qty, $price, $received ) = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 );
171
    my $orders = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 );
172
    $template->param(
172
    $template->param(
173
        orders => $orders,
173
        orders => $orders,
174
    );
174
    );
(-)a/t/db_dependent/Acquisition.t (-3 / +2 lines)
Lines 834-842 is( $neworder->{'budget_id'}, $budgetid, 'Budget on new order is unchanged' ); Link Here
834
is( $neworder->{ordernumber}, $new_ordernumber, 'Split: test ordernumber' );
834
is( $neworder->{ordernumber}, $new_ordernumber, 'Split: test ordernumber' );
835
is( $neworder->{parent_ordernumber}, $ordernumbers[1], 'Split: test parent_ordernumber' );
835
is( $neworder->{parent_ordernumber}, $ordernumbers[1], 'Split: test parent_ordernumber' );
836
836
837
my ( $orders ) = GetHistory( ordernumber => $ordernumbers[1] );
837
my $orders = GetHistory( ordernumber => $ordernumbers[1] );
838
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order' );
838
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order' );
839
( $orders ) = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 );
839
$orders = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 );
840
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' );
840
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' );
841
841
842
my $budgetid2 = C4::Budgets::AddBudget(
842
my $budgetid2 = C4::Budgets::AddBudget(
843
- 

Return to bug 12404