X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_main.cgi;h=d77aa2fdde75d8e2902f198918f95a5381898e3a;hb=cccd0b7cd38a88c131e19981be38434f87abe194;hp=fa50dc6266eb0222f632af2df44ba777a28c52ec;hpb=1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39;p=freeside.git diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index fa50dc626..d77aa2fdd 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,6 +1,7 @@ - <% +warn join('', map { "$_ => ". $cgi->param($_). "\n" } $cgi->param ); + my $error = ''; #unmunge stuff @@ -9,31 +10,32 @@ $cgi->param('tax','') unless defined $cgi->param('tax'); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); -$cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ - or die "Oops, illegal \"state\" param: ". $cgi->param('state'); -$cgi->param('state', $1); -$cgi->param('county', $3 || ''); -$cgi->param('country', $4); +#my $payby = $cgi->param('payby'); +my $payby = $cgi->param('select'); # XXX key + +my %noauto = ( + 'CARD' => 'DCRD', + 'CHEK' => 'DCHK', +); +$payby = $noauto{$payby} + if ! $cgi->param('payauto') && exists $noauto{$payby}; -$cgi->param('ship_state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ - or $cgi->param('ship_state') =~ /^(((())))$/ - or die "Oops, illegal \"ship_state\" param: ". $cgi->param('ship_state'); -$cgi->param('ship_state', $1); -$cgi->param('ship_county', $3 || ''); -$cgi->param('ship_country', $4); +$cgi->param('payby', $payby); -my $payby = $cgi->param('payby'); if ( $payby ) { - $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); + if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { + $cgi->param('payinfo', + $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') ); + } $cgi->param('paydate', - $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); - $cgi->param('payname', $cgi->param( $payby. '_payname' ) ); + $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) ); } -$cgi->param('otaker', &getotaker ); - my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); +push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX'); +$cgi->param('invoicing_list', join(',', @invoicing_list) ); + #create new record object @@ -53,6 +55,9 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } +$new->setfield('paid', $cgi->param('paid') ) + if $cgi->param('paid'); + #perhaps this stuff should go to cust_main.pm my $cust_pkg = ''; my $svc_acct = ''; @@ -60,7 +65,7 @@ if ( $new->custnum eq '' ) { if ( $cgi->param('pkgpart_svcpart') ) { my $x = $cgi->param('pkgpart_svcpart'); - $x =~ /^(\d+)_(\d+)$/; + $x =~ /^(\d+)_(\d+)$/ or die "illegal pkgpart_svcpart $x\n"; my($pkgpart, $svcpart) = ($1, $2); #false laziness: copied from FS::cust_pkg::order (which should become a #FS::cust_main method) @@ -78,7 +83,7 @@ if ( $new->custnum eq '' ) { #eslaf # this should wind up in FS::cust_pkg! - $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't". + $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't ". "purchase pkgpart ". $pkgpart #unless $part_pkg{ $pkgpart }; unless $pkgpart_href->{ $pkgpart }; @@ -87,7 +92,7 @@ if ( $new->custnum eq '' ) { #later 'custnum' => $custnum, 'pkgpart' => $pkgpart, } ); - $error ||= $cust_pkg->check; + #$error ||= $cust_pkg->check; #$cust_svc = new FS::cust_svc ( { 'svcpart' => $svcpart } ); @@ -108,7 +113,7 @@ if ( $new->custnum eq '' ) { $svc_acct->_password($cgi->param('_password')); $svc_acct->popnum($cgi->param('popnum')); - $error ||= $svc_acct->check; + #$error ||= $svc_acct->check; } elsif ( $cgi->param('username') ) { #good thing to catch $error = "Can't assign username without a package!"; @@ -121,6 +126,11 @@ if ( $new->custnum eq '' ) { } else { #create old record object my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); $error ||= "Old record not found!" unless $old; + if ( defined dbdef->table('cust_main')->column('paycvv') + && length($old->paycvv) + && $new->paycvv =~ /^\s*\*+\s*$/ ) { + $new->paycvv($old->paycvv); + } $error ||= $new->replace($old, \@invoicing_list); }