<% itable('', 4, 1) %> |
<% $thead %>
%foreach my $part_svc ( @part_svc ) {
% my $svcpart = $part_svc->svcpart;
% my $pkg_svc = $pkg_svc{$svcpart}
% || new FS::pkg_svc ( {
% 'pkgpart' => $pkgpart,
% 'svcpart' => $svcpart,
% 'quantity' => 0,
% 'primary_svc' => '',
% 'hidden' => '',
% } );
% 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;
% }
%
% push @fixups, "pkg_svc$svcpart";
%
% my $quan = 0;
% if ( $cgi->param("pkg_svc$svcpart") =~ /^\s*(\d+)\s*$/ ) {
% $quan = $1;
% } elsif ( $pkg_svc->quantity ) {
% $quan = $pkg_svc->quantity;
% }
%
% 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' : '' %>
|
hidden =~ /^Y/i ? ' CHECKED' : ''%>>
|
% foreach ( 1 .. $columns-1 ) {
% if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) {
%
<% $thead %>
% }
% }
% $count++;
%
% }
|
% if ( scalar(@possible_exports) > 0 || scalar(@mapped_exports) > 0 ) {
% }
<%init>
my %opt = @_;
my $cgi = $opt{'cgi'};
my $thead = "\n\n". ntable('#cccccc', 2).
'Quan. | '.
'Primary | '.
'Service | '.
'Hide | '.
'
';
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 @fixups = ();
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;
%init>