RT# 75817 - fixed issue with contact edit on edit customer page
[freeside.git] / httemplate / edit / cust_main.cgi
index d84679d..706435a 100755 (executable)
@@ -117,9 +117,7 @@ samechanged(document.getElementById('same'));
 
 <BR>
 
-<& cust_main/contacts_new.html,
-             'cust_main' => $cust_main,
-&>
+<& cust_main/contacts_new.html, 'cust_main'=>$cust_main, 'submit_id'=>'submitButton', &>
 
 %# billing info
 <& cust_main/billing.html, $cust_main,
@@ -320,8 +318,13 @@ if ( $cgi->param('error') ) {
 
   $custnum='';
   $cust_main = new FS::cust_main ( {} );
+
+  my @agentnums = $curuser->agentnums;
+  $cust_main->agentnum( $agentnums[0] )
+    if scalar(@agentnums) == 1;
   $cust_main->agentnum( $conf->config('default_agentnum') )
     if $conf->exists('default_agentnum');
+
   $cust_main->otaker( &getotaker );
   $cust_main->referral_custnum( $cgi->param('referral_custnum') );
   @invoicing_list = ();
@@ -397,7 +400,8 @@ if ( $cgi->param('error') ) {
 }
 
 my %keep = map { $_=>1 } qw( error tagnum lock_agentnum lock_pkgpart );
-$cgi->delete( grep { !$keep{$_} && $_ !~ /^tax_/ } $cgi->param );
+#$cgi->delete( grep { !$keep{$_} && $_ !~ /^tax_/ } $cgi->param );
+$cgi->delete( grep { !$keep{$_} && $_ !~ /^tax_/ && $_ !~ /^contactnum/ } $cgi->param );
 
 my $title = $custnum ? 'Edit Customer' : 'Add Customer';
 $title = mt($title);