5 background-color: #cccccc;
6 border: 1px solid black
9 % foreach my $locationnum (@sorted) {
10 % my $packages = $packages_in{$locationnum};
11 % my $loc = $locations{$locationnum};
12 % next if $loc->disabled and scalar(@$packages) == 0;
13 <% include('/elements/table-grid.html') %>
14 <TR><TH COLSPAN=3 ALIGN="left" VALIGN="bottom"
15 STYLE="padding-bottom: 0px;
17 border-bottom-style: solid;
18 border-bottom-color: black;
19 border-bottom-width: 1px;">
20 <SPAN CLASS="loclabel">
21 % if (! $locationnum) {
22 Default service location:
24 % elsif ( $loc->disabled ) {
25 <FONT COLOR="#808080"><I>
27 <% $loc->location_label %></SPAN>
28 <SPAN STYLE="float:right;">
29 % if ( $locationnum and !$loc->disabled ) {
30 <% edit_location_link($locationnum) %>
32 % if ( $locationnum and !$loc->disabled and !$active{$locationnum} ) {
33 <% disable_location_link($locationnum) %>
37 <% include('packages/section.html', 'packages' => $packages ) %>
40 % } #foreach $locationnum
43 my $cust_main = $opt{'cust_main'};
44 my $all_packages = $opt{'packages'};
46 my %locations = map { $_->locationnum => $_ } qsearch({
47 'table' => 'cust_location',
48 'hashref' => { 'custnum' => $cust_main->custnum },
49 'order_by' => 'ORDER BY country, state, city, address1, locationnum',
51 my @sections = keys %locations;
52 $locations{''} = $cust_main;
53 my %packages_in = map { $_ => [] } ('', @sections);
55 my %active = (); # groups with non-canceled packages
56 foreach my $cust_pkg ( @$all_packages ) {
57 my $key = $cust_pkg->locationnum;
58 push @{ $packages_in{$key} }, $cust_pkg;
59 $active{$key} = 1 if !$cust_pkg->getfield('cancel');
64 grep ( { $active{$_} } @sections),
65 grep ( { !$active{$_} } @sections),
68 sub edit_location_link {
69 my $locationnum = shift;
70 include( '/elements/popup_link.html',
71 'action' => $p. "edit/cust_location.cgi?locationnum=$locationnum",
72 'label' => '(Edit location)',
73 'actionlabel' => 'Edit',
77 sub disable_location_link {
78 my $locationnum = shift;
79 include( '/elements/popup_link.html',
80 'action' => $p. "misc/disable-cust_location.cgi?locationnum=$locationnum",
81 'label' => '(Disable location)',
82 'actionlabel' => 'Disable',