<% 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' => '',
% } );
% 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;
% }
|
|
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 ) ) {
%
<% $thead %>
% }
% }
% $count++;
%
% }
|
<%init>
my %opt = @_;
my $cgi = $opt{'cgi'};
my $thead = "\n\n". ntable('#cccccc', 2).
'Quan. | '.
'Primary | '.
'Service |
';
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;
my @fixups = ();
my $count = 0;
my $columns = 3;
%init>