X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fedit%2Fcust_pkg.cgi;h=b3c92249f51331642d803f885f73feeb0c509d2e;hb=1e3eae905b861761f93643aa5fce14a8be5d9ed2;hp=afe6f877098f215a78093140c7ddbfc105b3890c;hpb=e0da34d97b1463b55a334e8dae10cd55796e2312;p=freeside.git diff --git a/htdocs/edit/cust_pkg.cgi b/htdocs/edit/cust_pkg.cgi index afe6f8770..b3c92249f 100755 --- a/htdocs/edit/cust_pkg.cgi +++ b/htdocs/edit/cust_pkg.cgi @@ -1,14 +1,12 @@ #!/usr/bin/perl -Tw # -# $Id: cust_pkg.cgi,v 1.5 1999-02-07 09:59:18 ivan Exp $ +# $Id: cust_pkg.cgi,v 1.8 1999-07-21 07:34:13 ivan Exp $ # # this is for changing packages around, not editing things within the package # # Usage: cust_pkg.cgi custnum # http://server.name/path/cust_pkg.cgi?custnum # -# Note: Should be run setuid freeside as user nobody -# # started with /sales/add/cust_pkg.cgi, which added packages # ivan@voicenet.com 97-jan-5, 97-mar-21 # @@ -25,7 +23,18 @@ # 98-jun-1 # # $Log: cust_pkg.cgi,v $ -# Revision 1.5 1999-02-07 09:59:18 ivan +# Revision 1.8 1999-07-21 07:34:13 ivan +# links to package browse and agent type edit if there aren't any packages to +# order. thanks to "Tech Account" +# +# Revision 1.7 1999/04/14 01:03:01 ivan +# oops, in 1.2 tree, can't do searches until [cgi|admin]suidsetup, +# bug is hidden by mod_perl persistance +# +# Revision 1.6 1999/02/28 00:03:36 ivan +# removed misleading comments +# +# Revision 1.5 1999/02/07 09:59:18 ivan # more mod_perl fixes, and bugfixes Peter Wemm sent via email # # Revision 1.4 1999/01/19 05:13:38 ivan @@ -42,7 +51,7 @@ use strict; use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg - $cust_main $agent $type_pkgs $count %remove_pkg ); + $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -51,14 +60,16 @@ use FS::CGI qw(header popurl); use FS::part_pkg; use FS::type_pkgs; +$cgi = new CGI; +&cgisuidsetup($cgi); + +%pkg = (); +%comment = (); foreach (qsearch('part_pkg', {})) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } -$cgi = new CGI; -&cgisuidsetup($cgi); - if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); @@ -114,11 +125,13 @@ END $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); -$count = 0 ; -print qq!! ; +$count = 0; +$pkgparts = 0; +print qq!
!; foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { + $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; - print qq!! if ($count == 0) ; + print qq!! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; print < @@ -126,18 +139,28 @@ foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgpart: $pkg{$pkgpart} - $comment{$pkgpart}\n END $count ++ ; - if ($count == 2) - { + if ( $count == 2 ) { print qq!\n! ; - $count = 0 ; + $count = 0; } } -print qq!
! ; +print qq!!; -#submit -print qq!

\n!; +unless ( $pkgparts ) { + my $p2 = popurl(2); + my $typenum = $agent->typenum; + my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } ); + my $atype = $agent_type->atype; + print <package definitions, or agent type +$atype not allowed to purchase +any packages.) +END +} +#submit print <