1 <% include('/elements/header.html', "Add/Edit Packages", '') %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% $p1 %>process/cust_pkg.cgi" METHOD=POST>
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
10 %my @cust_pkg = qsearch('cust_pkg', { 'custnum' => $custnum, 'cancel' => '' } );
16 Current packages - select to remove (services are moved to a new package below)
18 <TR STYLE="background-color: #cccccc;">
19 <TH COLSPAN="2">Pkg #</TH>
20 <TH>Package description</TH>
25 % foreach ( sort { $all_pkg{ $a->getfield('pkgpart') }
26 % cmp $all_pkg{ $b->getfield('pkgpart') }
31 % my($pkgnum,$pkgpart)=( $_->getfield('pkgnum'), $_->getfield('pkgpart') );
32 % my $checked = $remove_pkg{$pkgnum} ? ' CHECKED' : '';
38 <TD><INPUT TYPE="checkbox" NAME="remove_pkg" VALUE="<% $pkgnum %>"<% $checked %>></TD>
39 <TD ALIGN="right"><% $pkgnum %>:</TD>
40 <TD><% $all_pkg{$pkgpart} %> - <% $all_comment{$pkgpart} %></TD>
53 %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
54 %my $agent = qsearchs('agent',{'agentnum'=> $cust_main->agentnum });
56 %my %agent_pkgs = map { ( $_->pkgpart , $all_pkg{$_->pkgpart} ) }
57 % qsearch('type_pkgs',{'typenum'=> $agent->typenum });
65 <TR STYLE="background-color: #cccccc;">
67 <TH COLSPAN="2">Package Description</TH>
70 %#foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) {
71 %foreach my $pkgpart ( sort { $agent_pkgs{$a} cmp $agent_pkgs{$b} }
72 % keys(%agent_pkgs) ) {
74 % next unless exists $pkg{$pkgpart}; #skip disabled ones
75 % #print qq!<TR>! if ( $count == 0 );
76 % my $value = $cgi->param("pkg$pkgpart") || 0;
82 <INPUT TYPE="text" NAME="<% "pkg$pkgpart" %>" VALUE="<% $value %>" SIZE="2" MAXLENGTH="2">
84 <TD ALIGN="right"><% $pkgpart %>:</TD>
85 <TD><% $pkg{$pkgpart} %> - <% $comment{$pkgpart}%></TD>
89 % #if ( $count == 2 ) {
90 % # print qq!</TR>\n! ;
98 % unless ( $pkgparts ) {
100 % my $typenum = $agent->typenum;
101 % my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
102 % my $atype = $agent_type->atype;
106 (No <A HREF="<% $p2 %>browse/part_pkg.cgi">package definitions</A>,
108 <A HREF="<% $p2 %>edit/agent_type.cgi?<% $typenum %>"><% $atype %></a>
109 is not allowed to purchase any packages.)
113 <P><INPUT TYPE="submit" VALUE="Order">
117 <% include('/elements/footer.html') %>
122 unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
127 my %all_comment = ();
128 #foreach (qsearch('part_pkg', { 'disabled' => '' })) {
129 # $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
130 # $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
132 foreach (qsearch('part_pkg', {} )) {
133 $all_pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
134 $all_comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
135 next if $_->disabled;
136 $pkg{ $_ -> getfield('pkgpart') } = $_->getfield('pkg');
137 $comment{ $_ -> getfield('pkgpart') } = $_->getfield('comment');
140 my($custnum, %remove_pkg);
141 if ( $cgi->param('error') ) {
142 $custnum = $cgi->param('custnum');
143 %remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg');
145 my($query) = $cgi->keywords;