<% itable('', 4, 1) %> <% pkg_svc_thead() %> %foreach my $part_svc ( @part_svc ) { % my $svcpart = $part_svc->svcpart; % my $pkg_svc = $pkg_svc{$svcpart} % ||= qsearchs('pkg_svc', { 'pkgpart' => $pkgpart, % 'svcpart' => $svcpart } ) % || new FS::pkg_svc ( { % 'pkgpart' => $pkgpart, % 'svcpart' => $svcpart, % 'quantity' => 0, % 'primary_svc' => '', % 'hidden' => '', % 'bulk_skip' => '', % } ); % if ( $cgi->param('error') ) { % my $primary_svc = ( $pkg_svc->primary_svc =~ /^Y/i ); % my $pkg_svc_primary = scalar($cgi->param('pkg_svc_primary')); % $pkg_svc->primary_svc('') % if $primary_svc && $pkg_svc_primary != $svcpart; % $pkg_svc->primary_svc('Y') % if ! $primary_svc && $pkg_svc_primary == $svcpart; % } % % my $quan = 0; % if ( $cgi->param("pkg_svc$svcpart") =~ /^\s*(\d+)\s*$/ ) { % $quan = $1; % } elsif ( $pkg_svc->quantity ) { % $quan = $pkg_svc->quantity; % } % % my $hidden = ''; % if ( grep { $_ eq "hidden_svc$svcpart" } $cgi->param ) { % $hidden = $cgi->param("hidden_svc$svcpart"); % } else { % $hidden = $pkg_svc->hidden; % } % my $bulk_skip = ''; % if ( grep { $_ eq "no_bulk_skip$svcpart" } $cgi->param ) { % $bulk_skip = $cgi->param("no_bulk_skip$svcpart") eq 'Y' ? '' : 'Y'; % } else { % $bulk_skip = $pkg_svc->bulk_skip; % } % my $provision_hold = ''; % if ( grep { $_ eq "provision_hold$svcpart" } $cgi->param ) { % $provision_hold = $cgi->param("hidden_svc$svcpart"); % } else { % $provision_hold = $pkg_svc->provision_hold; % } % % my @exports = $pkg_svc->part_svc->part_export; % foreach my $export ( @exports ) { % push @possible_exports, $export if $export->can('external_pkg_map'); % } primary_svc =~ /^Y/i ? ' CHECKED' : '' %>> <% $part_svc->svc %> <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED)' : '' %> > > > % foreach ( 1 .. $columns-1 ) { % if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) { % <% pkg_svc_thead() %> % } % } % $count++; % % } # foreach $part_svc % if ( scalar(@possible_exports) > 0 || scalar(@mapped_exports) > 0 ) { % foreach my $export ( @mapped_exports ) { % } % foreach my $export ( @possible_exports ) { % unless ( defined $vendor_pkg_ids{$export->exportnum} ) { % } % }
Export Vendor Package Id (blank to delete)
<% $export->exportname %>
<% $export->exportname %>
% } <%init> my %opt = @_; my $cgi = $opt{'cgi'}; my $thead_count = 0; sub pkg_svc_thead { $thead_count += 1; return "\n\n". ntable('#cccccc', 2). ''. 'Quan.'. 'Primary'. 'Service'. 'Hide
from
Invoices
'. 'Bulk
Charge
'. 'Remove Hold After Provisioning'. ''. qq!!; ; } my $part_pkg = $opt{'object'}; my $pkgpart = $part_pkg->pkgpart; my $where = "WHERE disabled IS NULL OR disabled = ''"; if ( $pkgpart ) { $where .= " OR 0 < ( SELECT quantity FROM pkg_svc WHERE pkg_svc.svcpart = part_svc.svcpart AND pkgpart = $pkgpart )"; } my @part_svc = qsearch('part_svc', {}, '', $where); #my $q_part_pkg = $clone_part_pkg || $part_pkg; #my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc('disable_linked'=>1); my $count = 0; my $columns = 3; my @possible_exports = (); my @mapped_exports = (); my @part_pkg_vendor = $part_pkg->part_pkg_vendor; foreach my $part_pkg_vendor ( @part_pkg_vendor ) { push @mapped_exports, $part_pkg_vendor->part_export; } my %vendor_pkg_ids = $part_pkg->vendor_pkg_ids;