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

(-)a/C4/Acquisition.pm (-16 / +3 lines)
Lines 2246-2252 sub GetLateOrders { Link Here
2246
2246
2247
=head3 GetHistory
2247
=head3 GetHistory
2248
2248
2249
  (\@order_loop, $total_qty, $total_price, $total_qtyreceived) = GetHistory( %params );
2249
  \@order_loop = GetHistory( %params );
2250
2250
2251
Retreives some acquisition history information
2251
Retreives some acquisition history information
2252
2252
Lines 2286-2294 returns: Link Here
2286
                'quantityreceived' => undef,
2286
                'quantityreceived' => undef,
2287
                'title'            => 'The Adventures of Huckleberry Finn'
2287
                'title'            => 'The Adventures of Huckleberry Finn'
2288
            }
2288
            }
2289
    $total_qty is the sum of all of the quantities in $order_loop
2290
    $total_price is the cost of each in $order_loop times the quantity
2291
    $total_qtyreceived is the sum of all of the quantityreceived entries in $order_loop
2292
2289
2293
=cut
2290
=cut
2294
2291
Lines 2457-2474 sub GetHistory { Link Here
2457
        }
2454
        }
2458
    }
2455
    }
2459
    $query .= " ORDER BY id";
2456
    $query .= " ORDER BY id";
2460
    my $sth = $dbh->prepare($query);
2457
2461
    $sth->execute( @query_params );
2458
    return $dbh->selectall_arrayref( $query, { Slice => {} }, @query_params );
2462
    my $cnt = 1;
2463
    while ( my $line = $sth->fetchrow_hashref ) {
2464
        $line->{count} = $cnt++;
2465
        $line->{toggle} = 1 if $cnt % 2;
2466
        push @order_loop, $line;
2467
        $total_qty         += ( $line->{quantity} ) ? $line->{quantity} : 0;
2468
        $total_qtyreceived += ( $line->{quantityreceived} ) ? $line->{quantityreceived} : 0;
2469
        $total_price       += ( $line->{quantity} and $line->{ecost} ) ? $line->{quantity} * $line->{ecost} : 0;
2470
    }
2471
    return \@order_loop, $total_qty, $total_price, $total_qtyreceived;
2472
}
2459
}
2473
2460
2474
=head2 GetRecentAcqui
2461
=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 820-828 is( $neworder->{'budget_id'}, $budgetid, 'Budget on new order is unchanged' ); Link Here
820
is( $neworder->{ordernumber}, $new_ordernumber, 'Split: test ordernumber' );
820
is( $neworder->{ordernumber}, $new_ordernumber, 'Split: test ordernumber' );
821
is( $neworder->{parent_ordernumber}, $ordernumbers[1], 'Split: test parent_ordernumber' );
821
is( $neworder->{parent_ordernumber}, $ordernumbers[1], 'Split: test parent_ordernumber' );
822
822
823
my ( $orders ) = GetHistory( ordernumber => $ordernumbers[1] );
823
my $orders = GetHistory( ordernumber => $ordernumbers[1] );
824
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order' );
824
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumber returns 1 order' );
825
( $orders ) = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 );
825
$orders = GetHistory( ordernumber => $ordernumbers[1], search_children_too => 1 );
826
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' );
826
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' );
827
827
828
my $budgetid2 = C4::Budgets::AddBudget(
828
my $budgetid2 = C4::Budgets::AddBudget(
829
- 

Return to bug 12980