1 <% include('/elements/header.html', "Add/Edit Packages", '') %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% $p1 %>process/cust_pkg.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="action" VALUE="bulk">
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
10 %my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } );
13 Current packages - select to remove (services are moved to a new package below)
15 <TR STYLE="background-color: #cccccc;">
16 <TH COLSPAN="2">Pkg #</TH>
17 <TH>Package description</TH>
22 % foreach ( sort { $all_pkg{ $a->getfield('pkgpart') }
23 % cmp $all_pkg{ $b->getfield('pkgpart') }
28 % my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
29 % my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
35 <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="<% $pkgnum %>"<% $checked %>></TD>
36 <TD ALIGN="right"><% $pkgnum %>:</TD>
37 <TD><% $all_pkg{$pkgpart} %> - <% $all_comment{$pkgpart} %></TD>
50 %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
51 %my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
53 %my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
54 % qsearch('type_pkgs',{'typenum'=> $agent->typenum });
62 <TR STYLE="background-color: #cccccc;">
64 <TH COLSPAN="2">Package Description</TH>
67 %#foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
68 %foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
69 % keys(%agent_pkgs) ) {
71 % next unless exists $pkg{$pkgpart}; #skip disabled ones
72 % #print qq!<TR>! if ( $count == 0 );
73 % my $value = $cgi->param("pkg$pkgpart") || 0;
79 <INPUT TYPE="text" NAME="<% "pkg$pkgpart" %>" VALUE="<% $value %>" SIZE="2" MAXLENGTH="2">
81 <TD ALIGN="right"><% $pkgpart %>:</TD>
82 <TD><% $pkg{$pkgpart} %> - <% $comment{$pkgpart}%></TD>
86 % #if ( $count == 2 ) {
87 % # print qq!</TR>\n! ;
95 % unless ( $pkgparts ) {
97 % my $typenum = $agent->typenum;
98 % my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
99 % my $atype = $agent_type->atype;
103 (No <A HREF="<% $p2 %>browse/part_pkg.cgi">package definitions</A>,
105 <A HREF="<% $p2 %>edit/agent_type.cgi?<% $typenum %>"><% $atype %></a>
106 is not allowed to purchase any packages.)
110 <P><INPUT TYPE="submit" VALUE="Order">
114 <% include('/elements/footer.html') %>
119 unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
124 my %all_comment = ();
125 #foreach (qsearch('part_pkg', { 'disabled' => '' })) {
126 # $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
127 # $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
129 foreach (qsearch('part_pkg', {} )) {
130 $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
131 $all_comment{ $_ -> getfield('pkgpart') } = $_->custom_comment;
132 next if $_->disabled;
133 $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
134 $comment{ $_ -> getfield('pkgpart') } = $_->custom_comment;
137 my($custnum, %remove_pkg);
138 if ( $cgi->param('error') ) {
139 $custnum = $cgi->param('custnum');
140 %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg');
142 my($query) = $cgi->keywords;