Lines 2-8
Link Here
|
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
|
4 |
|
5 |
use Test::More tests => 13; |
5 |
use Test::More tests => 14; |
6 |
use C4::Context; |
6 |
use C4::Context; |
7 |
use C4::Acquisition qw( NewBasket GetOrders GetOrder TransferOrder SearchOrders ModReceiveOrder CancelReceipt ); |
7 |
use C4::Acquisition qw( NewBasket GetOrders GetOrder TransferOrder SearchOrders ModReceiveOrder CancelReceipt ); |
8 |
use C4::Biblio; |
8 |
use C4::Biblio; |
Lines 14-19
use Koha::Acquisition::Booksellers;
Link Here
|
14 |
use Koha::Acquisition::Orders; |
14 |
use Koha::Acquisition::Orders; |
15 |
use t::lib::TestBuilder; |
15 |
use t::lib::TestBuilder; |
16 |
use MARC::Record; |
16 |
use MARC::Record; |
|
|
17 |
use String::Random qw(random_string); |
17 |
|
18 |
|
18 |
my $schema = Koha::Database->new()->schema(); |
19 |
my $schema = Koha::Database->new()->schema(); |
19 |
$schema->storage->txn_begin(); |
20 |
$schema->storage->txn_begin(); |
Lines 110-113
$order = GetOrder( $newordernumber );
Link Here
|
110 |
is ( $order->{ordernumber}, $newordernumber, 'Regression test Bug 11549: After a transfer, receive and cancel the receive should be possible.' ); |
111 |
is ( $order->{ordernumber}, $newordernumber, 'Regression test Bug 11549: After a transfer, receive and cancel the receive should be possible.' ); |
111 |
is ( $order->{basketno}, $basketno2, 'Regression test Bug 11549: The order still exist in the basket where the transfer has been done.'); |
112 |
is ( $order->{basketno}, $basketno2, 'Regression test Bug 11549: The order still exist in the basket where the transfer has been done.'); |
112 |
|
113 |
|
|
|
114 |
subtest 'TransferOrder should copy additional fields' => sub { |
115 |
plan tests => 2; |
116 |
|
117 |
my $field = Koha::AdditionalField->new( |
118 |
{ |
119 |
tablename => 'aqorders', |
120 |
name => random_string('c' x 100), |
121 |
} |
122 |
); |
123 |
$field->store()->discard_changes(); |
124 |
my $order = Koha::Acquisition::Order->new( |
125 |
{ |
126 |
basketno => $basketno1, |
127 |
quantity => 2, |
128 |
biblionumber => $biblionumber, |
129 |
budget_id => $budget->{budget_id}, |
130 |
} |
131 |
)->store; |
132 |
$order->set_additional_fields( |
133 |
[ |
134 |
{ |
135 |
id => $field->id, |
136 |
value => 'additional field value', |
137 |
}, |
138 |
] |
139 |
); |
140 |
|
141 |
my $newordernumber = TransferOrder($order->ordernumber, $basketno2); |
142 |
my $neworder = Koha::Acquisition::Orders->find($newordernumber); |
143 |
my $field_values = $neworder->additional_field_values()->as_list; |
144 |
|
145 |
is(scalar @$field_values, 1, 'transfered order has one additional field value'); |
146 |
is($field_values->[0]->value, 'additional field value', 'transfered order additional field has the correct value'); |
147 |
}; |
148 |
|
113 |
$schema->storage->txn_rollback(); |
149 |
$schema->storage->txn_rollback(); |
114 |
- |
|
|