Lines 942-950
subtest 'get_volumes_query' => sub {
Link Here
|
942 |
); |
942 |
); |
943 |
}; |
943 |
}; |
944 |
|
944 |
|
945 |
subtest 'orders() and uncancelled_orders() tests' => sub { |
945 |
subtest '->orders, ->uncancelled_orders and ->acq_status tests' => sub { |
946 |
|
946 |
|
947 |
plan tests => 5; |
947 |
plan tests => 9; |
948 |
|
948 |
|
949 |
$schema->storage->txn_begin; |
949 |
$schema->storage->txn_begin; |
950 |
|
950 |
|
Lines 965-972
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
965 |
{ |
965 |
{ |
966 |
class => 'Koha::Acquisition::Orders', |
966 |
class => 'Koha::Acquisition::Orders', |
967 |
value => { |
967 |
value => { |
968 |
biblionumber => $biblio->biblionumber, |
968 |
biblionumber => $biblio->biblionumber, |
969 |
datecancellationprinted => '2019-12-31' |
969 |
datecancellationprinted => '2019-12-31', |
|
|
970 |
orderstatus => 'cancelled', |
970 |
} |
971 |
} |
971 |
} |
972 |
} |
972 |
); |
973 |
); |
Lines 976-983
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
976 |
{ |
977 |
{ |
977 |
class => 'Koha::Acquisition::Orders', |
978 |
class => 'Koha::Acquisition::Orders', |
978 |
value => { |
979 |
value => { |
979 |
biblionumber => $biblio->biblionumber, |
980 |
biblionumber => $biblio->biblionumber, |
980 |
datecancellationprinted => undef |
981 |
datecancellationprinted => undef, |
|
|
982 |
orderstatus => 'ordered', |
983 |
quantity => 1, |
984 |
quantityreceived => 0, |
981 |
} |
985 |
} |
982 |
} |
986 |
} |
983 |
); |
987 |
); |
Lines 989-994
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
989 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
993 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
990 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
994 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
991 |
|
995 |
|
|
|
996 |
# Check acq status |
997 |
is( $biblio->acq_status, 'processing', 'Processing for presence of ordered lines' ); |
998 |
$orders->filter_by_active->update( { orderstatus => 'new' } ); |
999 |
is( $biblio->acq_status, 'processing', 'Still processing for presence of new lines' ); |
1000 |
$orders->filter_out_cancelled->update( { orderstatus => 'complete' } ); |
1001 |
is( $biblio->acq_status, 'acquired', 'Acquired: some complete, rest cancelled' ); |
1002 |
$orders->cancel; |
1003 |
is( $biblio->acq_status, 'cancelled', 'Cancelled for only cancelled lines' ); |
1004 |
|
992 |
$schema->storage->txn_rollback; |
1005 |
$schema->storage->txn_rollback; |
993 |
}; |
1006 |
}; |
994 |
|
1007 |
|
995 |
- |
|
|