', $thead;
Services included
END
}
my @fixups = ();
my $count = 0;
my $columns = 3;
my @part_svc = qsearch(
'part_svc',
{},
'',
"WHERE disabled IS NULL OR disabled = ''
OR 0 < ( SELECT quantity FROM pkg_svc
WHERE pkg_svc.svcpart = part_svc.svcpart
AND pkgpart = 72
)"
);
foreach my $part_svc ( @part_svc ) {
my $svcpart = $part_svc->svcpart;
my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart;
my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', {
'pkgpart' => $pkgpart,
'svcpart' => $svcpart,
} ) || new FS::pkg_svc ( {
'pkgpart' => $pkgpart,
'svcpart' => $svcpart,
'quantity' => 0,
'primary_svc' => '',
});
#? #next unless $pkg_svc;
push @fixups, "pkg_svc$svcpart";
#unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) {
#dunno why...
unless ( 0 ) {
print ' | '; # if $count == 0 ;
print qq!quantity || 0,
qq!"> | !;
if ( dbdef->table('pkg_svc')->column('primary_svc') ) {
print qq!primary_svc =~ /^Y/i;
print '> | ';
}
print qq!!, $part_svc->getfield('svc'), '';
print ' (DISABLED)' if $part_svc->disabled =~ /^Y/i;
print ' |
';
# print "$thead" if ++$count == int(scalar(@part_svc) / 2);
$count+=1;
foreach ( 1 .. $columns-1 ) {
print " | $thead"
if $count == int( $_ * scalar(@part_svc) / $columns );
}
} else {
print qq!quantity || 0, qq!">\n!;
}
}
#unless ( $cgi->param('clone') ) {
#dunno why...
unless ( 0 ) {
print " | ";
#print "";
}
foreach my $f ( qw( clone pkgnum ) ) {
print qq!';
}
print '';
# prolly should be in database
tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() };
my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
split("\n", ($clone_part_pkg||$part_pkg)->plandata );
#warn join("\n", map { "$_: $plandata{$_}" } keys %plandata ). "\n";
tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans;
my @form_select = ();
if ( $conf->exists('enable_taxclasses') ) {
push @form_select, 'taxclass';
} else {
push @fixups, 'taxclass'; #hidden
}
my @form_radio = ();
if ( dbdef->table('pkg_svc')->column('primary_svc') ) {
push @form_radio, 'pkg_svc_primary';
}
tie my %freq, 'Tie::IxHash', %FS::part_pkg::freq;
if ( $part_pkg->dbdef_table->column('freq')->type =~ /(int)/i ) {
delete $freq{$_} foreach grep { ! /^\d+$/ } keys %freq;
}
my $widget = new HTML::Widgets::SelectLayers(
'selected_layer' => $part_pkg->plan,
'options' => \%options,
'form_name' => 'dummy',
'form_action' => 'process/part_pkg.cgi',
'form_text' => [ qw(pkg comment promo_code clone pkgnum pkgpart),
@fixups
],
'form_checkbox' => [ qw(setuptax recurtax disabled) ],
'form_radio' => \@form_radio,
'form_select' => \@form_select,
'layer_callback' => sub {
my $layer = shift;
my $html = qq!!.
ntable("#cccccc",2);
$html .= '
Recurring fee frequency |
|
';
my $href = $plans{$layer}->{'fields'};
foreach my $field ( exists($plans{$layer}->{'fieldorder'})
? @{$plans{$layer}->{'fieldorder'}}
: keys %{ $href }
) {
$html .= ''. $href->{$field}{'name'}. ' | ';
if ( ! exists($href->{$field}{'type'}) ) {
$html .= qq!!;
} elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
$html .= qq!';
} elsif ( $href->{$field}{'type'} =~ /^select/ ) {
$html .= '';
}
$html .= ' |
';
}
$html .= '';
$html .= ''.
'
';
$html .= '';
$html;
},
);
%>
Price plan <%= $widget->html %>