-<%
+<% include( 'elements/browse.html',
+ 'title' => 'Package Definitions',
+ 'menubar' => [ 'Main Menu' => $p ],
+ 'html_init' => $html_init,
+ 'html_posttotal' => $posttotal,
+ 'name' => 'package definitions',
+ 'query' => { 'select' => $select,
+ 'table' => 'part_pkg',
+ 'hashref' => \%search,
+ 'extra_sql' => "ORDER BY $orderby",
+ },
+ 'count_query' => $count_query,
+ 'header' => \@header,
+ 'fields' => \@fields,
+ 'links' => \@links,
+ 'align' => $align,
+ 'style' => \@style,
+ )
+%>
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+#false laziness w/access_user.html
my %search = ();
my $search = '';
unless ( $cgi->param('showdisabled') ) {
if ( $cgi->param('showdisabled') ) {
$cgi->param('showdisabled', 0);
$posttotal = '( <a href="'. $cgi->self_url. '">hide disabled packages</a> )';
+ $cgi->param('showdisabled', 1);
} else {
$cgi->param('showdisabled', 1);
$posttotal = '( <a href="'. $cgi->self_url. '">show disabled packages</a> )';
+ $cgi->param('showdisabled', 0);
}
+
# ------
my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
my @links = ( $link, $link, '' );
my @style = ( '', '', '' );
-unless ( $cgi->param('showdisabled') ) { #its been reversed already
+#false laziness w/access_user.html
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
push @header, 'Status';
push @fields, sub { shift->disabled
? '<FONT COLOR="#FF0000">DISABLED</FONT>'
#if ( $cgi->param('active') ) {
push @header, 'Customer<BR>packages';
my %col = (
- 'active' => '00CC00',
- 'suspended' => 'FF9900',
- 'cancelled' => 'FF0000',
+ 'active' => '00CC00',
+ 'suspended' => 'FF9900',
+ 'cancelled' => 'FF0000',
+ #'one-time charge' => '000000',
+ 'charge' => '000000',
);
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
push @fields, sub { my $part_pkg = shift;
[
map {
+ my $magic = $_;
+ my $label = $_;
+ if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
+ $magic = 'inactive';
+ #$label = 'one-time charge',
+ $label = 'charge',
+ }
+
[
{
- 'data' => '<B><FONT COLOR="#'. $col{$_}. '">'.
+ 'data' => '<B><FONT COLOR="#'. $col{$label}. '">'.
$part_pkg->get("num_$_").
'</FONT></B>',
'align' => 'right',
},
{
- 'data' => $_,
+ 'data' => $label.
+ ( $part_pkg->get("num_$_") != 1
+ && $label =~ /charge$/
+ ? 's'
+ : ''
+ ),
'align' => 'left',
'link' => ( $part_pkg->get("num_$_")
? $cust_pkg_link.
$part_pkg->pkgpart.
- ";magic=$_"
+ ";magic=$magic"
: ''
),
},
$count_query .= " WHERE $search"
if $search;
-%><%= include( 'elements/browse.html',
- 'title' => 'Package Definitions',
- 'menubar' => [ 'Main Menu' => $p ],
- 'html_init' => $html_init,
- 'html_posttotal' => $posttotal,
- 'name' => 'package definitions',
- 'query' => { 'select' => $select,
- 'table' => 'part_pkg',
- 'hashref' => \%search,
- 'extra_sql' => "ORDER BY $orderby",
- },
- 'count_query' => $count_query,
- 'header' => \@header,
- 'fields' => \@fields,
- 'links' => \@links,
- 'align' => $align,
- 'style' => \@style,
- )
-%>
+</%init>