X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_svc.cgi;h=b9474636dd8419192233a45b5e0c6141e4a010a2;hb=b9c9835fc3a990958b21bed560f1ff758735add0;hp=4c9b1bd957655a05e21a441510f64a015befc79a;hpb=e6ea57971831f25d682d97a0ba508c39b66ecd8b;p=freeside.git
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index 4c9b1bd95..b9474636d 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -1,18 +1,4 @@
-
-<%
-
-my %search;
-if ( $cgi->param('showdisabled') ) {
- %search = ();
-} else {
- %search = ( 'disabled' => '' );
-}
-
-my @part_svc = qsearch('part_svc', \%search );
-my $total = scalar(@part_svc);
-
-%>
-<%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %>
+<% include('/elements/header.html', 'Service Definition Listing') %>
- Services are items you offer to your customers.
-<%= $total %> services
-<%= $cgi->param('showdisabled')
+ Service definitions are the templates for items you offer to your customers.
+
+
+
+<% $total %> service definitions
+<% $cgi->param('showdisabled')
? do { $cgi->param('showdisabled', 0);
'( hide disabled services )'; }
: do { $cgi->param('showdisabled', 1);
'( show disabled services )'; }
%>
-<%= table() %>
-
- param('showdisabled') ? 2 : 3 %>>Service |
- Table |
- Export |
- Field |
- Modifier |
-
+% $cgi->param('showdisabled', ( 1 ^ $cgi->param('showdisabled') ) );
-<% foreach my $part_svc ( sort {
- $a->getfield('svcpart') <=> $b->getfield('svcpart')
- } @part_svc ) {
- my $hashref = $part_svc->hashref;
- my $svcdb = $hashref->{svcdb};
- my @dfields = fields($svcdb);
- push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge
- my @fields =
- grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag }
- @dfields;
-
- my $rowspan = scalar(@fields) || 1;
- my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}";
-%>
+<% include('/elements/table-grid.html') %>
+% my $bgcolor1 = '#eeeeee';
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor = '';
- >
- <%= $hashref->{svcpart} %> |
-<% unless ( $cgi->param('showdisabled') ) { %>
- >
- <%= $hashref->{disabled} ? 'DISABLED' : '' %> |
-<% } %>
- >
- <%= $hashref->{svc} %> |
- >
- <%= $hashref->{svcdb} %> |
- ><%= itable() %>
-<%
-# 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->exporttype %> to <%= $part_export->machine %> |
-<% } %>
-
-
-<% my($n1)='';
- foreach my $field ( @fields ) {
- my $flag = $part_svc->part_svc_column($field)->columnflag;
-%>
- <%= $n1 %><%= $field %> |
-<% if ( $flag eq "D" ) { print "Default"; }
- elsif ( $flag eq "F" ) { print "Fixed"; }
- else { print "(Unknown!)"; }
-%>
- | <%= $part_svc->part_svc_column($field)->columnvalue%> |
-<% $n1="";
- }
-%>
+ # |
+
+% 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;
+% }
+
- param('showdisabled') ? 7 : 8 %>>Add a new service definition |
+
+ 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 %>
+
+% # any alternate names of the service
+% my %msgcat = map { $_->locale => $_ } $part_svc->part_svc_msgcat;
+% my %labels = map { $_ => FS::Locales->description($_) } keys %msgcat;
+% my @locales = sort { $labels{$a} cmp $labels{$b} } keys %msgcat;
+% if ( @locales ) {
+
+
+% foreach my $locale (@locales) {
+ <% $labels{$locale} %>: <% $msgcat{$locale}->get('svc') %>
+
+% }
+
+% }
+ |
+
+ CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <% $svcdb %> |
+
+ CLASS="grid" BGCOLOR="<% $bgcolor %>">
+% my $svcurl_active = svc_url( 'ahref' => 1, 'm' => $m, 'action' => 'search', 'part_svc' => $part_svc, 'query' => "svcpart=". $part_svc->svcpart . "&cancelled=0");
+% my $svcurl_cancel = svc_url( 'ahref' => 1, 'm' => $m, 'action' => 'search', 'part_svc' => $part_svc, 'query' => "svcpart=". $part_svc->svcpart . "&cancelled=1");
+ <% $num_cust_svc_active{$part_svc->svcpart} %> <% $num_cust_svc_active{$part_svc->svcpart} ? $svcurl_active : '' %>active<% $num_cust_svc_active{$part_svc->svcpart} ? '' : '' %>
+% if ( $num_cust_svc_cancelled{$part_svc->svcpart} ) {
+ <% $num_cust_svc_cancelled{$part_svc->svcpart} %> <% $svcurl_cancel %>cancelled
+% }
+% if ( $num_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
+