show census tracts for all customer and package locations, #25726
[freeside.git] / httemplate / elements / tr-censustract.html
diff --git a/httemplate/elements/tr-censustract.html b/httemplate/elements/tr-censustract.html
new file mode 100644 (file)
index 0000000..bd014f1
--- /dev/null
@@ -0,0 +1,23 @@
+% if ($censustract) {
+<TR>
+  <TD ALIGN="right"><% mt('Census tract') |h %></TD>
+  <TD COLSPAN=5>
+    <SPAN STYLE="background-color: #ffffff; border: 1px solid #ffffff"><% $censustract |h %></SPAN>
+    &nbsp;<% $censusyear |h %>
+  </TD>
+</TR>
+% }
+<%init>
+
+my $location = shift;
+my $conf = FS::Conf->new;
+my ($censustract, $censusyear);
+if ($location->censustract) {
+  $censustract = $location->censustract;
+  $censusyear = '('. ($location->censusyear || mt('unknown year')) . ')';
+} elsif ($conf->exists('cust_main-require_censustract')) {
+  $censustract = mt('unknown');
+  $censusyear = '';
+}
+
+</%init>