3 % #my $width = $show_location ? 'WIDTH="25%"' : 'WIDTH="33%"';
4 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Package') |h %></TH>
5 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
6 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Contact/Location') |h %></TH>
7 % if (!$opt{no_services}) {
8 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Services') |h %></TH>
12 % #$FS::cust_pkg::DEBUG = 2;
13 % foreach my $cust_pkg (@$packages) {
14 % # if requested, this can override cust_pkg-group_by_location
15 <& .packagerow, $cust_pkg,
17 ( map { $_ => $opt{$_} } qw(
18 cust_main bgcolor no_links cust_location_cache
19 before_pkg_callback before_svc_callback after_svc_callback
20 cust_pkg-group_by_location
25 % } else { # there are no packages
30 % my ($cust_pkg, %iopt) = @_;
31 % $iopt{'cust_pkg'} = $cust_pkg;
32 % $iopt{'part_pkg'} = $cust_pkg->part_pkg;
33 <!--pkgnum: <% $cust_pkg->pkgnum %>-->
34 <TR CLASS="row<%$row % 2%>">
35 <& package.html, %iopt &>
36 <& status.html, %iopt &>
37 <TD CLASS="inv" BGCOLOR="<% $iopt{bgcolor} %>" WIDTH="20%" VALIGN="top">
38 <& contact.html, %iopt &>
39 <& location.html, %iopt &>
41 % if (!$iopt{no_services}) {
42 <& services.html, %iopt &>
45 % # insert hidden predecessors to this package, if any
46 % # and a rolldown button to show them
47 % # (we'll make it do something later)
48 % if ( $cust_pkg->get('changed_from_pkg') ) {
49 <TR CLASS="row<% $row % 2 %>">
51 <BUTTON CLASS="rolldown_button"
52 ID="rolldown_<% $cust_pkg->change_pkgnum %>">
55 % # the hidden block here has ID="cust_pkgX" where X is the first pkgnum
57 <& hidden.html, $cust_pkg->get('changed_from_pkg'),
59 'next_pkg' => $cust_pkg,
65 % # show the change target, if there is one
66 % if ( $cust_pkg->change_to_pkg ) {
67 <& .packagerow, $cust_pkg->change_to_pkg, %iopt, 'change_from' => 1 &>
69 % # include supplemental packages if any
70 % $iopt{'supplemental'} = ($iopt{'supplemental'} || 0) + 1;
71 % foreach my $supp_pkg ($cust_pkg->supplemental_pkgs) {
72 <& .packagerow, $supp_pkg, %iopt &>
81 my $conf = new FS::Conf;
83 my $curuser = $FS::CurrentUser::CurrentUser;
85 my $packages = $opt{'packages'};
87 # Sort order is hardcoded for now, can change this if needed.
89 ( $a->getfield('cancel') <=> $b->getfield('cancel') ) or
90 ( $a->getfield('setup') <=> $b->getfield('setup') ) or
91 ( $a->getfield('pkgnum') <=> $b->getfield('pkgnum') )
94 my %change_custnum = map { $_->change_custnum => 1 }
95 grep { $_->change_custnum }
96 grep { $_->getfield('cancel') }
99 my $pkg_attached = ( scalar(keys %change_custnum) == 1
100 && ! grep { ! $_->getfield('cancel') } @$packages
103 my $countrydefault = scalar($conf->config('countrydefault')) || 'US';
107 'invoice-unitprice' => $conf->exists('invoice-unitprice'),
108 'show_pkgnum' => $curuser->option('show_pkgnum'),
109 'part_pkg-term_discounts' => $conf->exists('part_pkg-term_discounts'),
111 #for services.html and status.html
112 'cust_pkg-display_times' => ($conf->exists('cust_pkg-display_times')
113 || $curuser->option('cust_pkg-display_times')),
115 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
116 'pkg_attached' => $pkg_attached,
117 'part_pkg-delay_cancel-days' => $conf->config('part_pkg-delay_cancel-days') || 1,
118 #for status.html pkg-balances
119 'pkg-balances' => $conf->exists('pkg-balances'),
120 'money_char' => ( $conf->config('money_char') || '$' ),
123 'countrydefault' => $countrydefault,
124 'statedefault' => ( scalar($conf->config('statedefault'))
125 || ($countrydefault eq 'US' ? 'CA' : '') ),
126 'cust_pkg-group_by_location'=> $conf->exists('cust_pkg-group_by_location'),
127 'cust_main-require_censustract'=> $conf->exists('cust_main-require_censustract'),
128 'company_address' => [ $conf->config('company_address', $opt{cust_main}->agentnum ) ],
131 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'),
132 'svc_phone-bulk_provision_simple' => $conf->exists('svc_phone-bulk_provision_simple'),
133 'legacy_link' => $conf->exists('legacy_link'),
134 'manage_link' => scalar($conf->config('svc_broadband-manage_link')),
135 'manage_link_text' => scalar($conf->config('svc_broadband-manage_link_text')),
136 'manage_link_loc' => scalar($conf->config('svc_broadband-manage_link_loc')),
137 'manage_link-new_window' => $conf->exists('svc_broadband-manage_link-new_window'),
138 'cust_pkg-large_pkg_size' => scalar($conf->config('cust_pkg-large_pkg_size')),
139 'cust_pkg-hide_discontinued-part_svc' => $conf->exists('cust_pkg-hide_discontinued-part_svc'),