@@ -, +, @@ $schema->resultset('Table')->create($data)->id $schema->resultset('Aqorder')->create($new_order)->id - AcqCreateItem set to ordering - Create an order with items and verify items are correctly linked to the order. --- C4/Acquisition.pm | 3 +++ t/db_dependent/Acquisition.t | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -1266,6 +1266,8 @@ sub NewOrder { my $dbh = C4::Context->dbh; my @params; + croak "The ordernumber parameter should not be provided on calling NewOrder" + if $orderinfo->{ordernumber}; # if these parameters are missing, we can't continue for my $key (qw/basketno quantity biblionumber budget_id/) { @@ -1281,6 +1283,7 @@ sub NewOrder { my $schema = Koha::Database->new()->schema; my $columns = ' '.join(' ', $schema->source('Aqorder')->columns).' '; my $new_order = { map { $columns =~ / $_ / ? ($_ => $orderinfo->{$_}) : () } keys(%$orderinfo) }; + $new_order->{ordernumber} ||= undef; my $rs = $schema->resultset('Aqorder'); my $ordernumber = $rs->create($new_order)->id; --- a/t/db_dependent/Acquisition.t +++ a/t/db_dependent/Acquisition.t @@ -195,7 +195,8 @@ my @order_content = ( budget_id => $budget->{budget_id}, uncertainprice => 0, order_internalnote => "internal note", - order_vendornote => "vendor note" + order_vendornote => "vendor note", + ordernumber => '', }, num => { quantity => 24, --