X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_pkg.cgi;h=d546f740929a76ad8573589fef8b1245c83ff730;hb=ddb53fcc9fc80561354b97e4e7803004990138d0;hp=729fc7c98900c292d1b3e699a8a1fdbed21a9a59;hpb=3d671921441ba8422650b54435a1959ad1d4c71d;p=freeside.git diff --git a/httemplate/edit/cust_pkg.cgi b/httemplate/edit/cust_pkg.cgi index 729fc7c98..d546f7409 100755 --- a/httemplate/edit/cust_pkg.cgi +++ b/httemplate/edit/cust_pkg.cgi @@ -1,27 +1,14 @@ + <% -# -use strict; -use vars qw( $cgi %pkg %comment $custnum $p1 @cust_pkg - $cust_main $agent $type_pkgs $count %remove_pkg $pkgparts ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -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', {})) { +my %pkg = (); +my %comment = (); +foreach (qsearch('part_pkg', { 'disabled' => '' })) { $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg'); $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment'); } +my($custnum, %remove_pkg); if ( $cgi->param('error') ) { $custnum = $cgi->param('custnum'); %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); @@ -29,11 +16,11 @@ if ( $cgi->param('error') ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum = $1; - undef %remove_pkg; + %remove_pkg = (); } -$p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Add/Edit Packages", ''); +my $p1 = popurl(1); +print header("Add/Edit Packages", ''); print qq!Error: !, $cgi->param('error'), "" @@ -44,7 +31,7 @@ print qq!
!; print qq!!; #current packages -@cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); +my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } ); if (@cust_pkg) { print <
END - my ($count) = 0 ; + my $count = 0 ; print qq!! ; foreach (@cust_pkg) { print '' if $count == 0; @@ -74,15 +61,16 @@ print <
END -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); -$agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum }); -$count = 0; -$pkgparts = 0; +my $count = 0; +my $pkgparts = 0; print qq!
!; -foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { +foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { $pkgparts++; my($pkgpart)=$type_pkgs->pkgpart; + next unless exists $pkg{$pkgpart}; #skip disabled ones print qq!! if ( $count == 0 ); my $value = $cgi->param("pkg$pkgpart") || 0; print <