8 #foreach (qsearch('part_pkg', { 'disabled' => '' })) {
9 # $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
10 # $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
12 foreach (qsearch('part_pkg', {} )) {
13 $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
14 $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
16 $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
17 $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
20 my($custnum, %remove_pkg);
21 if ( $cgi->param('error') ) {
22 $custnum = $cgi->param('custnum');
23 %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg');
25 my($query) = $cgi->keywords;
32 print header("Add/Edit Packages", '');
34 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
36 if $cgi->param('error');
38 print qq!<FORM ACTION="${p1}process/cust_pkg.cgi" METHOD=POST>!;
40 print qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!;
43 my @cust_pkg = qsearch('cust_pkg',{ 'custnum' => $custnum, 'cancel' => '' } );
47 Current packages - select to remove (services are moved to a new package below)
49 <TR STYLE="background-color: #cccccc;">
50 <TH COLSPAN="2">Pkg #</TH>
51 <TH>Package description</TH>
56 foreach (sort { $all_pkg{$a->getfield('pkgpart')} cmp $all_pkg{$b->getfield('pkgpart')} } @cust_pkg) {
57 my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
58 my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
61 <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="$pkgnum"${checked}></TD>
62 <TD ALIGN="right">$pkgnum:</TD>\n
63 <TD>$all_pkg{$pkgpart} - $all_comment{$pkgpart}</TD>
67 print qq!</TABLE><BR><BR>!;
71 Order new packages<BR><BR>
74 my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
75 my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
77 my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
78 qsearch('type_pkgs',{'typenum'=> $agent->typenum });
84 <TR STYLE="background-color: #cccccc;">
86 <TH COLSPAN="2">Package Description</TH>
89 #foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
90 foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
93 next unless exists $pkg{$pkgpart}; #skip disabled ones
94 #print qq!<TR>! if ( $count == 0 );
95 my $value = $cgi->param("pkg$pkgpart") || 0;
98 <TD><INPUT TYPE="text" NAME="pkg$pkgpart" VALUE="$value" SIZE="2" MAXLENGTH="2"></TD>
99 <TD ALIGN="right">$pkgpart:</TD>
100 <TD>$pkg{$pkgpart} - $comment{$pkgpart}</TD>
104 #if ( $count == 2 ) {
105 # print qq!</TR>\n! ;
111 unless ( $pkgparts ) {
113 my $typenum = $agent->typenum;
114 my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
115 my $atype = $agent_type->atype;
117 (No <a href="${p2}browse/part_pkg.cgi">package definitions</a>, or agent type
118 <a href="${p2}edit/agent_type.cgi?$typenum">$atype</a> not allowed to purchase
125 <P><INPUT TYPE="submit" VALUE="Order">