X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fsvc_broadband.cgi;h=53a0aa09769791cdbbde5028d142fb9843676bd1;hp=8366d214bad428ce1dffb62898704e67c65ebd3d;hb=266e0c3c894568fb06a15dfbcf4a4eb9bc6989b3;hpb=c2e126583354b58ef54ffa7f580b115b8eed1dd3 diff --git a/httemplate/search/svc_broadband.cgi b/httemplate/search/svc_broadband.cgi index 8366d214b..53a0aa097 100755 --- a/httemplate/search/svc_broadband.cgi +++ b/httemplate/search/svc_broadband.cgi @@ -10,6 +10,8 @@ 'Router', @tower_header, 'IP Address', + @header_pkg, + emt('Pkg. Status'), FS::UI::Web::cust_header($cgi->param('cust_fields')), ], 'fields' => [ 'svcnum', @@ -20,25 +22,43 @@ }, @tower_fields, 'ip_addr', + @fields_pkg, + sub { + $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg; + return '' unless $cust_pkg_cache{$_[0]->svcnum}; + $cust_pkg_cache{$_[0]->svcnum}->ucfirst_status + }, \&FS::UI::Web::cust_fields, ], 'links' => [ $link, $link, '', #$link_router, (map '', @tower_fields), - $link, + $link, # ip_addr + @blank_pkg, + '', # pkg status ( map { $_ ne 'Cust. Status' ? $link_cust : '' } FS::UI::Web::cust_header($cgi->param('cust_fields')) ), ], - 'align' => 'rll'.('r' x @tower_fields).'r'. + 'align' => 'rll'.('r' x @tower_fields). + 'r'. # ip_addr + $align_pkg. + 'r'. # pkg status FS::UI::Web::cust_aligns(), 'color' => [ '', '', '', (map '', @tower_fields), - '', + '', # ip_addr + @blank_pkg, + sub { + $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg; + return '' unless $cust_pkg_cache{$_[0]->svcnum}; + my $c = FS::cust_pkg::statuscolors; + $c->{$cust_pkg_cache{$_[0]->svcnum}->status }; + }, # pkg status FS::UI::Web::cust_colors(), ], 'style' => [ @@ -46,7 +66,9 @@ '', '', (map '', @tower_fields), - '', + '', # ip_addr + @blank_pkg, + 'b', # pkg status FS::UI::Web::cust_styles(), ], @@ -56,19 +78,25 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List services'); +my %cust_pkg_cache; + my $conf = new FS::Conf; +$m->comp('/elements/handle_uri_query'); + my %search_hash; if ( $cgi->param('magic') eq 'unlinked' ) { %search_hash = ( 'unlinked' => 1 ); -} -else { - foreach (qw(custnum agentnum svcpart)) { +} else { + foreach (qw( custnum agentnum svcpart cust_fields )) { $search_hash{$_} = $cgi->param($_) if $cgi->param($_); } foreach (qw(pkgpart routernum towernum sectornum)) { $search_hash{$_} = [ $cgi->param($_) ] if $cgi->param($_); } + if ( defined($cgi->param('cancelled')) ) { + $search_hash{'cancelled'} = $cgi->param('cancelled') ? 1 : 0; + } } if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { @@ -107,4 +135,39 @@ my $html_init = include('/elements/email-link.html', 'table' => 'svc_broadband' ); +my $query = $m->scomp('/elements/create_uri_query'); + +$html_init .= ' | ' . + '' . emt('View a map of these services') . ''; + +my (@header_pkg,@fields_pkg,@blank_pkg); +my $align_pkg = ''; +#false laziness with search/svc_acct.cgi +$cgi->param('cust_pkg_fields') =~ /^([\w\,]*)$/ or die "bad cust_pkg_fields"; +my @pkg_fields = split(',', $1); +foreach my $pkg_field ( @pkg_fields ) { + ( my $header = ucfirst($pkg_field) ) =~ s/_/ /; #:/ + push @header_pkg, $header; + + #not the most efficient to do it every field, but this is of niche use. so far + push @fields_pkg, sub { my $svc_x = shift; + my $cust_pkg = $svc_x->cust_svc->cust_pkg or return ''; + my $value; + if ($pkg_field eq 'package') { + $value = $cust_pkg->part_pkg->pkg; + #$value = $cust_pkg->pkg_label; + } + else { + $value = $cust_pkg->get($pkg_field);#closures help alot + $value ? time2str('%b %d %Y', $value ) : ''; + } + }; + + push @blank_pkg, ''; + $align_pkg .= 'c'; +} + +