%doc> Bulk package Edit Page %doc> <& /elements/header-cust_main.html, view => 'packages', cust_main => $cust_main, include_selectize => 1, &> <% include('/elements/error.html') %>
<% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages'); my $custnum = $cgi->param('keywords') || $cgi->param('custnum'); $custnum =~ /^\d+$/ or die "Invalid custnum($custnum)"; my $cust_main = qsearchs( cust_main => { custnum => $custnum }) or die "Invalid custnum ($custnum)"; my %part_pkg; my @part_pkg_enabled; for my $part_pkg ( qsearch( part_pkg => {} )) { $part_pkg{ $part_pkg->pkgpart } = $part_pkg; push @part_pkg_enabled, $part_pkg unless $part_pkg->disabled; } @part_pkg_enabled = sort { $a->classname cmp $b->classname || $a->pkg cmp $b->pkg } @part_pkg_enabled; my @cust_pkg; my %cust_pkg_supp_of; for my $cust_pkg ( qsearch( cust_pkg => { custnum => $custnum, cancel => '', } ) ) { if ( my $main_pkgnum = $cust_pkg->main_pkgnum ) { $cust_pkg_supp_of{ $main_pkgnum } //= []; push @{ $cust_pkg_supp_of{ $main_pkgnum } }, $cust_pkg; } else { $cust_pkg_supp_of{ $cust_pkg->pkgnum } //= []; push @cust_pkg, $cust_pkg; } } %init>