X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=d0b572aa42a293cc64fa6af355be93e42da1e19c;hp=1d51f814588a7dc5ddbb55cc66c5cfa58b0e43be;hb=cf16b23820da69e3c8d0156ae27e21c635bf1ec5;hpb=51984ac3d3da3006809c6866fdecd4ad83610731 diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 1d51f8145..d0b572aa4 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,48 +1,11 @@ <% -#!/usr/bin/perl -Tw -# -# $Id: part_pkg.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $ -# -# ivan@sisd.com 97-dec-5,9 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# lose background, FS::CGI ivan@sisd.com 98-sep-2 -# -# $Log: part_pkg.cgi,v $ -# Revision 1.1 2001-07-30 07:36:03 ivan -# templates!!! -# -# Revision 1.8 1999/04/09 04:22:34 ivan -# also table() -# -# Revision 1.7 1999/04/09 03:52:55 ivan -# explicit & for table/itable/ntable -# -# Revision 1.6 1999/01/19 05:13:27 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.5 1999/01/18 09:41:17 ivan -# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl -# (good idea anyway) -# -# Revision 1.4 1998/12/17 05:25:19 ivan -# fix visual and other bugs -# -# Revision 1.3 1998/11/21 07:23:45 ivan -# visual -# -# Revision 1.2 1998/11/21 07:00:32 ivan -# visual -# +# use strict; use vars qw( $cgi $p $part_pkg ); use CGI; use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup swapuid); +use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs); use FS::CGI qw(header menubar popurl table); use FS::part_pkg; @@ -55,18 +18,39 @@ $cgi = new CGI; $p = popurl(2); -print $cgi->header( '-expires' => 'now' ), header("Package Part Listing",menubar( +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} + +my @part_pkg = qsearch('part_pkg', \%search ); +my $total = scalar(@part_pkg); + +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, not services.

", - &table(), < +)). "One or more services are grouped together into a package and given". + " pricing information. Customers purchase packages". + " rather than purchase services directly.

". + "$total packages "; + +if ( $cgi->param('showdisabled') ) { + $cgi->param('showdisabled', 0); + print qq!( hide disabled packages )!; +} else { + $cgi->param('showdisabled', 1); + print qq!( show disabled packages )!; +} + +my $colspan = $cgi->param('showdisabled') ? 2 : 3; +print &table(), < Package Comment - Setup Fee Freq. - Recur. Fee + Plan + Data Service Quan. @@ -74,21 +58,38 @@ END foreach $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); @@ -106,7 +107,7 @@ END } print <Add new package + Add a new package definition