X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Flocations.html;h=0a2e5ec2c72c351e9dd7f374ccba3013418f9b03;hb=58cdf1b78c0cd419eacf7db8661564af050e0f12;hp=319a9274784673af36360ebe5ac31907d56c7774;hpb=f424f11eb366fe64f5f7bb42b21745e22537cab1;p=freeside.git
diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html
index 319a92747..0a2e5ec2c 100755
--- a/httemplate/view/cust_main/locations.html
+++ b/httemplate/view/cust_main/locations.html
@@ -1,40 +1,66 @@
% foreach my $locationnum (@sorted) {
% my $packages = $packages_in{$locationnum};
% my $loc = $locations{$locationnum};
% next if $loc->disabled and scalar(@$packages) == 0;
-<% include('/elements/table-grid.html') %>
-
-
-% if (! $locationnum) {
-Default service location:
-% }
-% elsif ( $loc->disabled ) {
-
+
+
+
+
+<% $loc->location_label %>
+% if ( $loc->country eq 'US' ) { # only U.S. census tracts for now
+% if ( $loc->censustract ) {
+
+
+ <% $loc->censustract %> (<% $loc->censusyear %> census)
+
+% } elsif ( $conf->exists('cust_main-require_censustract') ) {
+
+
+ <% emt('Census tract unknown') %>
+
+% }
% }
-<% $loc->location_label %>
-
-% if ( $locationnum and !$loc->disabled ) {
+
+
+% if ( $locationnum && !$loc->disabled && ! $opt{no_links} ) {
<% edit_location_link($locationnum) %>
% }
-% if ( !$loc->disabled and !$active{$locationnum} ) {
+% if ( $locationnum && !$loc->disabled && !$active{$locationnum} && ! $opt{no_links} ) {
<% disable_location_link($locationnum) %>
% }
- |
+
% if (@$packages) {
-<% include('packages/section.html', 'packages' => $packages ) %>
+% my %sopt = %opt;
+% $sopt{'packages'} = $packages;
+ <& packages/section.html, %sopt &>
% }
% } #foreach $locationnum
@@ -42,6 +68,7 @@ Default service location:
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',
@@ -49,8 +76,7 @@ my %locations = map { $_->locationnum => $_ } qsearch({
'order_by' => 'ORDER BY country, state, city, address1, locationnum',
});
my @sections = keys %locations;
-$locations{''} = $cust_main;
-my %packages_in = map { $_ => [] } @sections;
+my %packages_in = map { $_ => [] } (@sections);
my %active = (); # groups with non-canceled packages
foreach my $cust_pkg ( @$all_packages ) {
@@ -58,10 +84,13 @@ foreach my $cust_pkg ( @$all_packages ) {
push @{ $packages_in{$key} }, $cust_pkg;
$active{$key} = 1 if !$cust_pkg->getfield('cancel');
}
+# prevent disabling these
+$active{$cust_main->ship_locationnum} = 1;
+$active{$cust_main->bill_locationnum} = 1;
my @sorted = (
- '',
- grep ( { $active{$_} } @sections),
+ $cust_main->ship_locationnum,
+ grep ( { $active{$_} && $_ != $cust_main->ship_locationnum } @sections),
grep ( { !$active{$_} } @sections),
);
@@ -69,8 +98,8 @@ sub edit_location_link {
my $locationnum = shift;
include( '/elements/popup_link.html',
'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum",
- 'label' => '(Edit location)',
- 'actionlabel' => 'Edit',
+ 'label' => '('.emt('Edit location').')',
+ 'actionlabel' => emt('Edit'),
);
}
@@ -78,10 +107,9 @@ sub disable_location_link {
my $locationnum = shift;
include( '/elements/popup_link.html',
'action' => $p. "misc/disable-cust_location.cgi?locationnum=$locationnum",
- 'label' => '(Disable location)',
- 'actionlabel' => 'Disable',
+ 'label' => '('.emt('Disable location').')',
+ 'actionlabel' => emt('Disable'),
);
}
-
%init>
|
---|