X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=5acf17ef2125e878e028c30bb2e078f465707dd4;hb=0dd05e9ff98263d2d42b419b1e278a5a3bc594b2;hp=b67a5e55f96d3a8d5ed43550c77eb1afc87aa423;hpb=8af88c7428552043516f529007645ab489b32063;p=freeside.git diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index b67a5e55f..5acf17ef2 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,5 +1,28 @@ -<% +<% 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') ) { @@ -71,6 +94,7 @@ my $align = 'rll'; my @links = ( $link, $link, '' ); my @style = ( '', '', '' ); +#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'; @@ -92,28 +116,43 @@ unless ( 0 ) { #already showing only one class or something? #if ( $cgi->param('active') ) { push @header, 'Customer
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' => ''. + 'data' => ''. $part_pkg->get("num_$_"). '', '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" : '' ), }, @@ -150,7 +189,7 @@ push @fields, sub { shift->plan || '(legacy)' }, { 'data' => $1, 'align' => 'right', }, - { 'data' => $2, + { 'data' => $part_pkg->format($1,$2), 'align' => 'left', }, ]; @@ -219,22 +258,4 @@ my $count_query = 'SELECT COUNT(*) FROM part_pkg'; $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, - ) -%> +