add latitude/longitude to prospects, customers and package locations, RT#15539
[freeside.git] / httemplate / view / cust_main / packages / section.html
1 % if ( @$packages ) { 
2 %   my $bgcolor1 = '#eeeeee';
3 %   my $bgcolor2 = '#ffffff';
4 %   my $bgcolor = '';
5
6 <TR>
7 % #my $width = $show_location ? 'WIDTH="25%"' : 'WIDTH="33%"';
8   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Package') |h %></TH>
9   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
10 %   if ( $show_location ) {
11   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Location') |h %></TH>
12 % }
13   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Services') |h %></TH>
14 </TR>
15
16 % #$FS::cust_pkg::DEBUG = 2;
17 %   foreach my $cust_pkg (@$packages) {
18 %
19 %     if ( $bgcolor eq $bgcolor1 ) {
20 %       $bgcolor = $bgcolor2;
21 %     } else {
22 %       $bgcolor = $bgcolor1;
23 %     }
24 %
25 %     my %iopt = (
26 %       'bgcolor'   => $bgcolor,
27 %       'cust_pkg'  => $cust_pkg,
28 %       'part_pkg'  => $cust_pkg->part_pkg,
29 %       'cust_main' => $opt{'cust_main'},
30 %       %conf_opt,
31 %     );
32 %
33
34   <!--pkgnum: <% $cust_pkg->pkgnum %>-->
35   <TR>
36     <& package.html, %iopt &>
37     <& status.html, %iopt &>
38 %     if ( $show_location ) {
39     <& location.html, %iopt &>
40 %     }
41     <& services.html, %iopt &>
42   </TR>
43
44 %   } #foreach $cust_pkg
45 %# </TABLE>
46 % } #if @$packages
47 % else {
48 <BR>
49 % }
50
51 <%init>
52
53 my %opt = @_;
54 my $conf = new FS::Conf;
55
56 my $curuser = $FS::CurrentUser::CurrentUser;
57
58 my $packages = $opt{'packages'};
59 my $show_location = $opt{'show_location'};
60
61 # Sort order is hardcoded for now, can change this if needed.
62 @$packages = sort { 
63   ( $a->getfield('cancel') <=> $b->getfield('cancel') )  or
64   ( $a->getfield('setup')  <=> $b->getfield('setup')  )  or
65   ( $a->getfield('pkgnum') <=> $b->getfield('pkgnum') )
66 } @$packages;
67
68 my $countrydefault = scalar($conf->config('countrydefault')) || 'US';  
69
70 my %conf_opt = (
71   #for services.html and status.html
72   'cust_pkg-display_times'    => ($conf->exists('cust_pkg-display_times')
73                                  || $curuser->option('cust_pkg-display_times')),
74   #for status.html
75   'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
76   #for status.html pkg-balances
77   'pkg-balances'              => $conf->exists('pkg-balances'),
78   'money_char'                => ( $conf->config('money_char') || '$' ),
79
80   #for location.html
81   'countrydefault'            => $countrydefault,
82   'statedefault'              => ( scalar($conf->config('statedefault'))
83                                   || ($countrydefault eq 'US' ? 'CA' : '') ),
84   #for services.html
85   'svc_external-skip_manual'  => $conf->exists('svc_external-skip_manual'),
86   'legacy_link'               => $conf->exists('legacy_link'),
87   'manage_link'               => scalar($conf->config('svc_broadband-manage_link')),
88   'manage_link_text'          => scalar($conf->config('svc_broadband-manage_link_text')),
89   'manage_link_loc'           => scalar($conf->config('svc_broadband-manage_link_loc')),
90   'manage_link-new_window'    => $conf->exists('svc_broadband-manage_link-new_window'),
91   'maestro-status_test'       => $conf->exists('maestro-status_test'),
92   'cust_pkg-large_pkg_size'   => $conf->config('cust_pkg-large_pkg_size'),
93
94   # for packages.html Change location link
95   'show_location'             => $show_location,
96 );
97
98 </%init>