invoice_sections_with_taxes per-agent, RT#79636
[freeside.git] / httemplate / search / svc_fiber.html
1 <& elements/svc_Common.html,
2   'title'       => 'Fiber Search Results',
3   'name'        => 'fiber services',
4   'query'       => $query,
5   'count_query' => $query->{'count_query'},
6   'redirect'    => $link,
7   'header'      => [ '#',
8                      'OLT',
9                      'Shelf/Card/Port',
10                      'ONT',
11                      'Model',
12                      'Serial',
13                      emt('Pkg. Status'),
14                      FS::UI::Web::cust_header($cgi->param('cust_fields')),
15                    ],
16   'fields'      => [ 'svcnum',
17                      'oltname',
18                      sub { my $svc = shift;
19                            join('-', $svc->shelf, $svc->card, $svc->olt_port)
20                      },
21                      'ont_id',
22                      'ont_description',
23                      'ont_serial',
24                      sub {
25                        $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
26                        return '' unless $cust_pkg_cache{$_[0]->svcnum};
27                        $cust_pkg_cache{$_[0]->svcnum}->ucfirst_status
28                      },
29                      \&FS::UI::Web::cust_fields,
30                    ],
31   'links'       => [ $link,
32                      '',
33                      '',
34                      $link,
35                      $link,
36                      $link,
37                      '', # pkg status
38                      FS::UI::Web::cust_links($cgi->param('cust_fields')),
39                    ],
40   'align'       => 'rlllllr'.  FS::UI::Web::cust_aligns(),
41   'color'       => [ 
42                      ('') x 6,
43                      sub {
44                        $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg;
45                        return '' unless $cust_pkg_cache{$_[0]->svcnum};
46                        my $c = FS::cust_pkg::statuscolors;
47                        $c->{$cust_pkg_cache{$_[0]->svcnum}->status };
48                      }, # pkg status
49                      FS::UI::Web::cust_colors(),
50                    ],
51   'style'       => [ 
52                      ('') x 6,
53                      'b',
54                      FS::UI::Web::cust_styles(),
55                    ],
56
57 &>
58 <%init>
59
60 die "access denied" unless
61   $FS::CurrentUser::CurrentUser->access_right([ 'Services: Fiber',
62                                                 'List services'
63                                               ]);
64
65 my %cust_pkg_cache;
66
67 my $conf = new FS::Conf;
68
69 my %search_hash;
70 if ( $cgi->param('magic') eq 'unlinked' ) {
71   %search_hash = ( 'unlinked' => 1 );
72 } else {
73   foreach (qw( custnum agentnum svcpart cust_fields
74                ont_typenum oltnum shelf olt_port card vlan )) {
75     $search_hash{$_} = $cgi->param($_) if defined($cgi->param($_));
76   }
77   if ( defined($cgi->param('cancelled')) ) {
78     $search_hash{'cancelled'} = $cgi->param('cancelled') ? 1 : 0;
79   }
80 }
81
82 my $query = FS::svc_fiber->search(\%search_hash);
83 $query->{addl_from} .= ' LEFT JOIN fiber_olt USING (oltnum) ';
84 $query->{select} .= ', oltname';
85
86 my $link = [ $p.'view/svc_fiber.cgi?', 'svcnum' ];
87
88 </%init>