name_prefix => 'ic_',
name_postfix => "_$i",
dbh => $dbh);
+ # link order items with doi
+ if ($form->{"converted_from_orderitems_id_$i"}) {
+ RecordLinks->create_links('dbh' => $dbh,
+ 'mode' => 'ids',
+ 'from_table' => 'orderitems',
+ 'from_ids' => $form->{"converted_from_orderitems_id_$i"},
+ 'to_table' => 'delivery_order_items',
+ 'to_id' => $form->{"delivery_order_items_id_$i"},
+ );
+ delete $form->{"converted_from_orderitems_id_$i"};
+ }
}
# 1. search for orphaned dois; processed_dois may be empty (no transfer) TODO: be supersafe and alter same statement for doi and oi
next if (!$form->{"id_$i"});
if ($item->[1] ne $sameitem) {
- push(@{ $form->{description} }, qq|$item->[1]|);
+ push(@{ $form->{TEMPLATE_ARRAYS}->{description} }, qq|$item->[1]|);
$sameitem = $item->[1];
- map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
+ map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, "") } grep({ $_ ne "description" && $_ !~ /^si_/} @arrays));
+ map({ push(@{ $form->{TEMPLATE_ARRAYS}->{$_} }, []) } grep({ $_ =~ /^si_/} @arrays));
+ $si_position++;
}
$form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"});