1 <A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A><BR>
4 % if ( $curuser->access_right('Order customer package') ) {
5 <% $s++ ? ' | ' : '' %>
6 <% include( '/elements/popup_link-cust_main.html',
7 'action' => $p. 'misc/order_pkg.html',
8 'label' => 'Order new package',
9 'actionlabel' => 'Order new package',
11 'cust_main' => $cust_main,
12 'closetext' => 'Close',
18 % if ( $curuser->access_right('One-time charge')
19 % && $conf->config('payby-default') ne 'HIDE'
21 <% $s++ ? ' | ' : '' %>
22 <% include('one_time_charge_link.html', $cust_main) %>
25 % if ( $curuser->access_right('Bulk change customer packages') ) {
26 <% $s++ ? ' | ' : '' %>
27 <A HREF="<% $p %>edit/cust_pkg.cgi?<% $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
36 % if ( $cust_main->num_cancelled_pkgs ) {
37 % if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
38 % || ( $conf->exists('hidecancelledpackages')
39 % && ! $cgi->param('showcancelledpackages')
43 % $cgi->param('showcancelledpackages', 1);
46 ( <a href="<% $cgi->self_url %>">show
48 % $cgi->param('showcancelledpackages', 0);
51 ( <a href="<% $cgi->self_url %>">hide
54 cancelled packages</a> )
58 <% include('/elements/table-grid.html') %>
59 % my $bgcolor1 = '#eeeeee';
60 % my $bgcolor2 = '#ffffff';
64 <TH CLASS="grid" BGCOLOR="#cccccc">Package</TH>
65 <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
66 % if ( $show_location ) {
67 <TH CLASS="grid" BGCOLOR="#cccccc">Location</TH>
69 <TH CLASS="grid" BGCOLOR="#cccccc">Services</TH>
72 % foreach my $cust_pkg (@$packages) {
74 % if ( $bgcolor eq $bgcolor1 ) {
75 % $bgcolor = $bgcolor2;
77 % $bgcolor = $bgcolor1;
81 % 'bgcolor' => $bgcolor,
82 % 'cust_pkg' => $cust_pkg,
83 % 'part_pkg' => $cust_pkg->part_pkg,
87 <!--pkgnum: <% $cust_pkg->pkgnum %>-->
89 <% include('packages/package.html', %iopt) %>
90 <% include('packages/status.html', %iopt) %>
91 % if ( $show_location ) {
92 <% include('packages/location.html', %iopt) %>
94 <% include('packages/services.html', %iopt) %>
105 % if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) {
107 // IE-specific hack. other browsers listen to #fragments
108 // is this even working? or is the #target redirection just working cause
109 // we set the URL params differently?
110 var el = document.getElementById( 'cust_pkg<% $1 %>' );
111 if ( el ) el.scrollIntoView(true);
117 my( $cust_main ) = @_;
118 my $conf = new FS::Conf;
120 my $curuser = $FS::CurrentUser::CurrentUser;
122 my $packages = get_packages($cust_main, $conf);
124 my $show_location = $conf->exists('cust_pkg-always_show_location')
125 || ( grep $_->locationnum, @$packages ); # ? '1' : '0';
127 my $countrydefault = scalar($conf->config('countrydefault')) || 'US';
129 #for services.html and status.html
130 'cust_pkg-display_times' => $conf->exists('cust_pkg-display_times'),
133 'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
136 'countrydefault' => $countrydefault,
137 'statedefault' => ( scalar($conf->config('statedefault'))
138 || ($countrydefault eq 'US' ? 'CA' : '') ),
140 'svc_external-skip_manual' => $conf->exists('svc_external-skip_manual'),
141 'legacy_link' => $conf->exists('legacy_link'),
147 my $cust_main = shift or return undef;
152 if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me
153 || ( $conf->exists('hidecancelledpackages')
154 && ! $cgi->param('showcancelledpackages') )
157 $method = 'ncancelled_pkgs';
159 $method = 'all_pkgs';
162 [ $cust_main->$method() ];