X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fview%2Fcust_pkg.cgi;h=0054ee0fa7e6dff685b8f25622a1f62bedc33fdb;hb=ab210fc8d75ee85574c5d4ca345c33190d9d5e2e;hp=034389755d755f0dab26f98165c20bf8d511b31e;hpb=6b842a0891010b36bf7b0596bd062f70bcff7826;p=freeside.git diff --git a/htdocs/view/cust_pkg.cgi b/htdocs/view/cust_pkg.cgi index 034389755..0054ee0fa 100755 --- a/htdocs/view/cust_pkg.cgi +++ b/htdocs/view/cust_pkg.cgi @@ -1,12 +1,10 @@ #!/usr/bin/perl -Tw # -# $Id: cust_pkg.cgi,v 1.4 1998-12-23 03:08:40 ivan Exp $ +# $Id: cust_pkg.cgi,v 1.11 1999-04-09 04:22:34 ivan Exp $ # # Usage: cust_pkg.cgi pkgnum # http://server.name/path/cust_pkg.cgi?pkgnum # -# Note: Should be run setuid freeside as user nobody. -# # ivan@voicenet.com 96-dec-15 # # services section needs to be cleaned up, needs to display extraneous @@ -26,8 +24,28 @@ # no FS::Search ivan@sisd.com 98-mar-7 # # $Log: cust_pkg.cgi,v $ -# Revision 1.4 1998-12-23 03:08:40 ivan -# $cgi->keywords instead of $cgi->query_string +# Revision 1.11 1999-04-09 04:22:34 ivan +# also table() +# +# Revision 1.10 1999/04/09 03:52:55 ivan +# explicit & for table/itable/ntable +# +# Revision 1.9 1999/04/08 12:00:19 ivan +# aesthetic update +# +# Revision 1.8 1999/02/28 00:04:01 ivan +# removed misleading comments +# +# Revision 1.7 1999/01/19 05:14:20 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:44 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/23 03:11:40 ivan +# *** empty log message *** # # Revision 1.3 1998/12/17 09:57:22 ivan # s/CGI::(Base|Request)/CGI.pm/; @@ -38,11 +56,14 @@ # use strict; +use vars qw ( $cgi %uiview %uiadd $part_svc $query $pkgnum $cust_pkg $part_pkg + $custnum $susp $cancel $expire $pkg $comment $setup $bill + $otaker ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header); +use FS::CGI qw(popurl header menubar ntable table); use FS::Record qw(qsearch qsearchs); use FS::part_svc; use FS::cust_pkg; @@ -50,98 +71,91 @@ use FS::part_pkg; use FS::pkg_svc; use FS::cust_svc; -my($cgi) = new CGI; +$cgi = new CGI; cgisuidsetup($cgi); -my(%uiview,%uiadd); -my($part_svc); foreach $part_svc ( qsearch('part_svc',{}) ) { $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; } -print $cgi->header, header('Package View', ''); - -$cgi->query_string =~ /^(\d+)$/ or die $cgi->query_string; -my($pkgnum)=$1; +($query) = $cgi->keywords; +$query =~ /^(\d+)$/; +$pkgnum = $1; #get package record -my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); die "No package!" unless $cust_pkg; -my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); +$part_pkg = qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->getfield('pkgpart')}); -#nav bar -my($custnum)=$cust_pkg->getfield('custnum'); -print qq!
View this customer!, - qq! (#$custnum) | Main menu

!; +$custnum = $cust_pkg->getfield('custnum'); +print $cgi->header( '-expires' => 'now' ), header('Package View', menubar( + "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", + 'Main Menu' => popurl(2) +)); #print info -my($susp,$cancel,$expire)=( +($susp,$cancel,$expire)=( $cust_pkg->getfield('susp'), $cust_pkg->getfield('cancel'), $cust_pkg->getfield('expire'), ); -print "
Package #$pkgnum"; -print qq!
Package Information!; -print qq! | Service Information! unless $cancel; -print qq!

\n!; - -my($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); -print qq!
Package Information!, - qq!!; -print qq!
Edit this information
!; -print "

Package: $pkg - $comment"; - -my($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); -print "
Setup: ", $setup ? time2str("%D",$setup) : "(Not setup)" ,""; -print "
Next bill: ", $bill ? time2str("%D",$bill) : "" ,""; - -if ($susp) { - print "
Suspended: ", time2str("%D",$susp), ""; - print qq! Unsuspend! unless $cancel; -} else { - print qq!
Suspend! unless $cancel; -} - -if ($expire) { - print "
Expire: ", time2str("%D",$expire), ""; -} - print < - -Expire (date): - -END - -if ($cancel) { - print "
Cancelled: ", time2str("%D",$cancel), ""; -} else { - print qq!
Cancel now!; -} - -#otaker -my($otaker)=$cust_pkg->getfield('otaker'); -print "

Order taken by $otaker"; +($pkg,$comment)=($part_pkg->getfield('pkg'),$part_pkg->getfield('comment')); +($setup,$bill)=($cust_pkg->getfield('setup'),$cust_pkg->getfield('bill')); +$otaker = $cust_pkg->getfield('otaker'); + +print "Package information"; +print ' (unsuspend)' if ( $susp && ! $cancel ); +print ' (suspend)' unless ( $susp || $cancel ); +print ' (cancel)' unless $cancel; + +print &ntable("#c0c0c0"), '', &ntable("#c0c0c0",2), + 'Package number', + $pkgnum, '', + 'Package', + $pkg, '', + 'Comment', + $comment, '', + 'Setup date', + ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '', + 'Next bill date', + ( $bill ? time2str("%D",$bill) : " " ), '', +; +print 'Suspension date', + time2str("%D",$susp), '' if $susp; +print 'Expiration date', + time2str("%D",$expire), '' if $expire; +print 'Cancellation date', + time2str("%D",$cancel), '' if $cancel; +print 'Order taker', + $otaker, '', + '' +; + +# print < +# +#Expire (date): +# +#END unless ($cancel) { #services - print <

Service Information -
Click on service to view/edit/add service.

-
Do NOT pick the "Link to existing" option unless you are auditing!!!
-
- -END + print '
Service Information', &table(); #list of services this pkgpart includes - my($pkg_svc,%pkg_svc); + my $pkg_svc; + my %pkg_svc = (); foreach $pkg_svc ( qsearch('pkg_svc',{'pkgpart'=> $cust_pkg->pkgpart }) ) { $pkg_svc{$pkg_svc->svcpart} = $pkg_svc->quantity if $pkg_svc->quantity; } #list of records from cust_svc - my($svcpart); + my $svcpart; foreach $svcpart (sort {$a <=> $b} keys %pkg_svc) { my($svc)=qsearchs('part_svc',{'svcpart'=>$svcpart})->getfield('svc'); @@ -156,8 +170,9 @@ END my($cust_svc); if ( $cust_svc=shift @cust_svc ) { my($svcnum)=$cust_svc->svcnum; + my($label, $value, $svcdb) = $cust_svc->label; print < + END } else { print <"; - + print "
Service(View) $svc
(View) $svc: $value
", + "Choose (View) to view or edit an existing service
", + "Choose (Add) to setup a new service
", + "Choose (Link to existing) to link to a legacy (pre-Freeside) service", + "
" + ; } #formatting