%>
-<%= header("$action Package Definition", menubar(
+<%= include("/elements/header.html","$action Package Definition", menubar(
'Main Menu' => popurl(2),
'View all packages' => popurl(2). 'browse/part_pkg.cgi',
)) %>
<INPUT TYPE="text" NAME="comment" SIZE=32 VALUE="<%=$part_pkg->comment%>">
</TD>
</TR>
+ <%= include( '/elements/tr-select-pkg_class.html', $part_pkg->classnum ) %>
<TR>
<TD ALIGN="right">Promotional code</TD>
<TD>
%>
-<%= itable('', 4, 1) %><TR><TD VALIGN="top">
<BR><BR>Services included
+<%= itable('', 4, 1) %><TR><TD VALIGN="top">
<%= $thead %>
<%
</TD>
</TR>
- <% $count++;
- foreach ( 1 .. $columns-1 ) {
+ <% foreach ( 1 .. $columns-1 ) {
if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) {
%>
</TABLE></TD><TD VALIGN="top"><%= $thead %>
<% }
}
+ $count++;
%>
<% } %>
tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans;
-my @form_select = ();
+my @form_select = ('classnum');
if ( $conf->exists('enable_taxclasses') ) {
push @form_select, 'taxclass';
} else {
push @form_radio, 'pkg_svc_primary';
}
-tie my %freq, 'Tie::IxHash', %FS::part_pkg::freq;
+tie my %freq, 'Tie::IxHash', %{FS::part_pkg->freqs_href()};
if ( $part_pkg->dbdef_table->column('freq')->type =~ /(int)/i ) {
delete $freq{$_} foreach grep { ! /^\d+$/ } keys %freq;
}
$html .= ' MULTIPLE'
if $href->{$field}{'type'} eq 'select_multiple';
$html .= qq! NAME="$field" onChange="fchanged(this)">!;
- foreach my $record (
- qsearch( $href->{$field}{'select_table'},
- $href->{$field}{'select_hash'} )
- ) {
- my $value = $record->getfield($href->{$field}{'select_key'});
- $html .= qq!<OPTION VALUE="$value"!.
- ( $plandata{$field} =~ /(^|, *)$value *(,|$)/
- ? ' SELECTED'
- : '' ).
- '>'. $record->getfield($href->{$field}{'select_label'})
+
+ if ( $href->{$field}{'select_table'} ) {
+ foreach my $record (
+ qsearch( $href->{$field}{'select_table'},
+ $href->{$field}{'select_hash'} )
+ ) {
+ my $value = $record->getfield($href->{$field}{'select_key'});
+ $html .= qq!<OPTION VALUE="$value"!.
+ ( $plandata{$field} =~ /(^|, *)$value *(,|$)/
+ ? ' SELECTED'
+ : ''
+ ).
+ '>'. $record->getfield($href->{$field}{'select_label'});
+ }
+ } elsif ( $href->{$field}{'select_options'} ) {
+ foreach my $key ( keys %{ $href->{$field}{'select_options'} } ) {
+ my $value = $href->{$field}{'select_options'}{$key};
+ $html .= qq!<OPTION VALUE="$key"!.
+ ( $plandata{$field} =~ /(^|, *)$value *(,|$)/
+ ? ' SELECTED'
+ : ''
+ ).
+ '>'. $value;
+ }
+
+ } else {
+ $html .= '<font color="#ff0000">warning: '.
+ "don't know how to retreive options for $field select field".
+ '</font>';
}
$html .= '</SELECT>';
}