From a01faeb3a6b823c97535782f072c455298a4ffc7 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 21 Oct 2004 08:33:31 +0000 Subject: [PATCH] if enabled, show taxclass on package definition browse --- httemplate/browse/part_pkg.cgi | 131 ++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 66 deletions(-) diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 180f18263..65cf2431e 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -41,9 +41,12 @@ if ( $cgi->param('active') ) { ) or die dbh->errstr; } else { - $sortby = \*pkgpart_sort; + $sortby = sub { $a->pkgpart <=> $b->pkgpart; }; } +my $conf = new FS::Conf; +my $taxclasses = $conf->exists('enable_taxclasses'); + %> <%= header("Package Definition Listing",menubar( 'Main Menu' => $p )) %> <% unless ( $cgi->param('active') ) { %> @@ -55,34 +58,36 @@ if ( $cgi->param('active') ) { <% } %> <%= $total %> package definitions -<% -if ( $cgi->param('showdisabled') ) { - $cgi->param('showdisabled', 0); - print qq!( hide disabled packages )!; -} else { - $cgi->param('showdisabled', 1); - print qq!( show disabled packages )!; -} +<% if ( $cgi->param('showdisabled') ) { $cgi->param('showdisabled', 0); %> + ( hide disabled packages ) +<% } else { $cgi->param('showdisabled', 1); %> + ( show disabled packages )!; +<% } %> -my $colspan = $cgi->param('showdisabled') ? 2 : 3; -print &table(), <param('showdisabled') ? 2 : 3; %> + +<%= &table() %> - Package + >Package Comment -END -print ' Customer
packages
' - if $cgi->param('active'); -print <param('active') ) { %> + Customer
packages
+<% } %> Freq. +<% if ( $taxclasses ) { %> + Taxclass +<% } %> Plan Data Service Quan. -END -print 'Primary' - if dbdef->table('pkg_svc')->column('primary_svc'); -print ''; +<% if ( dbdef->table('pkg_svc')->column('primary_svc') ) { %> + Primary +<% } %> + + +<% foreach my $part_pkg ( sort $sortby @part_pkg ) { my($hashref)=$part_pkg->hashref; my(@pkg_svc)=grep $_->getfield('quantity'), @@ -98,46 +103,49 @@ foreach my $part_pkg ( sort $sortby @part_pkg ) { $plandata = "Setup ". $hashref->{setup}. "
Recur ". $hashref->{recur}; } - print < - $hashref->{pkgpart} -END - - unless ( $cgi->param('showdisabled') ) { - print ""; - print "DISABLED" if $hashref->{disabled}; - print ''; - } + ><%= $hashref->{pkgpart} %> + +<% unless ( $cgi->param('showdisabled') ) { %> + > + <% if ( $hashref->{disabled} ) { %> + DISABLED + <% } %> + +<% } %> - print <$hashref->{pkg} - $hashref->{comment} -END - if ( $cgi->param('active') ) { - print " "; - print ''. - $num_active_cust_pkg{$hashref->{'pkgpart'}}. - qq! active
!; + ><%= $hashref->{pkg} %> + ><%= $hashref->{comment} %> + +<% if ( $cgi->param('active') ) { %> + > + <%= $num_active_cust_pkg{$hashref->{'pkgpart'}} %> active
+ + <% $suspended_sth->execute( $part_pkg->pkgpart ) + or die $suspended_sth->errstr; + my $num_suspended = $suspended_sth->fetchrow_arrayref->[0]; + %> + <%= $num_suspended %> suspended
+ + <% $canceled_sth->execute( $part_pkg->pkgpart ) + or die $canceled_sth->errstr; + my $num_canceled = $canceled_sth->fetchrow_arrayref->[0]; + %> + <%= $num_canceled %> canceled + +<% } %> - $suspended_sth->execute( $part_pkg->pkgpart ) or die $suspended_sth->errstr; - my $num_suspended = $suspended_sth->fetchrow_arrayref->[0]; - print ''. $num_suspended. - qq! suspended
!; + ><%= $hashref->{freq} %> - $canceled_sth->execute( $part_pkg->pkgpart ) or die $canceled_sth->errstr; - my $num_canceled = $canceled_sth->fetchrow_arrayref->[0]; - print ''. $num_canceled. - qq! canceled!; +<% if ( $taxclasses ) { %> + ><%= $hashref->{taxclass} || ' ' %> +<% } %> + ><%= $hashref->{plan} %> + ><%= $plandata %> - print ''; - } - print <$hashref->{freq} - $hashref->{plan} - $plandata -END - +<% my($pkg_svc); my($n)=""; foreach $pkg_svc ( @pkg_svc ) { @@ -154,20 +162,11 @@ END print "\n"; $n=""; } +%> - print ""; -} - -$colspan = $cgi->param('showdisabled') ? 8 : 9; -print < +<% } %> -END - -sub pkgpart_sort { - $a->pkgpart <=> $b->pkgpart; -} - -%> -- 2.11.0