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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 2277-2283 sub GetHistory { Link Here
2277
        push @query_params, $to_placed_on;
2277
        push @query_params, $to_placed_on;
2278
    }
2278
    }
2279
2279
2280
    if ( defined $orderstatus and $orderstatus ne '') {
2280
    if ( defined $orderstatus and $orderstatus ne '' and $orderstatus ne 'any') {
2281
        $query .= " AND aqorders.orderstatus = ? ";
2281
        $query .= " AND aqorders.orderstatus = ? ";
2282
        push @query_params, "$orderstatus";
2282
        push @query_params, "$orderstatus";
2283
    }
2283
    }
(-)a/acqui/duplicate_orders.pl (-6 lines)
Lines 85-91 if ( $op eq 'select' ) { Link Here
85
85
86
    # Set filter for 'all status'
86
    # Set filter for 'all status'
87
    if ( $filters->{orderstatus} eq "any" ) {
87
    if ( $filters->{orderstatus} eq "any" ) {
88
        delete( $filters->{orderstatus} );
89
        $filters->{get_canceled_order} = 1;
88
        $filters->{get_canceled_order} = 1;
90
    }
89
    }
91
90
Lines 94-104 if ( $op eq 'select' ) { Link Here
94
        ( grep {$_ eq $order->{ordernumber}} @ordernumbers ) ? () : $order
93
        ( grep {$_ eq $order->{ordernumber}} @ordernumbers ) ? () : $order
95
    } @{ C4::Acquisition::GetHistory(%$filters) };
94
    } @{ C4::Acquisition::GetHistory(%$filters) };
96
95
97
    # Reset order status for 'all status'
98
    if ( $filters->{get_canceled_order} ) {
99
        $filters->{orderstatus} = "any";
100
    }
101
102
    @selected_order_loop =
96
    @selected_order_loop =
103
      scalar @ordernumbers
97
      scalar @ordernumbers
104
      ? @{ C4::Acquisition::GetHistory( ordernumbers => \@ordernumbers ) }
98
      ? @{ C4::Acquisition::GetHistory( ordernumbers => \@ordernumbers ) }
(-)a/acqui/histsearch.pl (-6 lines)
Lines 116-122 $filters->{additional_fields} = \@additional_field_filters; Link Here
116
116
117
# Set filter for 'all status'
117
# Set filter for 'all status'
118
if ( $filters->{orderstatus} eq "any" ) {
118
if ( $filters->{orderstatus} eq "any" ) {
119
    delete( $filters->{orderstatus} );
120
    $filters->{get_canceled_order} = 1;
119
    $filters->{get_canceled_order} = 1;
121
}
120
}
122
121
Lines 126-136 if ($do_search) { Link Here
126
    $order_loop = GetHistory(%$filters);
125
    $order_loop = GetHistory(%$filters);
127
}
126
}
128
127
129
# Reset order status for 'all status'
130
if ( $filters->{get_canceled_order} ) {
131
    $filters->{orderstatus} = "any";
132
}
133
134
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
128
my $budgetperiods = C4::Budgets::GetBudgetPeriods;
135
my $bp_loop = $budgetperiods;
129
my $bp_loop = $budgetperiods;
136
for my $bp ( @{$budgetperiods} ) {
130
for my $bp ( @{$budgetperiods} ) {
(-)a/t/db_dependent/Acquisition.t (-2 / +41 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use POSIX qw(strftime);
20
use POSIX qw(strftime);
21
21
22
use Test::More tests => 72;
22
use Test::More tests => 73;
23
use t::lib::Mocks;
23
use t::lib::Mocks;
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::DateUtils qw(dt_from_string output_pref);
25
use Koha::DateUtils qw(dt_from_string output_pref);
Lines 965-970 subtest 'ModReceiveOrder invoice_unitprice and invoice_currency' => sub { Link Here
965
965
966
};
966
};
967
967
968
subtest 'GetHistory status search' => sub {
969
    plan tests => 3;
970
971
    my $builder      = t::lib::TestBuilder->new;
972
    my $order_basket = $builder->build( { source => 'Aqbasket', value => { is_standing => 0 } } );
973
    my $orderinfo    = {
974
        basketno                => $order_basket->{basketno},
975
        rrp                     => 19.99,
976
        replacementprice        => undef,
977
        quantity                => 1,
978
        quantityreceived        => 0,
979
        datereceived            => undef,
980
        orderstatus             => 'cancelled',
981
        datecancellationprinted => '1990-01-01',
982
        order_vendornote        => 'status search'
983
    };
984
    my $order = $builder->build( { source => 'Aqorder', value => $orderinfo } );
985
    my $orderinfo2    = {
986
        basketno                => $order_basket->{basketno},
987
        rrp                     => 19.99,
988
        replacementprice        => undef,
989
        quantity                => 1,
990
        quantityreceived        => 0,
991
        datereceived            => undef,
992
        orderstatus             => 'new',
993
        datecancellationprinted => undef,
994
        order_vendornote        => 'status search'
995
    };
996
    $order = $builder->build( { source => 'Aqorder', value => $orderinfo2 } );
997
    
998
    $orders = GetHistory( order_status => "new", vendornote => 'status search' );
999
    is( scalar(@$orders), 1, 'GetHistory with order status "new" returns 1 order' );
1000
1001
    my $orders = GetHistory( get_canceled_order => 1, order_status => "any", vendornote => 'status search' );
1002
    is( scalar(@$orders), 2, 'GetHistory with order status "any" returns all orders' );
1003
1004
    $orders = GetHistory( order_status => "", vendornote => 'status search' );
1005
    is( scalar(@$orders), 1, 'GetHistory with order status "all except cancelled" returns zero orders' );
1006
};
1007
968
subtest 'GetHistory with additional fields' => sub {
1008
subtest 'GetHistory with additional fields' => sub {
969
    plan tests => 3;
1009
    plan tests => 3;
970
    my $builder = t::lib::TestBuilder->new;
1010
    my $builder = t::lib::TestBuilder->new;
971
- 

Return to bug 14092