From: jeff Date: Wed, 4 Oct 2006 21:22:08 +0000 (+0000) Subject: DoB X-Git-Tag: TRIXBOX_2_6~940 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=3050434f62122e73d748dac26a5e70193b444c0a DoB --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 384ff5215..7f77e000f 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -413,6 +413,13 @@ httemplate/docs/config.html }, { + 'key' => 'date_format', + 'section' => 'UI', + 'description' => 'format code for displaying dates with Date::Format::time2str', + 'type' => 'text', + }, + + { 'key' => 'cyrus', 'section' => 'deprecated', 'description' => 'DEPRECATED, add a cyrus export instead. This option used to integrate with Cyrus IMAP Server, three lines: IMAP server, admin username, and admin password. Cyrus::IMAP::Admin should be installed locally and the connection to the server secured.', diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 114b1d6ab..bd5dd27df 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -83,6 +83,8 @@ FS::Record - Database record objects $error = $record->ut_float('column'); $error = $record->ut_number('column'); $error = $record->ut_numbern('column'); + $error = $record->ut_snumber('column'); + $error = $record->ut_snumbern('column'); $error = $record->ut_money('column'); $error = $record->ut_text('column'); $error = $record->ut_textn('column'); @@ -1288,6 +1290,25 @@ sub ut_snumber { ''; } +=item ut_snumbern COLUMN + +Check/untaint signed numeric data (whole numbers). If there is an error, +returns the error, otherwise returns false. + +=cut + +sub ut_snumbern { + my($self, $field) = @_; + $self->getfield($field) =~ /^(-?)\s*(\d*)$/ + or return "Illegal (numeric) $field: ". $self->getfield($field); + if ($1) { + return "Illegal (numeric) $field: ". $self->getfield($field) + unless $2; + } + $self->setfield($field, "$1$2"); + ''; +} + =item ut_number COLUMN Check/untaint simple numeric data (whole numbers). May not be null. If there diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 3d4fcc5b4..ea02dfebf 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -407,6 +407,7 @@ sub tables_hashref { # 'middle', 'varchar', 'NULL', $char_d, '', '', 'first', 'varchar', '', $char_d, '', '', 'ss', 'varchar', 'NULL', 11, '', '', + 'birthdate',@date_type, '', '', 'company', 'varchar', 'NULL', $char_d, '', '', 'address1', 'varchar', '', $char_d, '', '', 'address2', 'varchar', 'NULL', $char_d, '', '', diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 484138781..cb44ba6e1 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1209,6 +1209,7 @@ sub check { || $self->ut_number('refnum') || $self->ut_name('last') || $self->ut_name('first') + || $self->ut_snumbern('birthdate') || $self->ut_textn('company') || $self->ut_text('address1') || $self->ut_textn('address2') @@ -4619,6 +4620,8 @@ No multiple currency support (probably a larger project than just this module). payinfo_masked false laziness with cust_pay.pm and cust_refund.pm +Birthdates rely on negative epoch values. + =head1 SEE ALSO L, L, L, L diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 99f849fc8..e0dd3c8ea 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -162,6 +162,19 @@ + + +
+<% ntable("#cccccc", 2) %> +<% include ('/elements/tr-input-date-field.html', + 'birthdate', + $cust_main->birthdate, + 'Date of Birth', + $conf->config('date_format') || "%m/%d/%Y") +%> + + +

@@ -247,6 +260,8 @@ Service address function bottomfixup(what) { var topvars = new Array( + 'birthdate', + 'custnum', 'agentnum', 'refnum', 'referral_custnum', 'last', 'first', 'ss', 'company', @@ -329,6 +344,8 @@ function copyelement(from, to) {
% foreach my $hidden ( +% 'birthdate', +% % 'custnum', 'agentnum', 'refnum', 'referral_custnum', % 'last', 'first', 'ss', 'company', % 'address1', 'address2', 'city', diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html new file mode 100644 index 000000000..eb8eee450 --- /dev/null +++ b/httemplate/elements/tr-input-date-field.html @@ -0,0 +1,32 @@ + + + + + + + + <% $label %> + + + + + + + + + +<%init> +my($name, $value, $label, $format) = @_; + +$format = "%m/%d/%Y" unless $format; +$label = $name unless $label; + + + diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index fc033b970..b0fab0300 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -1,6 +1,7 @@ % % my( $cust_main ) = @_; % my $conf = new FS::Conf; +% my $date_format = ($conf->config('date_format') || "%m/%d/%Y"); % @@ -90,5 +91,10 @@ <% $cust_main->otaker %> + + Date of Birth + <% $cust_main->birthdate ? time2str($date_format, $cust_main->birthdate) : '' %> + +