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

(-)a/C4/Acquisition.pm (-3 / +3 lines)
Lines 1630-1641 sub CancelReceipt { Link Here
1630
    basketno => $basketno,
1630
    basketno => $basketno,
1631
    owner => $owner,
1631
    owner => $owner,
1632
    pending => $pending
1632
    pending => $pending
1633
    ordered => $ordered
1633
});
1634
});
1634
1635
1635
Searches for orders.
1636
Searches for orders.
1636
1637
1637
C<$owner> Finds order for the logged in user.
1638
C<$owner> Finds order for the logged in user.
1638
C<$pending> Finds pending orders. Ignores completed and cancelled orders.
1639
C<$pending> Finds pending orders. Ignores completed and cancelled orders.
1640
C<$ordered> Finds orders to receive only (status 'ordered' or 'partial').
1639
1641
1640
1642
1641
C<@results> is an array of references-to-hash with the keys are fields
1643
C<@results> is an array of references-to-hash with the keys are fields
Lines 1681-1692 sub SearchOrders { Link Here
1681
        WHERE (datecancellationprinted is NULL)
1683
        WHERE (datecancellationprinted is NULL)
1682
    };
1684
    };
1683
1685
1684
    if ( $pending ) {
1686
    if ( $pending or $ordered ) {
1685
        $query .= q{ AND (quantity > quantityreceived OR quantityreceived is NULL)};
1687
        $query .= q{ AND (quantity > quantityreceived OR quantityreceived is NULL)};
1686
    }
1688
    }
1687
    if ( $ordered ) {
1689
    if ( $ordered ) {
1688
        $query .= q{ AND (quantity > quantityreceived OR quantityreceived is NULL)}
1689
            unless $pending;
1690
        $query .= q{ AND aqorders.orderstatus IN ( "ordered", "partial" )};
1690
        $query .= q{ AND aqorders.orderstatus IN ( "ordered", "partial" )};
1691
    }
1691
    }
1692
1692
(-)a/t/db_dependent/Acquisition.t (-2 / +19 lines)
Lines 8-14 use POSIX qw(strftime); Link Here
8
8
9
use C4::Bookseller qw( GetBookSellerFromId );
9
use C4::Bookseller qw( GetBookSellerFromId );
10
10
11
use Test::More tests => 64;
11
use Test::More tests => 66;
12
12
13
BEGIN {
13
BEGIN {
14
    use_ok('C4::Acquisition');
14
    use_ok('C4::Acquisition');
Lines 700-705 ok( Link Here
700
    "SearchOrders with pending params gets only pending orders (bug 10723)"
700
    "SearchOrders with pending params gets only pending orders (bug 10723)"
701
);
701
);
702
702
703
$search_orders = SearchOrders({
704
    booksellerid => $booksellerid,
705
    basketno     => $basketno,
706
    pending      => 1,
707
    ordered      => 1,
708
});
709
is( scalar (@$search_orders), 0, "SearchOrders with pending and ordered params gets only pending ordered orders (bug 11170)" );
710
711
703
#
712
#
704
# Test GetBudgetByOrderNumber
713
# Test GetBudgetByOrderNumber
705
#
714
#
Lines 760-765 is( join( " ", @$test_extra_fields ), Link Here
760
is( join( " ", @$test_different_fields ),
769
is( join( " ", @$test_different_fields ),
761
    '', "GetLateOrders gets orders with the right content in every fields" );
770
    '', "GetLateOrders gets orders with the right content in every fields" );
762
771
772
$search_orders = SearchOrders({
773
    booksellerid => $booksellerid,
774
    basketno     => $basketno,
775
    pending      => 1,
776
    ordered      => 1,
777
});
778
is( scalar (@$search_orders), 3, "SearchOrders with pending and ordered params gets only pending ordered orders. After closing the basket, orders are marked as 'ordered' (bug 11170)" );
779
780
763
#
781
#
764
# Test AddClaim
782
# Test AddClaim
765
#
783
#
766
- 

Return to bug 11170