Lines 896-904
subtest 'get_volumes_query' => sub {
Link Here
|
896 |
); |
896 |
); |
897 |
}; |
897 |
}; |
898 |
|
898 |
|
899 |
subtest 'orders() and uncancelled_orders() tests' => sub { |
899 |
subtest '->orders, ->uncancelled_orders and ->acq_status tests' => sub { |
900 |
|
900 |
|
901 |
plan tests => 5; |
901 |
plan tests => 9; |
902 |
|
902 |
|
903 |
$schema->storage->txn_begin; |
903 |
$schema->storage->txn_begin; |
904 |
|
904 |
|
Lines 919-926
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
919 |
{ |
919 |
{ |
920 |
class => 'Koha::Acquisition::Orders', |
920 |
class => 'Koha::Acquisition::Orders', |
921 |
value => { |
921 |
value => { |
922 |
biblionumber => $biblio->biblionumber, |
922 |
biblionumber => $biblio->biblionumber, |
923 |
datecancellationprinted => '2019-12-31' |
923 |
datecancellationprinted => '2019-12-31', |
|
|
924 |
orderstatus => 'cancelled', |
924 |
} |
925 |
} |
925 |
} |
926 |
} |
926 |
); |
927 |
); |
Lines 930-937
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
930 |
{ |
931 |
{ |
931 |
class => 'Koha::Acquisition::Orders', |
932 |
class => 'Koha::Acquisition::Orders', |
932 |
value => { |
933 |
value => { |
933 |
biblionumber => $biblio->biblionumber, |
934 |
biblionumber => $biblio->biblionumber, |
934 |
datecancellationprinted => undef |
935 |
datecancellationprinted => undef, |
|
|
936 |
orderstatus => 'ordered', |
937 |
quantity => 1, |
938 |
quantityreceived => 0, |
935 |
} |
939 |
} |
936 |
} |
940 |
} |
937 |
); |
941 |
); |
Lines 943-948
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
943 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
947 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
944 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
948 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
945 |
|
949 |
|
|
|
950 |
# Check acq status |
951 |
is( $biblio->acq_status, 'processing', 'Processing for presence of ordered lines' ); |
952 |
$orders->filter_by_active->update( { orderstatus => 'new' } ); |
953 |
is( $biblio->acq_status, 'processing', 'Still processing for presence of new lines' ); |
954 |
$orders->filter_out_cancelled->update( { orderstatus => 'complete' } ); |
955 |
is( $biblio->acq_status, 'acquired', 'Acquired: some complete, rest cancelled' ); |
956 |
$orders->cancel; |
957 |
is( $biblio->acq_status, 'cancelled', 'Cancelled for only cancelled lines' ); |
958 |
|
946 |
$schema->storage->txn_rollback; |
959 |
$schema->storage->txn_rollback; |
947 |
}; |
960 |
}; |
948 |
|
961 |
|
949 |
- |
|
|