diff options
author | Mark Wells <mark@freeside.biz> | 2013-11-07 20:05:34 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-11-07 20:05:34 -0800 |
commit | b286638fd4cb875178b0247a04b2706a44cadf6f (patch) | |
tree | 6edaaed93029e95827e51670234010eb2741cf75 | |
parent | a180208786cccb72ab017e39fff0cb128aa6ba01 (diff) |
show census tracts for all customer and package locations, #25726
-rw-r--r-- | httemplate/elements/tr-censustract.html | 23 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust_location.html | 9 | ||||
-rw-r--r-- | httemplate/view/cust_main/contacts.html | 1 | ||||
-rwxr-xr-x | httemplate/view/cust_main/locations.html | 49 | ||||
-rw-r--r-- | httemplate/view/cust_main/misc.html | 11 | ||||
-rw-r--r-- | httemplate/view/cust_main/packages/location.html | 72 |
6 files changed, 112 insertions, 53 deletions
diff --git a/httemplate/elements/tr-censustract.html b/httemplate/elements/tr-censustract.html new file mode 100644 index 000000000..bd014f11b --- /dev/null +++ b/httemplate/elements/tr-censustract.html @@ -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> + <% $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> diff --git a/httemplate/elements/tr-select-cust_location.html b/httemplate/elements/tr-select-cust_location.html index e1fa825c1..4ed9cd48e 100644 --- a/httemplate/elements/tr-select-cust_location.html +++ b/httemplate/elements/tr-select-cust_location.html @@ -31,6 +31,9 @@ Example: else what.form.<%$_%>.value = ''; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#dddddd'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = true; + } } function location_clear(what) { @@ -38,6 +41,9 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype == 'INPUT' ) what.form.<%$_%>.value = ''; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.value = ''; + } % if ( $opt{'alt_format'} ) { changeSelect(what.form.location_kind, ''); changeSelect(what.form.location_type, ''); @@ -51,6 +57,9 @@ Example: var ftype = what.form.<%$_%>.tagName; if( ftype != 'SELECT') what.form.<%$_%>.style.backgroundColor = '#ffffff'; % } + if(what.form.enter_censustract) { + what.form.enter_censustract.disabled = false; + } % if ( $opt{'alt_format'} ) { if ( what.form.location_type && what.form.location_type.options[what.form.location_type.selectedIndex].value ) { diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index d65af669a..8fe3a9ebb 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -84,6 +84,7 @@ $cust_main->agentnum, &> % } +<& /elements/tr-censustract.html, $location &> % if ( $this eq 'bill' ) { % # billing contact phone numbers diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html index 7eb52ca46..fdbbc396b 100755 --- a/httemplate/view/cust_main/locations.html +++ b/httemplate/view/cust_main/locations.html @@ -1,40 +1,60 @@ <STYLE> -span.loclabel { +div.loclabel { + display: inline-block; padding-left: 4px; padding-right: 4px; background-color: #cccccc; - border: 1px solid black + border: 1px solid black; + border-bottom: 0px; + border-radius: 4px 4px 0 0; +} +div.disabled { + font-style: italic; + color: #808080; } table.location { width: 100%; padding: 1px; border-spacing: 0px; } +.location-head th { + padding-bottom: 0px; + padding-left: 0px; + border-bottom: 1px solid black; + vertical-align: bottom; + text-align: left; + width: 100%; +} </STYLE> % foreach my $locationnum (@sorted) { % my $packages = $packages_in{$locationnum}; % my $loc = $locations{$locationnum}; % next if $loc->disabled and scalar(@$packages) == 0; <TABLE CLASS="grid location"> -<TR><TH COLSPAN=3 ALIGN="left" VALIGN="bottom" -STYLE="padding-bottom: 0px; - padding-left: 0px; - border-bottom-style: solid; - border-bottom-color: black; - border-bottom-width: 1px;"> -<SPAN CLASS="loclabel"> -% if ( $loc->disabled ) { -<FONT COLOR="#808080"><I> +<TR CLASS="location-head"> +<TH COLSPAN=5> +<DIV CLASS="<% $loc->disabled ? 'loclabel disabled' : 'loclabel' %>"> +<% $loc->location_label %> +% if ( $loc->censustract ) { + <BR> + <FONT SIZE=-1> + <% $loc->censustract %> (<% $loc->censusyear %> census) + </FONT> +% } elsif ( $conf->exists('cust_main-require_censustract') ) { + <BR> + <FONT SIZE=-1 COLOR="#ee3300"> + <% emt('Census tract unknown') %> + </FONT> % } -<% $loc->location_label %></SPAN> -<SPAN STYLE="float:right;"> +</DIV> +<DIV STYLE="display: inline; float:right;"> % if ( $locationnum && !$loc->disabled && ! $opt{no_links} ) { <% edit_location_link($locationnum) %> % } % if ( $locationnum && !$loc->disabled && !$active{$locationnum} && ! $opt{no_links} ) { <% disable_location_link($locationnum) %> % } -</SPAN></TH></TR> +</DIV></TH></TR> % if (@$packages) { <& packages/section.html, 'packages' => $packages, @@ -48,6 +68,7 @@ STYLE="padding-bottom: 0px; my %opt = @_; my $cust_main = $opt{'cust_main'}; my $all_packages = $opt{'packages'}; +my $conf = FS::Conf->new; my %locations = map { $_->locationnum => $_ } qsearch({ 'table' => 'cust_location', diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index 5311aa5ae..7915195b4 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -171,17 +171,6 @@ % } -% if ( $conf->exists('cust_main-require_censustract') ) { - - <TR> - <TD ALIGN="right"> - <% mt('Census tract ([_1])', $cust_main->ship_location->censusyear) |h %> - </TD> - <TD BGCOLOR="#ffffff"><% $cust_main->ship_location->censustract %></TD> - </TR> - -% } - % if ( $cust_main->district ) { <TR> diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html index 5ff2b1e1f..db67d45b9 100644 --- a/httemplate/view/cust_main/packages/location.html +++ b/httemplate/view/cust_main/packages/location.html @@ -1,35 +1,49 @@ % if ( $cust_pkg->change_from_pkg -% and $cust_pkg->change_from_pkg->locationnum == $cust_pkg->locationnum ) +% and $cust_pkg->change_from_pkg->locationnum == $cust_pkg->locationnum) % { % # don't show the location % } else { -% if ( $default ) { - <DIV STYLE="font-style: italic; font-size: small"> -% } +% if ( !$conf->exists('cust_pkg-group_by_location') ) { +% if ( $default ) { + <DIV STYLE="font-style: italic; font-size: small"> +% } - <% $loc->location_label( 'join_string' => '<BR>', - 'double_space' => ' ', - 'escape_function' => \&encode_entities, - 'countrydefault' => $countrydefault, - ) - %> + <% $loc->location_label( 'join_string' => '<BR>', + 'double_space' => ' ', + 'escape_function' => \&encode_entities, + 'countrydefault' => $countrydefault, + ) + %> -% if ( $loc->latitude && $loc->longitude ) { - <BR> - <FONT SIZE=-1> - <% $loc->latitude %>, <% $loc->longitude %> - <& /elements/coord-links.html, - $loc->latitude, - $loc->longitude, - $opt{'cust_main'}->name_short. ': '. $opt{'part_pkg'}->pkg, - $opt{'cust_main'}->agentnum, - &> - </FONT> -% } +% if ( $loc->latitude && $loc->longitude ) { + <BR> + <FONT SIZE=-1> + <% $loc->latitude %>, <% $loc->longitude %> + <& /elements/coord-links.html, + $loc->latitude, + $loc->longitude, + $opt{'cust_main'}->name_short. ': '. $opt{'part_pkg'}->pkg, + $opt{'cust_main'}->agentnum, + &> + </FONT> +% } +% if ( $loc->censustract ) { + <BR> + <FONT SIZE=-1> + <% $loc->censustract %> (<% $loc->censusyear %> census) + </FONT> +% } elsif ( $conf->exists('cust_main-require_censustract') ) { + <BR> + <FONT SIZE=-1 COLOR="#ee3300"> + <% emt('Census tract unknown') %> + </FONT> +% } -% if ( $default ) { - </DIV> -% } +% if ( $default ) { + </DIV> +% } +% } # all of this is hidden if packages are grouped by location, because +% # it's in the top banner % if ( ! $cust_pkg->get('cancel') % && $FS::CurrentUser::CurrentUser->access_right('Change customer package') @@ -41,11 +55,13 @@ ( <%pkg_change_location_link($cust_pkg)%> ) % } % if ( $cust_pkg->locationnum && ! $opt{no_links} ) { - ( <%edit_location_link($cust_pkg->locationnum)%> ) + ( <%pkg_edit_location_link($cust_pkg->locationnum)%> ) % } </FONT> % } -% } +% } # if the package is a scheduled future package change without location +% # change, then don't show any of this at all. It's all implied by the +% # preceding package. <%init> my $conf = new FS::Conf; @@ -75,7 +91,7 @@ sub pkg_change_location_link { ); } -sub edit_location_link { +sub pkg_edit_location_link { my $locationnum = shift; include( '/elements/popup_link.html', 'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum", |