blob: 23fe62bfd8bbe0a7b27d7ef8f2199cd51591284f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<% 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",'');
}
}
}
</%init>
|