From 7bfd0175b05d52b648e283fca4343aef79e851d7 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 14 Mar 2014 16:59:38 -0700 Subject: [PATCH] add spouse name to customer records, #24919 --- FS/FS/Conf.pm | 4 +-- FS/FS/Schema.pm | 8 +++--- FS/FS/Upgrade.pm | 5 ++++ FS/FS/cust_main.pm | 2 ++ httemplate/edit/cust_main.cgi | 1 - httemplate/edit/cust_main/birthdate.html | 42 ++++++++++++++++---------------- httemplate/edit/cust_main/name.html | 33 +++++++++++++------------ httemplate/edit/cust_main/top_misc.html | 2 ++ httemplate/elements/freeside.css | 14 +++++++++++ httemplate/view/cust_main/contacts.html | 10 ++++++++ httemplate/view/cust_main/misc.html | 17 ++++++------- 11 files changed, 87 insertions(+), 51 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 34254c6d6..13d07041f 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3854,9 +3854,9 @@ and customer address. Include units.', }, { - 'key' => 'cust_main-enable_spouse_birthdate', + 'key' => 'cust_main-enable_spouse', 'section' => 'UI', - 'description' => 'Enable tracking of a spouse birth date with each customer record', + 'description' => 'Enable tracking of a spouse\'s name and date of birth with each customer record', 'type' => 'checkbox', }, diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index bf756d129..4f547725d 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -466,7 +466,7 @@ sub tables_hashref { my $char_d = 80; #default maxlength for text fields #my(@date_type) = ( 'timestamp', '', '' ); - my @date_type = ( 'int', 'NULL', '' ); + my @date_type = ( 'int', 'NULL', '' ); my @perl_type = ( 'text', 'NULL', '' ); my @money_type = ( 'decimal', '', '10,2' ); my @money_typen = ( 'decimal', 'NULL', '10,2' ); @@ -1521,8 +1521,10 @@ sub tables_hashref { 'stateid_state', 'varchar', 'NULL', $char_d, '', '', 'national_id', 'varchar', 'NULL', $char_d, '', '', 'birthdate' ,@date_type, '', '', - 'spouse_birthdate' ,@date_type, '', '', - 'anniversary_date' ,@date_type, '', '', + 'spouse_last', 'varchar', 'NULL', 2*$char_d, '', '', + 'spouse_first', 'varchar', 'NULL', $char_d, '', '', + 'spouse_birthdate', @date_type, '', '', + 'anniversary_date', @date_type, '', '', 'signupdate',@date_type, '', '', 'dundate', @date_type, '', '', 'company', 'varchar', 'NULL', $char_d, '', '', diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index a7fe99f90..bf3e2ad38 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -91,6 +91,11 @@ sub upgrade_config { && length($conf->config('usps_webtools-userid')) > 0 && ! $conf->exists('address_standardize_method'); + # this option has been renamed/expanded + if ( $conf->exists('cust_main-enable_spouse_birthdate') ) { + $conf->touch('cust_main-enable_spouse'); + $conf->delete('cust_main-enable_spouse_birthdate'); + } } sub upgrade_overlimit_groups { diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b37b0dafe..9f382ac4f 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1744,6 +1744,8 @@ sub check { || $self->ut_name('first') || $self->ut_snumbern('signupdate') || $self->ut_snumbern('birthdate') + || $self->ut_namen('spouse_last') + || $self->ut_namen('spouse_first') || $self->ut_snumbern('spouse_birthdate') || $self->ut_snumbern('anniversary_date') || $self->ut_textn('company') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 629c8081d..ddb61fa64 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -30,7 +30,6 @@ %# birthdate % if ( $conf->config('national_id-country') % || $conf->exists('cust_main-enable_birthdate') -% || $conf->exists('cust_main-enable_spouse_birthdate') % || $conf->exists('cust_main-enable_anniversary_date') % ) % { diff --git a/httemplate/edit/cust_main/birthdate.html b/httemplate/edit/cust_main/birthdate.html index e1adbd3bd..ecf591fb0 100644 --- a/httemplate/edit/cust_main/birthdate.html +++ b/httemplate/edit/cust_main/birthdate.html @@ -34,28 +34,28 @@ % } % if ( $conf->exists('cust_main-enable_birthdate') ) { - <% include( '/elements/tr-input-date-field.html', { - 'name' => 'birthdate', - 'value' => $cust_main->birthdate, - 'label' => 'Date of Birth', - 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), - 'usedatetime' => 1, - 'noinit' => $noinit++, - }) - %> -% } + <& /elements/tr-input-date-field.html, { + 'name' => 'birthdate', + 'value' => $cust_main->birthdate, + 'label' => 'Date of Birth', + 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), + 'usedatetime' => 1, + 'noinit' => $noinit++, + } + &> -% if ( $conf->exists('cust_main-enable_spouse_birthdate') ) { - <% include( '/elements/tr-input-date-field.html', { - 'name' => 'spouse_birthdate', - 'value' => $cust_main->spouse_birthdate, - 'label' => 'Spouse Date of Birth', - 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), - 'usedatetime' => 1, - 'noinit' => $noinit++, - }) - %> -% } +% if ( $conf->exists('cust_main-enable_spouse') ) { + <& /elements/tr-input-date-field.html, { + 'name' => 'spouse_birthdate', + 'value' => $cust_main->spouse_birthdate, + 'label' => 'Spouse Date of Birth', + 'format' => ( $conf->config('date_format') || "%m/%d/%Y" ), + 'usedatetime' => 1, + 'noinit' => $noinit++, + } + &> +% } # if enable_spouse +% } # if enable_birthdate % if ( $conf->exists('cust_main-enable_anniversary_date') ) { <% include( '/elements/tr-input-date-field.html', { diff --git a/httemplate/edit/cust_main/name.html b/httemplate/edit/cust_main/name.html index 2641ec930..fbb0a916e 100644 --- a/httemplate/edit/cust_main/name.html +++ b/httemplate/edit/cust_main/name.html @@ -1,36 +1,40 @@ <%def .namepart> % my ($field, $value, $label, $extra) = @_; - +
>
<% mt($label) %> - +
- <%$r%><% mt('Contact name') |h %> - - - - <& .namepart, 'last', $cust_main->last, 'Last' &> - + + +   <& .namepart, 'ss', $ss, 'SS#', "SIZE=11" &> % } else { % } - -
, <% mt('Contact name') |h %> + <& .namepart, 'last', $cust_main->last, 'Last', ',' &> <& .namepart, 'first', $cust_main->first, 'First' &> % if ( $conf->exists('show_ss') ) { -  
+% if ( $conf->exists('cust_main-enable_spouse') ) { + + <% mt('Spouse\'s name') |h %> + + <& .namepart, 'spouse_last', $cust_main->spouse_last, 'Last', ',' &> + <& .namepart, 'spouse_first', $cust_main->spouse_first, 'First' &> + + +% } % if ( $conf->exists('cust-email-high-visibility') ) { - + Email address(es) agentnum if $cust_main->custnum; my $conf = FS::Conf->new; -my $r = '* '; my $ss; if ( $cgi->param('error') or $conf->exists('unmask_ss') ) { diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html index e25506f52..f3fde53fa 100644 --- a/httemplate/edit/cust_main/top_misc.html +++ b/httemplate/edit/cust_main/top_misc.html @@ -27,11 +27,13 @@ if ( what.checked == (what.value == 'Commercial' ) ) { document.getElementById('company_row').style.display = ''; document.getElementById('contacts_div').style.display = ''; + document.getElementById('spouse_row').style.display = 'none'; } else { if ( document.getElementById('company').value.length == 0 ) { document.getElementById('company_row').style.display = 'none'; } document.getElementById('contacts_div').style.display = 'none'; + document.getElementById('spouse_row').style.display = ''; } } diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css index 3933e9d6e..4ba0f3f7d 100644 --- a/httemplate/elements/freeside.css +++ b/httemplate/elements/freeside.css @@ -282,3 +282,17 @@ table.inv { border: none } th.inv { border: none } td.inv { border: none } +td.label { + text-align: right; +} + +.required { + font-weight: bold; +} + +.required::before { + content: "* "; + color: #ff0000; +} + + diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 44445356c..739cd588b 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -27,6 +27,16 @@ : $cust_main->masked('ss') || ' ' %> % } +% if ( $conf->exists('cust_main-enable_spouse') and +% ($cust_main->spouse_last or $cust_main->spouse_first) ) { + + <% mt('Spouse') |h %> + + <% join(', ', grep $_, + $cust_main->spouse_last, $cust_main->spouse_first) %> + + +% } % if ( $conf->exists('cust-email-high-visibility') ) { <% mt('Email address(es)') |h %> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 7915195b4..0d011f6eb 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -141,21 +141,20 @@ <% $dt ? $dt->strftime($date_format) : '' %> -% } - -% if ( $conf->exists('cust_main-enable_spouse_birthdate') ) { -% my $dt = $cust_main->spouse_birthdate ne '' -% ? DateTime->from_epoch( 'epoch' => $cust_main->spouse_birthdate, -% 'time_zone' =>'floating', -% ) -% : ''; +% if ( $conf->exists('cust_main-enable_spouse') +% and $cust_main->spouse_birthdate ) { +% my $dt = DateTime->from_epoch( +% 'epoch' => $cust_main->spouse_birthdate, +% 'time_zone' =>'floating' +% ); <% mt('Spouse Date of Birth') |h %> <% $dt ? $dt->strftime($date_format) : '' %> -% } +% } +% } # enable_birthdate % if ( $conf->exists('cust_main-enable_anniversary_date') ) { % my $dt = $cust_main->anniversary_date ne '' -- 2.11.0