|
Lines 624-630
subtest 'filter_by_current & filter_by_cancelled' => sub {
Link Here
|
| 624 |
|
624 |
|
| 625 |
subtest 'cancel() tests' => sub { |
625 |
subtest 'cancel() tests' => sub { |
| 626 |
|
626 |
|
| 627 |
plan tests => 54; |
627 |
plan tests => 56; |
| 628 |
|
628 |
|
| 629 |
$schema->storage->txn_begin; |
629 |
$schema->storage->txn_begin; |
| 630 |
|
630 |
|
|
Lines 860-865
subtest 'cancel() tests' => sub {
Link Here
|
| 860 |
@messages = @{ $order->object_messages }; |
860 |
@messages = @{ $order->object_messages }; |
| 861 |
is( scalar @messages, 0, 'No errors' ); |
861 |
is( scalar @messages, 0, 'No errors' ); |
| 862 |
|
862 |
|
|
|
863 |
# Scenario: |
| 864 |
# * order made from a suggestion with same biblionumber |
| 865 |
# => order is cancelled |
| 866 |
# => suggestion status is changed to ACCEPTED |
| 867 |
|
| 868 |
$item = $builder->build_sample_item; |
| 869 |
$biblio_id = $item->biblionumber; |
| 870 |
|
| 871 |
# Add the suggestion |
| 872 |
my $suggestion = $builder->build_object( |
| 873 |
{ |
| 874 |
class => 'Koha::Suggestions', |
| 875 |
value => { |
| 876 |
biblionumber => $biblio_id, |
| 877 |
suggesteddate => dt_from_string, |
| 878 |
STATUS => 'ORDERED', |
| 879 |
archived => 0, |
| 880 |
} |
| 881 |
} |
| 882 |
); |
| 883 |
|
| 884 |
$order = $builder->build_object( |
| 885 |
{ |
| 886 |
class => 'Koha::Acquisition::Orders', |
| 887 |
value => { |
| 888 |
orderstatus => 'new', |
| 889 |
biblionumber => $biblio_id, |
| 890 |
datecancellationprinted => undef, |
| 891 |
cancellationreason => undef, |
| 892 |
} |
| 893 |
} |
| 894 |
); |
| 895 |
|
| 896 |
$order->cancel({ reason => $reason }) |
| 897 |
->discard_changes; |
| 898 |
|
| 899 |
$suggestion = Koha::Suggestions->find( $suggestion->id ); |
| 900 |
|
| 901 |
is( $order->orderstatus, 'cancelled', 'Order is marked as cancelled' ); |
| 902 |
is( $suggestion->STATUS, 'ACCEPTED', 'Suggestion status is correctly reverted after order is cancelled' ); |
| 903 |
|
| 863 |
# Scenario: |
904 |
# Scenario: |
| 864 |
# * order with two items attached |
905 |
# * order with two items attached |
| 865 |
# * one of the items is on loan |
906 |
# * one of the items is on loan |
| 866 |
- |
|
|