move use statements to handler.pl, do not show 1/1/70 for new birthdates, and improve...
[freeside.git] / httemplate / edit / process / cust_main.cgi
index 1aaed28..38821c3 100755 (executable)
@@ -46,6 +46,9 @@
 %  } fields('cust_main')
 %} );
 %
+% delete( $new->hashref->{'agent_custid'} )
+%   unless $new->hashref->{'agent_custid'};
+%
 %if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) {
 %  $new->setfield("ship_$_", '') foreach qw(
 %    last first company address1 address2 city county state zip
 %  );
 %}
 %
+%if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/) {
+%  my $conf = new FS::Conf;
+%  my $format = $conf->config('date_format') || "%m/%d/%Y";
+%  my $parser = DateTime::Format::Strptime->new(pattern => $format,
+%                                               time_zone => 'floating',
+%                                              );
+%  my $dt =  $parser->parse_datetime($1);
+%  if ($dt) {
+%    $new->setfield('birthdate', $dt->epoch);
+%    $cgi->param('birthdate', $dt->epoch);
+%  } else {
+%#    $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg;
+%    $error ||= "Invalid birthdate: " . $cgi->param('birthdate') . ".";
+%    $cgi->param('birthdate', '');
+%  }
+%}
+%
 %$new->setfield('paid', $cgi->param('paid') )
 %  if $cgi->param('paid');
 %
 %       && $new->paycvv =~ /^\s*\*+\s*$/ ) {
 %    $new->paycvv($old->paycvv);
 %  }
+%  if ($new->payby =~ /CARD|DCRD|CHEK|DCHK/ && $new->payinfo =~ /xx/) {
+%    $new->payinfo($old->payinfo);
+%  }
 %  $error ||= $new->replace($old, \@invoicing_list);
 %  
 %}