7 %#foreach (qsearch('part_pkg', { 'disabled' => '' })) {
8 %# $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
9 %# $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
11 %foreach (qsearch('part_pkg', {} )) {
12 % $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
13 % $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
14 % next if $_->disabled;
15 % $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
16 % $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
19 %my($custnum, %remove_pkg);
20 %if ( $cgi->param('error') ) {
21 % $custnum = $cgi->param('custnum');
22 % %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg');
24 % my($query) = $cgi->keywords;
25 % $query =~ /^(\d+)$/;
33 <% include('/elements/header.html', "Add/Edit Packages", '') %>
35 <% include('/elements/error.html') %>
37 <FORM ACTION="<% $p1 %>process/cust_pkg.cgi" METHOD=POST>
39 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
42 %my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } );
48 Current packages - select to remove (services are moved to a new package below)
50 <TR STYLE="background-color: #cccccc;">
51 <TH COLSPAN="2">Pkg #</TH>
52 <TH>Package description</TH>
57 % foreach ( sort { $all_pkg{ $a->getfield('pkgpart') }
58 % cmp $all_pkg{ $b->getfield('pkgpart') }
63 % my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
64 % my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
70 <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="<% $pkgnum %>"<% $checked %>></TD>
71 <TD ALIGN="right"><% $pkgnum %>:</TD>
72 <TD><% $all_pkg{$pkgpart} %> - <% $all_comment{$pkgpart} %></TD>
85 %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
86 %my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
88 %my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
89 % qsearch('type_pkgs',{'typenum'=> $agent->typenum });
97 <TR STYLE="background-color: #cccccc;">
99 <TH COLSPAN="2">Package Description</TH>
102 %#foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
103 %foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
104 % keys(%agent_pkgs) ) {
106 % next unless exists $pkg{$pkgpart}; #skip disabled ones
107 % #print qq!<TR>! if ( $count == 0 );
108 % my $value = $cgi->param("pkg$pkgpart") || 0;
114 <INPUT TYPE="text" NAME="<% "pkg$pkgpart" %>" VALUE="<% $value %>" SIZE="2" MAXLENGTH="2">
116 <TD ALIGN="right"><% $pkgpart %>:</TD>
117 <TD><% $pkg{$pkgpart} %> - <% $comment{$pkgpart}%></TD>
121 % #if ( $count == 2 ) {
122 % # print qq!</TR>\n! ;
130 % unless ( $pkgparts ) {
131 % my $p2 = popurl(2);
132 % my $typenum = $agent->typenum;
133 % my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
134 % my $atype = $agent_type->atype;
138 (No <A HREF="<% $p2 %>browse/part_pkg.cgi">package definitions</A>,
140 <A HREF="<% $p2 %>edit/agent_type.cgi?<% $typenum %>"><% $atype %></a>
141 is not allowed to purchase any packages.)
145 <P><INPUT TYPE="submit" VALUE="Order">
149 <% include('/elements/footer.html') %>