|
Lines 660-668
subtest 'get_volumes_query' => sub {
Link Here
|
| 660 |
); |
660 |
); |
| 661 |
}; |
661 |
}; |
| 662 |
|
662 |
|
| 663 |
subtest 'orders() and uncancelled_orders() tests' => sub { |
663 |
subtest '->orders, ->uncancelled_orders and ->acq_status tests' => sub { |
| 664 |
|
664 |
|
| 665 |
plan tests => 5; |
665 |
plan tests => 9; |
| 666 |
|
666 |
|
| 667 |
$schema->storage->txn_begin; |
667 |
$schema->storage->txn_begin; |
| 668 |
|
668 |
|
|
Lines 683-690
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
| 683 |
{ |
683 |
{ |
| 684 |
class => 'Koha::Acquisition::Orders', |
684 |
class => 'Koha::Acquisition::Orders', |
| 685 |
value => { |
685 |
value => { |
| 686 |
biblionumber => $biblio->biblionumber, |
686 |
biblionumber => $biblio->biblionumber, |
| 687 |
datecancellationprinted => '2019-12-31' |
687 |
datecancellationprinted => '2019-12-31', |
|
|
688 |
orderstatus => 'cancelled', |
| 688 |
} |
689 |
} |
| 689 |
} |
690 |
} |
| 690 |
); |
691 |
); |
|
Lines 694-701
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
| 694 |
{ |
695 |
{ |
| 695 |
class => 'Koha::Acquisition::Orders', |
696 |
class => 'Koha::Acquisition::Orders', |
| 696 |
value => { |
697 |
value => { |
| 697 |
biblionumber => $biblio->biblionumber, |
698 |
biblionumber => $biblio->biblionumber, |
| 698 |
datecancellationprinted => undef |
699 |
datecancellationprinted => undef, |
|
|
700 |
orderstatus => 'ordered', |
| 701 |
quantity => 1, |
| 702 |
quantityreceived => 0, |
| 699 |
} |
703 |
} |
| 700 |
} |
704 |
} |
| 701 |
); |
705 |
); |
|
Lines 707-712
subtest 'orders() and uncancelled_orders() tests' => sub {
Link Here
|
| 707 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
711 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
| 708 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
712 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
| 709 |
|
713 |
|
|
|
714 |
# Check acq status |
| 715 |
is( $biblio->acq_status, 'processing', 'Processing for presence of ordered lines' ); |
| 716 |
$orders->filter_by_active->update( { orderstatus => 'new' } ); |
| 717 |
is( $biblio->acq_status, 'processing', 'Still processing for presence of new lines' ); |
| 718 |
$orders->filter_out_cancelled->update( { orderstatus => 'complete' } ); |
| 719 |
is( $biblio->acq_status, 'acquired', 'Acquired: some complete, rest cancelled' ); |
| 720 |
$orders->cancel; |
| 721 |
is( $biblio->acq_status, 'cancelled', 'Cancelled for only cancelled lines' ); |
| 722 |
|
| 710 |
$schema->storage->txn_rollback; |
723 |
$schema->storage->txn_rollback; |
| 711 |
}; |
724 |
}; |
| 712 |
|
725 |
|
| 713 |
- |
|
|