X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=0af64e73716344b56de79964ada73ce4d6322055;hp=1538a7127cae1fb4745cee4a65af2b73ce444f88;hb=a4c96748eb6eab29a70f3a944c6520283a635c78;hpb=1e4aa8069f25e1b4101da20bb9e0d3f60357ea52 diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 1538a7127..0af64e737 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,57 +1,78 @@ + <% -# -use strict; -use vars qw( $cgi $p $part_pkg ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header menubar popurl table); -use FS::part_pkg; -use FS::pkg_svc; -use FS::part_svc; +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} -$cgi = new CGI; +my @part_pkg = qsearch('part_pkg', \%search ); +my $total = scalar(@part_pkg); -&cgisuidsetup($cgi); +print header("Package Definition Listing",menubar( + 'Main Menu' => $p, +)). "One or more services are grouped together into a package and given". + " pricing information. Customers purchase packages". + " rather than purchase services directly.

". + "$total packages "; -$p = popurl(2); +if ( $cgi->param('showdisabled') ) { + $cgi->param('showdisabled', 0); + print qq!( hide disabled packages )!; +} else { + $cgi->param('showdisabled', 1); + print qq!( show disabled packages )!; +} -print $cgi->header( '-expires' => 'now' ), header("Package Definition Listing",menubar( - 'Main Menu' => $p, -)), "One or more services are grouped together into a package and given", - " pricing information. Customers purchase packages, not services.

", - &table(), < +my $colspan = $cgi->param('showdisabled') ? 2 : 3; +print &table(), < Package Comment - Setup Fee Freq. - Recur. Fee + Plan + Data Service Quan. END -foreach $part_pkg ( sort { +foreach my $part_pkg ( sort { $a->getfield('pkgpart') <=> $b->getfield('pkgpart') -} qsearch('part_pkg',{}) ) { +} @part_pkg ) { my($hashref)=$part_pkg->hashref; my(@pkg_svc)=grep $_->getfield('quantity'), qsearch('pkg_svc',{'pkgpart'=> $hashref->{pkgpart} }); my($rowspan)=scalar(@pkg_svc); + my $plandata; + if ( $hashref->{plan} ) { + $plandata = $hashref->{plandata}; + $plandata =~ s/^(\w+)=/$1 /mg; + $plandata =~ s/\n/
/g; + } else { + $hashref->{plan} = "(legacy)"; + $plandata = "Setup ". $hashref->{setup}. + "
Recur ". $hashref->{recur}; + } print < - - $hashref->{pkgpart} - + $hashref->{pkgpart} +END + + unless ( $cgi->param('showdisabled') ) { + print ""; + print "DISABLED" if $hashref->{disabled}; + print ''; + } + + print <$hashref->{pkg} $hashref->{comment} - $hashref->{setup} $hashref->{freq} - $hashref->{recur} + $hashref->{plan} + $plandata END my($pkg_svc);