summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorjeff <jeff>2009-07-27 03:26:47 +0000
committerjeff <jeff>2009-07-27 03:26:47 +0000
commitf3717767d19f9da888e190f87a04dfa245d658b4 (patch)
tree198b6454ec80efd88096d5574feb5c83bf827a20 /httemplate
parent6a8c7c021a01b85ce172a230757b000fe2959a31 (diff)
FCC from 477 improvements #4912
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/cust_main.cgi9
-rw-r--r--httemplate/edit/cust_main/bottomfixup.js48
-rw-r--r--httemplate/edit/cust_main/contact.html4
-rw-r--r--httemplate/elements/location.html10
-rw-r--r--httemplate/misc/xmlhttp-cust_main-censustract.html2
-rwxr-xr-xhttemplate/search/cust_pkg.cgi6
-rw-r--r--httemplate/view/cust_main/misc.html9
7 files changed, 66 insertions, 22 deletions
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') || '';
+ <INPUT NAME="latitude" TYPE="hidden" VALUE="<% $latitude |h %>">
+ <INPUT NAME="longitude" TYPE="hidden" VALUE="<% $longitude |h %>">
+% }
+
%# 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 =
- '<CENTER><BR><B>Enter census tract</B><BR><BR>' +
- '<FORM name="popupcensustract">' +
+ '<CENTER><BR><B>Confirm censustract</B><BR>' +
+ '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
+ 'census_year=<% $conf->config('census_year') || '2008' %>' +
+ '&latitude=' + cf.elements['latitude'].value +
+ '&longitude=' + cf.elements['longitude'].value +
+ '" target="_blank">Map service module location</A><BR><BR>' +
'<TABLE>';
choose_censustract = choose_censustract +
- '<TR><TH>Census Tract: </TH>' +
- '<TD><INPUT NAME="censustract" ID="censustract"></TD>' +
- '</TR><TR>' +
- '<TD>&nbsp;</TD><TD>&nbsp;</TD></TR>';
-
- choose_censustract = choose_censustract +
+ '<TR><TH>Entered census tract</TH>' +
+ '<TH>Calculated census tract</TH></TR>' +
+ '<TR><TD>' + cf.elements['censustract'].value +
+ '</TD><TD>' + newcensus + '</TD></TR>' +
+ '<TR><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>';
+
+ choose_censustract = choose_censustract +
'<TR><TD>' +
- '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT="">Submit census tract</BUTTON>' +
+ '<BUTTON TYPE="button" onClick="document.CustomerForm.submit();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract </BUTTON>' +
'</TD><TD>' +
+ '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract </BUTTON>' +
+ '</TD></TR>' +
+ '<TR><TD COLSPAN=2 ALIGN="center">' +
'<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' +
- '</TABLE></FORM></CENTER>';
+
+ '</TABLE></CENTER>';
- 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 ) {
<INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>">
% } else {
- <INPUT TYPE="hidden" NAME="censustract" VALUE="<% $opt{censustract} %>">
+% if ( $pre eq 'ship_' && $conf->exists('cust_main-require_censustract') ) {
+ <TR><TH ALIGN="right">Census tract<BR>(automatic)</TH>
+ <TD>
+ <INPUT TYPE="text" NAME="censustract" VALUE="<% $opt{censustract} %>">
+ </TD>
+ </TR>
+% } else {
+ <INPUT TYPE="hidden" NAME="censustract" VALUE="<% $opt{censustract} %>">
+% }
% }
<%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') ) {
+
+ <TR>
+ <TD ALIGN="right">Census tract</TD>
+ <TD BGCOLOR="#ffffff"><% $cust_main->censustract %></TD>
+ </TR>
+
+% }
+
</TABLE></TD></TR></TABLE>
<%init>