X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_svc.cgi;h=8b596752f814ebd7fe959fed66d24103cfc0752f;hp=82b1150cc975b5cf68ad3fc96444603fd851c84e;hb=3f2a7b01b59902faed5767d81e2959e131bdbdfd;hpb=5ac9e46a92f4eefd795f97643f3e8f62ec1a2b26 diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 82b1150cc..8b596752f 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -51,6 +51,8 @@ function part_export_areyousure(href) { Customer
Services
+ Customer
Self-service
+ Export Field @@ -59,13 +61,16 @@ function part_export_areyousure(href) { Modifier - + Required + % 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'; #kludge +% 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)->{$_}; @@ -74,10 +79,14 @@ function part_export_areyousure(href) { % $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 ) { @@ -102,21 +111,49 @@ function part_export_areyousure(href) { % } - CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $part_svc->svc %> + 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 %>"> - <% $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 ] +% 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} || $disable_counts ? $svcurl_active : '' %>active<% $num_cust_svc_active{$part_svc->svcpart} || $disable_counts ? '' : '' %> +% if ( $num_cust_svc_cancelled{$part_svc->svcpart} || $disable_counts ) { +
<% $num_cust_svc_cancelled{$part_svc->svcpart} %> <% $svcurl_cancel %>cancelled +% } +% if ( $num_cust_svc{$part_svc->svcpart} || $disable_counts ) { +
[ 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 %>"> % @@ -129,16 +166,7 @@ function part_export_areyousure(href) { % - + % } @@ -146,13 +174,13 @@ function part_export_areyousure(href) { % unless ( @fields ) { -% for ( 1..4 ) { +% for ( 1..5 ) { - + % $n1=""; -% } -% +% } #foreach $field +% if ( $part_svc->restrict_edit_password ) { + + + +% } -% } +% } #foreach $part_svc
-<% $part_export->exportnum %>:  -% if ($part_export->exportname) { -<% $part_export->exportname %> ( -% } -<% $part_export->exporttype %> to <% $part_export->machine %> -% if ($part_export->exportname) { -) -% } -<% $part_export->label_html %>
% } % } % % my($n1)=''; -% foreach my $field ( @fields ) { +% 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}; @@ -166,29 +194,41 @@ function part_export_areyousure(href) { <% $field %> <% $label %> <% $flag{$flag} %> % my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue); -% if ( $flag =~ /^[MA]$/ ) { -% $inventory_class{$value} -% ||= qsearchs('inventory_class', { 'classnum' => $value } ); -% - - <% $inventory_class{$value} - ? $inventory_class{$value}->classname - : "WARNING: inventory_class.classnum $value not found" %> +% 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 +% } +
+ <% emt('Password editing restricted.') %> +
@@ -198,6 +238,9 @@ function part_export_areyousure(href) { die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $conf = FS::Conf->new; +my $disable_counts = $conf->exists('config-disable_counts') ? 1 : 0; + #code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm my %flag = ( '' => '', @@ -208,7 +251,9 @@ my %flag = ( 'M' => 'Manual selected from inventory', #'A' => 'Automatically fill in from inventory', 'A' => 'Automatically filled in from inventory', + 'H' => 'Selected from hardware class', 'X' => 'Excluded', + 'P' => 'From package 477 information', ); my %search; @@ -223,15 +268,32 @@ my @part_svc = qsearch('part_svc', \%search ); my $total = scalar(@part_svc); -my %num_active_cust_svc = map { $_->svcpart => $_->num_cust_svc } @part_svc; +## The Active/Cancelled distinction is a bit awkward, +## active currently includes unattached and suspended services, +## but we've previously referred to EVERY existing cust_svc as "Active", +## and we don't really want to know numbers by individual package status, +## so for now the UI will distinguish these as "Active" and "Cancelled", +## but please let's not go so far as to introduce the idea of "Service Status" + +my %num_cust_svc_active; +my %num_cust_svc_cancelled; +my %num_cust_svc; + +unless ( $disable_counts ) { + foreach my $part_svc (@part_svc) { + $num_cust_svc{$part_svc->svcpart} = $part_svc->num_cust_svc; + $num_cust_svc_cancelled{$part_svc->svcpart} = $part_svc->num_cust_svc_cancelled; + $num_cust_svc_active{$part_svc->svcpart} = $num_cust_svc{$part_svc->svcpart} - $num_cust_svc_cancelled{$part_svc->svcpart}; + } +} if ( $cgi->param('orderby') eq 'active' ) { - @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=> - $num_active_cust_svc{$a->svcpart} } @part_svc; + @part_svc = sort { $num_cust_svc{$b->svcpart} <=> + $num_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 %inventory_class = (); +my %select_class = ();