<% include( 'elements/process.html', 'table' => 'did_order', 'viewall_dir' => 'browse', 'value_callback' => $value_callback, 'process_o2m' => { 'table' => 'did_order_item', 'fields' => [ qw( msanum npa latanum ratecenternum state quantity custnum ) ], }, ) %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Import'); unless($cgi->param('submitted')) { $cgi->param('submitted',time); } my $value_callback = sub { my ($field, $value) = @_; ($field =~ /ed$/ && $value !~ /^\d+$/) ? parse_datetime($value) : $value; }; my @params = $cgi->param; foreach my $param ( @params ) { if ( $param =~ /^(orderitemnum[0-9]+)_rc_new$/ ) { my $prefix = $1; my $value = $cgi->param($param); if( $value =~ /^[A-Za-z0-9:\- ]+$/ ) { my $rc = new FS::rate_center({ description => $value }); my $error = $rc->insert; die "error inserting new rate center: $error" if $error; $cgi->param("${prefix}_ratecenternum",$rc->ratecenternum); } } elsif ( $param =~ /^(orderitemnum[0-9]+)_custnum$/ ) { my $prefix = $1; my $value = $cgi->param($param); if ( $value =~ /^\d+$/ ) { $cgi->param("custnum",''); } } }