<% include('/elements/header.html', 'Service Definition Listing') %> Service definitions are the templates for items you offer to your customers.

Add a new service definition % if ( @part_svc ) {  or  % }

<% $total %> service definitions <% $cgi->param('showdisabled') ? do { $cgi->param('showdisabled', 0); '( hide disabled services )'; } : do { $cgi->param('showdisabled', 1); '( show disabled services )'; } %> % $cgi->param('showdisabled', ( 1 ^ $cgi->param('showdisabled') ) ); <% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; # % if ( $cgi->param('showdisabled') ) { Status % } Service Table Customer
Services
Customer
Self-service
Export Field Label Modifier Required % my $conf = FS::Conf->new; % foreach my $part_svc ( @part_svc ) { % my $svcdb = $part_svc->svcdb; % my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } ); % my @dfields = $svc_x->fields; % push @dfields, 'usergroup' if $svcdb eq 'svc_acct' #double kludge % or ($svcdb eq 'svc_broadband' % and $conf->exists('svc_broadband-radius')); % my @fields = % grep { my $col = $part_svc->part_svc_column($_); % my $def = FS::part_svc->svc_table_fields($svcdb)->{$_}; % $svc_x->pvf($_) % or $_ ne 'svcnum' && ( % $col->columnflag || ( $col->columnlabel !~ /^\S*$/ % && $col->columnlabel ne $def->{'label'} % ) % || ( $col->required % && !$def->{'required'} % ) % ) % } % @dfields ; % my $rowspan = scalar(@fields) || 1; % $rowspan++ if $part_svc->restrict_edit_password; % my $url = "${p}edit/part_svc.cgi?". $part_svc->svcpart; % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { % $bgcolor = $bgcolor1; % } CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $part_svc->svcpart %> % if ( $cgi->param('showdisabled') ) { CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $part_svc->disabled ? 'Disabled' : 'Enabled' %> % } CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $part_svc->svc %> CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $svcdb %> CLASS="grid" BGCOLOR="<% $bgcolor %>"> <% $num_active_cust_svc{$part_svc->svcpart} %> <% $num_active_cust_svc{$part_svc->svcpart} ? svc_url( 'ahref' => 1, 'm' => $m, 'action' => 'search', 'part_svc' => $part_svc, 'query' => "svcpart=". $part_svc->svcpart ) : '' %>active % if ( $num_active_cust_svc{$part_svc->svcpart} ) {
[ change ] % } % tie my %selfservice_access, 'Tie::IxHash', #false laziness w/edit/part_svc.cgi % '' => 'Yes', % 'hidden' => 'Hidden', % 'readonly' => 'Read-only', % ; CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="center"> <% $selfservice_access{$part_svc->selfservice_access} %> CLASS="inv" BGCOLOR="<% $bgcolor %>"> % %# my @part_export = %map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export_svc', { svcpart => $part_svc->svcpart } ) ; % foreach my $part_export ( % map { qsearchs('part_export', { exportnum => $_->exportnum } ) } % qsearch('export_svc', { svcpart => $part_svc->svcpart } ) % ) { % % }
<% $part_export->label_html %>
% unless ( @fields ) { % for ( 1..5 ) { % } % } % % my($n1)=''; % foreach my $field ( sort @fields ) { % % #a few lines of false laziness w/edit/part_svc.cgi % my $def = FS::part_svc->svc_table_fields($svcdb)->{$field}; % 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 $flag = $part_svc_column->columnflag; <% $n1 %> <% $field %> <% $label %> <% $flag{$flag} %> % my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue); % if ( $flag =~ /^[MAH]$/ ) { % my $select_table = ($flag eq 'H') ? 'hardware_class' : 'inventory_class'; % foreach my $classnum ( split(',', $value) ) { % $select_class{$classnum} = % qsearchs($select_table, { 'classnum' => $classnum } ); % <% $select_class{$classnum} ? $select_class{$classnum}->classname : "WARNING: $select_table.classnum $classnum not found" %>
% } % } else { <% $value %> % } % if ($part_svc_column->required) { Yes % } % $n1=""; % } #foreach $field % if ( $part_svc->restrict_edit_password ) { <% emt('Password editing restricted.') %> % } % } #foreach $part_svc <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); #code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm my %flag = ( '' => '', 'D' => 'Default', 'F' => 'Fixed (unchangeable)', 'S' => 'Selectable choice', #'M' => 'Manual selection from inventory', 'M' => 'Manual selected from inventory', #'A' => 'Automatically fill in from inventory', 'A' => 'Automatically filled in from inventory', 'H' => 'Selected from hardware class', 'X' => 'Excluded', ); my %search; if ( $cgi->param('showdisabled') ) { %search = (); } else { %search = ( 'disabled' => '' ); } my @part_svc = sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') } qsearch('part_svc', \%search ); my $total = scalar(@part_svc); my %num_active_cust_svc = map { $_->svcpart => $_->num_cust_svc } @part_svc; if ( $cgi->param('orderby') eq 'active' ) { @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=> $num_active_cust_svc{$a->svcpart} } @part_svc; } elsif ( $cgi->param('orderby') eq 'svc' ) { @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc; } my %select_class = ();