summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_main.cgi
diff options
context:
space:
mode:
authorjeff <jeff>2006-12-15 05:29:48 +0000
committerjeff <jeff>2006-12-15 05:29:48 +0000
commit02b9c53fb85b0a87d959e140dc30ae21cccb0902 (patch)
tree56d1edfd2ee7a2f92fe830b8e55a6db84d214b0f /httemplate/edit/process/cust_main.cgi
parentba1f19e48ec2f2ac293b07a41042de59e744db1e (diff)
move use statements to handler.pl, do not show 1/1/70 for new birthdates, and improve error handling
Diffstat (limited to 'httemplate/edit/process/cust_main.cgi')
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi12
1 files changed, 10 insertions, 2 deletions
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 752bc9502..38821c36a 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -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') )