X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_svc.cgi;h=b9474636dd8419192233a45b5e0c6141e4a010a2;hb=0bca43616911f2b48d9a0617e70a3bf0f30b92db;hp=0d36853557b1097b3297a74d05e00da58cbcbb9e;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;p=freeside.git diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 0d3685355..b9474636d 100755 --- a/httemplate/browse/part_svc.cgi +++ b/httemplate/browse/part_svc.cgi @@ -61,6 +61,8 @@ function part_export_areyousure(href) { Modifier + Required + % my $conf = FS::Conf->new; % foreach my $part_svc ( @part_svc ) { @@ -78,6 +80,9 @@ function part_export_areyousure(href) { % $col->columnflag || ( $col->columnlabel !~ /^\S*$/ % && $col->columnlabel ne $def->{'label'} % ) +% || ( $col->required +% && !$def->{'required'} +% ) % ) % } % @dfields ; @@ -107,16 +112,36 @@ 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} ) { +% 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 ] % } @@ -150,13 +175,13 @@ function part_export_areyousure(href) { % unless ( @fields ) { -% for ( 1..4 ) { +% for ( 1..5 ) { % } % } % % 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}; @@ -170,7 +195,6 @@ function part_export_areyousure(href) { <% $field %> <% $label %> <% $flag{$flag} %> - % my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue); % if ( $flag =~ /^[MAH]$/ ) { @@ -189,6 +213,11 @@ function part_export_areyousure(href) { % } + +% if ($part_svc_column->required) { + Yes +% } + % $n1=""; % } #foreach $field % if ( $part_svc->restrict_edit_password ) { @@ -236,11 +265,25 @@ 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; +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; }