From f3717767d19f9da888e190f87a04dfa245d658b4 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 27 Jul 2009 03:26:47 +0000 Subject: FCC from 477 improvements #4912 --- httemplate/edit/cust_main.cgi | 9 ++++ httemplate/edit/cust_main/bottomfixup.js | 48 +++++++++++++--------- httemplate/edit/cust_main/contact.html | 4 ++ httemplate/elements/location.html | 10 ++++- httemplate/misc/xmlhttp-cust_main-censustract.html | 2 + httemplate/search/cust_pkg.cgi | 6 ++- httemplate/view/cust_main/misc.html | 9 ++++ 7 files changed, 66 insertions(+), 22 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 575131424..8b1d2b59c 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -32,6 +32,15 @@ <% include('cust_main/birthdate.html', $cust_main) %> % } +%# latitude and longitude +% if ( $conf->exists('cust_main-require_censustract') ) { +% my ($latitude, $longitude) = $cust_main->service_coordinates; +% $latitude ||= $conf->config('company_latitude') || ''; +% $longitude ||= $conf->config('company_longitude') || ''; + + +% } + %# contact info % my $same_checked = ''; diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 822f98d39..06e8b13b6 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -242,7 +242,7 @@ function post_geocode() { var cf = document.CustomerForm; var state_el = cf.elements['ship_state']; var census_data = new Array( - 'year', '2008', // from config value? + 'year', <% $conf->config('census_year') || '2008' %>, 'address', cf.elements['ship_address1'].value, 'city', cf.elements['ship_city'].value, 'state', state_el.options[ state_el.selectedIndex ].value, @@ -296,44 +296,52 @@ function update_censustract(arg) { var tractcode = argsHash['tractcode']; var error = argsHash['error']; + var newcensus = + new String(statecode) + + new String(countycode) + + new String(tractcode).replace(/\s$/, ''); // JSON 1 workaround + set_censustract = function () { - cf.elements['censustract'].value = - document.forms.popupcensustract.elements.censustract.value; + cf.elements['censustract'].value = newcensus cf.submit(); } - if (error) { + if (error || cf.elements['censustract'].value != newcensus) { // popup an entry dialog var choose_censustract = - '

Enter census tract

' + - '
' + + '

Confirm censustract
' + + 'Map service module location

' + ''; choose_censustract = choose_censustract + - '' + - '' + - '' + - ''; - - choose_censustract = choose_censustract + + '' + + '' + + '' + + ''; + + choose_censustract = choose_censustract + '' + + '' + - '
Census Tract:
  
Entered census tractCalculated census tract
' + cf.elements['censustract'].value + + '' + newcensus + '
  
' + - '' + + '' + '' + + '' + + '
' + '
'; + + '
'; - overlib( choose_censustract, CAPTION, 'Choose a census tract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + overlib( choose_censustract, CAPTION, 'Confirm censustract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); - setTimeout("document.forms.popupcensustract.elements.censustract.focus()",1); } else { - cf.elements['censustract'].value = - new String(statecode) + - new String(countycode) + - new String(tractcode); cf.submit(); } diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index 2691da652..3bed54b85 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -111,6 +111,10 @@ $cust_main->set($pre.'state', $statedefault ) $cust_main->set('stateid_state', $cust_main->state ) unless $pre || $cust_main->get('stateid_state'); +if ( $conf->exists('cust_main-require_censustract') ) { + $opt{censustract} ||= $cust_main->censustract; +} + #my($county_html, $state_html, $country_html) = # FS::cust_main_county::regionselector( $cust_main->get($pre.'county'), # $cust_main->get($pre.'state'), diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index 1bdbf9604..07aaa69f0 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -87,7 +87,15 @@ Example: % if ( !$pre ) { % } else { - +% if ( $pre eq 'ship_' && $conf->exists('cust_main-require_censustract') ) { + Census tract
(automatic) + + + + +% } else { + +% } % } <%init> diff --git a/httemplate/misc/xmlhttp-cust_main-censustract.html b/httemplate/misc/xmlhttp-cust_main-censustract.html index 05636d3fb..9d588d712 100644 --- a/httemplate/misc/xmlhttp-cust_main-censustract.html +++ b/httemplate/misc/xmlhttp-cust_main-censustract.html @@ -86,6 +86,8 @@ if ( $sub eq 'censustract' ) { } $error = "No census tract found" unless $return->{tractcode}; + $return->{tractcode} .= ' ' + unless $error || $JSON::VERSION >= 2; #broken JSON 1 workaround } #unless ($res->code eq '200') diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index a2ea3c582..f6a3620d3 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -162,10 +162,14 @@ my $money_char = $conf->config('money_char') || '$'; $search_hash{'query'} = $cgi->keywords; - for ( qw(agentnum magic status classnum pkgpart custom censustract) ) { + for ( qw(agentnum magic status classnum pkgpart custom ) ) { $search_hash{$_} = $cgi->param($_) if $cgi->param($_); } + for my $param ( qw(censustract) ) { + $search_hash{$param} = $cgi->param($param) || '' + if ( grep { /$param/ } $cgi->param ); + } my @report_option = $cgi->param('report_option') if $cgi->param('report_option'); diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 91b304b5d..71e8d6973 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -98,6 +98,15 @@ % } +% if ( $conf->exists('cust_main-require_censustract') ) { + + + Census tract + <% $cust_main->censustract %> + + +% } + <%init> -- cgit v1.2.1