Packages
% if ( $curuser->access_right('One-time charge') ) {
% } % my $s = 0; % if ( $curuser->access_right('Order customer package') ) { <% $s++ ? ' | ' : '' %> <% order_pkg_link($cust_main) %> % } % if ( $curuser->access_right('One-time charge') % && $conf->config('payby-default') ne 'HIDE' % ) { % <% $s++ ? ' | ' : '' %> <% include('/elements/popup_link.html', { 'action' => $p. 'edit/quick-charge.html?custnum='. $cust_main->custnum, 'label' => 'One-time charge', 'actionlabel' => 'One-time charge', 'color' => '#333399', 'width' => 763, }) %> % } % if ( $curuser->access_right('Bulk change customer packages') ) { <% $s++ ? ' | ' : '' %> Bulk order and cancel packages (preserves services) % }

% if ( @$packages ) { Current packages % } % if ( $cust_main->num_cancelled_pkgs ) { % if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me % || ( $conf->exists('hidecancelledpackages') % && ! $cgi->param('showcancelledpackages') % ) % ) % { % $cgi->param('showcancelledpackages', 1); % ( show % } else { % $cgi->param('showcancelledpackages', 0); % ( hide % } cancelled packages ) % } % if ( @$packages ) { <% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; Package Status Location Services % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { % $bgcolor = $bgcolor1; % } % % my %iopt = ( % 'bgcolor' => $bgcolor, % 'cust_pkg' => $cust_pkg, % 'part_pkg' => $cust_pkg->part_pkg, % ); <% include('packages/package.html', %iopt) %> <% include('packages/status.html', %iopt) %> <% include('packages/location.html', %iopt) %> <% include('packages/services.html', %iopt) %> % } % } else {
% } % if ( $cgi->param('fragment') =~ /^cust_pkg(\d+)$/ ) { % } <%init> my( $cust_main ) = @_; my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; my $packages = get_packages($cust_main, $conf); #subroutines sub get_packages { my $cust_main = shift or return undef; my $conf = shift; my @packages = (); my $method; if ( $cgi->param('showcancelledpackages') eq '0' #see if it was set by me || ( $conf->exists('hidecancelledpackages') && ! $cgi->param('showcancelledpackages') ) ) { $method = 'ncancelled_pkgs'; } else { $method = 'all_pkgs'; } [ $cust_main->$method() ]; } sub order_pkg_link { include( '/elements/popup_link-cust_main.html', 'action' => $p. 'misc/order_pkg.html', 'label' => 'Order new package', 'actionlabel' => 'Order new package', 'color' => '#333399', 'cust_main' => shift, 'closetext' => 'Close', ) }