<% $cgi->redirect( -uri => popurl(3). "view/cust_main.cgi?". $new->custnum,
-cookie => CGI::Cookie->new(
-name => 'freeside_status',
- -value => mt('Customer edited'),
+ -value => mt($freeside_status),
-expires => '+5m',
),
)
$cgi->param('tax','') unless defined $cgi->param('tax');
-$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] );
+$cgi->param('refnum', (split(/:/, ($cgi->multi_param('refnum'))[0] ))[0] );
#my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') );
#push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST');
my $duplicate_of = $1;
# if this is enabled, enforce it
-if ( $conf->exists('agent-ship_address', $cgi->param('agentnum')) ) {
+if ( $conf->exists('agent-ship_address', scalar($cgi->param('agentnum'))) ) {
my $agent = FS::agent->by_key($cgi->param('agentnum'));
my $agent_cust_main = $agent->agent_cust_main;
if ( $agent_cust_main ) {
(map { ( "ship_$_", '' ) } (FS::cust_main->location_fields))
} );
+# add any virtual fields to the new cust_main record
+foreach ($new->virtual_fields) {
+ $new->setfield($_, scalar($cgi->param($_)));
+}
+
warn Dumper( $new ) if $DEBUG > 1;
if ( $duplicate_of ) {
$error = 'Email address required';
}
- $options{'invoicing_list'} = [ split(/\s*,\s*/, $email) ];
+ $options{'invoicing_list'} = [ split(/[,\s]+/, $email) ];
# XXX really should include the phone numbers in here also
} else {
}
#perhaps this stuff should go to cust_main.pm
+my $freeside_status = '';
if ( $new->custnum eq '' or $duplicate_of ) {
+ $freeside_status = 'Customer added';
+
my $cust_pkg = '';
my $svc;
} else { #create old record object
+ $freeside_status = 'Customer edited';
+
my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } );
$error ||= "Old record not found!" unless $old;