Lines 72-78
my @orders = C4::Acquisition::GetOrders( $basketno );
Link Here
|
72 |
is( scalar(@orders), 2, "2 orders are created" ); |
72 |
is( scalar(@orders), 2, "2 orders are created" ); |
73 |
is ( scalar( map { $_->{orderstatus} eq 'new' ? 1 : () } @orders ), 2, "2 orders are new before closing the basket" ); |
73 |
is ( scalar( map { $_->{orderstatus} eq 'new' ? 1 : () } @orders ), 2, "2 orders are new before closing the basket" ); |
74 |
|
74 |
|
75 |
C4::Acquisition::CloseBasket( $basketno ); |
75 |
Koha::Acquisition::Baskets->find( $basketno )->close; |
76 |
@orders = C4::Acquisition::GetOrders( $basketno ); |
76 |
@orders = C4::Acquisition::GetOrders( $basketno ); |
77 |
is ( scalar( map { $_->{orderstatus} eq 'ordered' ? 1 : () } @orders ), 2, "2 orders are ordered, the basket is closed" ); |
77 |
is ( scalar( map { $_->{orderstatus} eq 'ordered' ? 1 : () } @orders ), 2, "2 orders are ordered, the basket is closed" ); |
78 |
|
78 |
|
Lines 86-95
my ( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} );
Link Here
|
86 |
is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); |
86 |
is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); |
87 |
is( $order->{orderstatus}, 'cancelled', 'cancelling the order should have set status to cancelled' ); |
87 |
is( $order->{orderstatus}, 'cancelled', 'cancelling the order should have set status to cancelled' ); |
88 |
|
88 |
|
89 |
C4::Acquisition::CloseBasket( $basketno ); |
89 |
Koha::Acquisition::Baskets->find( $basketno )->close; |
90 |
( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); |
90 |
( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); |
91 |
is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); |
91 |
is( $order->{ordernumber}, $ordernumber1, 'The order returned by GetOrders should have been the right one' ); |
92 |
is( $order->{orderstatus}, 'cancelled', 'CloseBasket should not reset the status to ordered for cancelled orders' ); |
92 |
is( $order->{orderstatus}, 'cancelled', '$basket->close should not reset the status to ordered for cancelled orders' ); |
93 |
|
93 |
|
94 |
C4::Acquisition::ReopenBasket( $basketno ); |
94 |
C4::Acquisition::ReopenBasket( $basketno ); |
95 |
( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); |
95 |
( $order ) = C4::Acquisition::GetOrders( $basketno, {cancelled => 1} ); |