Lines 1266-1271
sub NewOrder {
Link Here
|
1266 |
my $dbh = C4::Context->dbh; |
1266 |
my $dbh = C4::Context->dbh; |
1267 |
my @params; |
1267 |
my @params; |
1268 |
|
1268 |
|
|
|
1269 |
croak "The ordernumber parameter should not be provided on calling NewOrder" |
1270 |
if $orderinfo->{ordernumber}; |
1269 |
|
1271 |
|
1270 |
# if these parameters are missing, we can't continue |
1272 |
# if these parameters are missing, we can't continue |
1271 |
for my $key (qw/basketno quantity biblionumber budget_id/) { |
1273 |
for my $key (qw/basketno quantity biblionumber budget_id/) { |
Lines 1281-1286
sub NewOrder {
Link Here
|
1281 |
my $schema = Koha::Database->new()->schema; |
1283 |
my $schema = Koha::Database->new()->schema; |
1282 |
my $columns = ' '.join(' ', $schema->source('Aqorder')->columns).' '; |
1284 |
my $columns = ' '.join(' ', $schema->source('Aqorder')->columns).' '; |
1283 |
my $new_order = { map { $columns =~ / $_ / ? ($_ => $orderinfo->{$_}) : () } keys(%$orderinfo) }; |
1285 |
my $new_order = { map { $columns =~ / $_ / ? ($_ => $orderinfo->{$_}) : () } keys(%$orderinfo) }; |
|
|
1286 |
$new_order->{ordernumber} ||= undef; |
1284 |
|
1287 |
|
1285 |
my $rs = $schema->resultset('Aqorder'); |
1288 |
my $rs = $schema->resultset('Aqorder'); |
1286 |
my $ordernumber = $rs->create($new_order)->id; |
1289 |
my $ordernumber = $rs->create($new_order)->id; |