Service definitions are the templates for items you offer to your customers.
<UL><LI>svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, RADIUS entries for broadband, etc.)
<LI>svc_domain - Domains
- <LI>svc_forward - mail forwarding
+ <LI>svc_forward - Mail forwarding
+ <LI>svc_mailinglist - Mailing list
<LI>svc_www - Virtual domain website
<LI>svc_broadband - Broadband/High-speed Internet service (always-on)
<LI>svc_phone - Customer phone numbers
+ <LI>svc_pbx - Customer PBXs
<LI>svc_external - Externally-tracked service
<!-- <LI>svc_charge - One-time charges (Partially unimplemented)
<LI>svc_wo - Work orders (Partially unimplemented)
% 'condition' =>
% sub { !ref($_[0]) || $_[0]->{disable_select} },
% },
-%# need to template-ize httemplate/edit/svc_* first
-%# 'M' => { 'desc' => 'Manual selection from inventory',
-%# 'condition' => $inv_sub,
-%# },
+% 'M' => { 'desc' => 'Manual selection from inventory',
+% 'condition' => $inv_sub,
+% },
% 'A' => { 'desc' => 'Automatically fill in from inventory',
% 'condition' => $inv_sub,
% },
% $html .= include('/elements/table-grid.html', 'cellpadding' => 4 ).
% '<TR>'.
% '<TH CLASS="grid" BGCOLOR="#cccccc">Field</TH>'.
+% '<TH CLASS="grid" BGCOLOR="#cccccc">Label</TH>'.
% '<TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH>'.
% '</TR>';
%
%
% #yucky kludge
% my @fields = defined( dbdef->table($layer) )
-% ? grep { $_ ne 'svcnum' } fields($layer)
+% ? grep {
+% $_ ne 'svcnum' &&
+% ( !FS::part_svc->svc_table_fields($layer)
+% ->{$_}->{disable_part_svc_column} ||
+% $part_svc->part_svc_column($_)->columnflag
+% )
+% }
+% fields($layer)
% : ();
% push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge
% $part_svc->svcpart($clone) if $clone; #haha, undone below
%
% foreach my $field (@fields) {
%
-% #my $def = $defs{$layer}{$field};
+% #a few lines of false laziness w/browse/part_svc.cgi
% my $def = FS::part_svc->svc_table_fields($layer)->{$field};
-% my $label = $def->{'def_label'} || $def->{'label'};
+% my $def_info = $def->{'def_info'};
% my $formatter = $def->{'format'} || sub { shift };
+%
% my $part_svc_column = $part_svc->part_svc_column($field);
+% my $label = $part_svc_column->columnlabel || $def->{'label'};
% my $value = &$formatter($part_svc_column->columnvalue);
-% my $flag = $part_svc_column->columnflag;
+% my $flag = $part_svc_column->columnflag;
%
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
% $bgcolor = $bgcolor1;
% }
%
-% $html .= qq!<TR><TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">!.
-% ( $label || $field ).
+% $html .= qq!<TR><TD ROWSPAN=2 CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">!.
+% ( $def->{'label'} || $field ).
% "</TD>";
+%
+% $html .= qq!<TD ROWSPAN=2 CLASS="grid" BGCOLOR="$bgcolor"><INPUT NAME="${layer}__${field}_label" VALUE="!. encode_entities($label). '" STYLE="text-align:right"></TD>';
+%
% $flag = '' if $def->{type} eq 'disabled';
%
% $html .= qq!<TD CLASS="grid" BGCOLOR="$bgcolor">!;
%
% foreach my $f ( keys %flag ) {
%
+% # need to template-ize more httemplate/edit/svc_* first
+% next if $f eq 'M' and $layer !~ /^svc_(broadband|external|phone)$/;
+%
% #here is where the SUB from above is called, to skip some choices
% next if $flag{$f}->{condition}
% && &{ $flag{$f}->{condition} }( $def, $layer, $field );
% 'empty_label' => 'Select inventory class',
% );
%
+% } elsif ( $def->{type} eq 'checkbox' ) {
+%
+% $html .= include('/elements/checkbox.html',
+% 'field' => $layer.'__'.$field,
+% 'curr_value' => $value,
+% 'value' => 'Y',
+% );
+%
% } elsif ( $def->{type} eq 'select' ) {
%
% $html .= qq!<SELECT NAME="${layer}__${field}" $disabled!;
% if ( $def->{select_table} ) {
% foreach my $record ( qsearch( $def->{select_table}, {} ) ) {
% my $rvalue = $record->getfield($def->{select_key});
+% my $select_label = $def->{select_label};
% $html .= qq!<OPTION VALUE="$rvalue"!.
% (grep(/^$rvalue$/, split(',',$value)) ? ' SELECTED>' : '>' ).
-% $record->getfield($def->{select_label}). '</OPTION>';
+% $record->$select_label(). '</OPTION>';
% } #next $record
-% } else { # select_list
+% } elsif ( $def->{select_list} ) {
% foreach my $item ( @{$def->{select_list}} ) {
% $html .= qq!<OPTION VALUE="$item"!.
% (grep(/^$item$/, split(',',$value)) ? ' SELECTED>' : '>' ).
% $item. '</OPTION>';
% } #next $item
+% } elsif ( $def->{select_hash} ) {
+% if ( ref($def->{select_hash}) eq 'ARRAY' ) {
+% tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} };
+% $def->{select_hash} = \%hash;
+% }
+% foreach my $key ( keys %{$def->{select_hash}} ) {
+% $html .= qq!<OPTION VALUE="$key"!.
+% (grep(/^$key$/, split(',',$value)) ? ' SELECTED>' : '>' ).
+% $def->{select_hash}{$key}. '</OPTION>';
+% } #next $key
% } #endif
% $html .= '</SELECT>';
%
+% } elsif ( $def->{type} eq 'textarea' ) {
+%
+% $html .=
+% qq!<TEXTAREA NAME="${layer}__${field}">!. encode_entities($value).
+% '</TEXTAREA>';
+%
+% } elsif ( $def->{type} eq 'select-svc_pbx.html' ) {
+%
+% $html .= include('/elements/select-svc_pbx.html',
+% 'curr_value' => $value,
+% 'element_name' => "${layer}__${field}",
+% 'element_etc' => $disabled,
+% 'multiple' => ($flag eq 'S'),
+% );
+%
% } elsif ( $def->{type} eq 'radius_usergroup_selector' ) {
%
% #XXX disable the RADIUS usergroup selector? ugh it sure does need
% $html .= FS::svc_acct::radius_usergroup_selector(
% [ split(',', $value) ], "${layer}__${field}" );
%
+% } elsif ( $def->{type} eq 'communigate_pro-accessmodes' ) {
+%
+% $html .= include('/elements/communigate_pro-accessmodes.html',
+% 'element_name_prefix' => "${layer}__${field}_",
+% 'curr_value' => $value,
+% #doesn't work#'element_etc' => $disabled,
+% );
+%
% } elsif ( $def->{type} eq 'disabled' ) {
%
% $html .=
%
% } else {
%
-% $html .= '<font color="#ff0000">unknown type'. $def->{type};
+% $html .= '<font color="#ff0000">unknown type '. $def->{type};
%
% }
%
% $html .= "</TD></TR>\n";
+
+% $def_info = "($def_info)" if $def_info;
+% $html .=
+% qq!<TR>!.
+% qq! <TD COLSPAN=2 BGCOLOR="$bgcolor" ALIGN="center" !.
+% qq! STYLE="padding:0; border-top: none">!.
+% qq! <FONT SIZE="-1"><I>$def_info</I></FONT>!.
+% qq! </TD>!.
+% qq!</TR>\n!;
%
% } #foreach my $field (@fields) {
%