+my $conf = new FS::Conf;
+
+my $ordernum = $cgi->param('ordernum');
+$ordernum = '' unless $ordernum =~ /^\d+$/;
+
+my $vendor_order_id = '';
+my $confirmed = '';
+
+my $order = '';
+$order = qsearchs('did_order', { 'ordernum' => $ordernum } )
+ if $ordernum;
+
+die 'invalid ordernum' unless (!$ordernum || $order);
+
+my $format = 'default';
+
+if ( $order ) {
+ $format = 'bulk';
+ $confirmed = $order->confirmed;
+ $vendor_order_id = $order->vendor_order_id;
+}
+
+
+my $availbatch =
+ time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+
+my @exports = qsearch('part_export', { 'exporttype' => 'internal_diddb', });