Commit a1298dad authored by joubu's avatar joubu

Bug 15184: Add the ordernumbers filters to GetHistory

It adds the ability to return the result of GetHistory given a list a
ordernumbers

Sponsored-by: BULAC - http://www.bulac.fr/Signed-off-by: Josef Moravec's avatarJosef Moravec <josef.moravec@gmail.com>
parent d0cb2945
......@@ -2290,6 +2290,7 @@ sub GetHistory {
my $ordernumber = $params{ordernumber};
my $search_children_too = $params{search_children_too} || 0;
my $created_by = $params{created_by} || [];
my $ordernumbers = $params{ordernumbers} || [];
my @order_loop;
my $total_qty = 0;
......@@ -2450,6 +2451,10 @@ sub GetHistory {
push @query_params, @$created_by;
}
if ( @$ordernumbers ) {
$query .= ' AND (aqorders.ordernumber IN ( ' . join (',', ('?') x @$ordernumbers ) . '))';
push @query_params, @$ordernumbers;
}
if ( C4::Context->preference("IndependentBranches") ) {
unless ( C4::Context->IsSuperLibrarian() ) {
......
......@@ -438,6 +438,11 @@ 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 );
is( scalar( @$orders ), 2, 'GetHistory with a given ordernumber and search_children_too set returns 2 orders' );
$orders = GetHistory( ordernumbers => [$ordernumbers[1]] );
is( scalar( @$orders ), 1, 'GetHistory with a given ordernumbers returns 1 order' );
$orders = GetHistory( ordernumbers => \@ordernumbers );
is( scalar( @$orders ), scalar( @ordernumbers ) - 1, 'GetHistory with a list of ordernumbers returns N-1 orders (was has been deleted [3])' );
# Test GetHistory() with and without SearchWithISBNVariations
# The ISBN passed as a param is the ISBN-10 version of the 13-digit ISBN in the sample record declared in $marcxml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment