[freeside-commits] freeside/httemplate/edit/process cust_main.cgi, 1.28, 1.29

Jeff Finucane,420,, jeff at wavetail.420.am
Thu Dec 14 21:29:50 PST 2006


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv18104/httemplate/edit/process

Modified Files:
	cust_main.cgi 
Log Message:
move use statements to handler.pl, do not show 1/1/70 for new birthdates, and improve error handling

Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/cust_main.cgi,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- cust_main.cgi	15 Dec 2006 00:56:11 -0000	1.28
+++ cust_main.cgi	15 Dec 2006 05:29:48 -0000	1.29
@@ -56,13 +56,21 @@
 %  );
 %}
 %
-%if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/ ) {
+%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',
 %                                              );
-%  $new->setfield('birthdate', $parser->parse_datetime($1)->epoch);
+%  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') )



More information about the freeside-commits mailing list