add conditions for customer cancelled packages, RT#42043
[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                      FS::UI::Web::cust_header($cgi->param('cust_fields')),
14                    ],
15   'fields'      => [ 'svcnum',
16                      'oltname',
17                      sub { my $svc = shift;
18                            join('-', $svc->shelf, $svc->card, $svc->olt_port)
19                      },
20                      'ont_id',
21                      'ont_description',
22                      'ont_serial',
23                      \&FS::UI::Web::cust_fields,
24                    ],
25   'links'       => [ $link,
26                      '',
27                      '',
28                      $link,
29                      $link,
30                      $link,
31                      FS::UI::Web::cust_links($cgi->param('cust_fields')),
32                    ],
33   'align'       => 'rlllll'.  FS::UI::Web::cust_aligns(),
34   'color'       => [ 
35                      ('') x 6,
36                      FS::UI::Web::cust_colors(),
37                    ],
38   'style'       => [ 
39                      ('') x 6,
40                      FS::UI::Web::cust_styles(),
41                    ],
42
43 &>
44 <%init>
45
46 die "access denied" unless
47   $FS::CurrentUser::CurrentUser->access_right([ 'Services: Fiber',
48                                                 'List services'
49                                               ]);
50
51 my $conf = new FS::Conf;
52
53 my %search_hash;
54 if ( $cgi->param('magic') eq 'unlinked' ) {
55   %search_hash = ( 'unlinked' => 1 );
56 } else {
57   foreach (qw( custnum agentnum svcpart cust_fields
58                ont_typenum oltnum shelf olt_port card vlan )) {
59     $search_hash{$_} = $cgi->param($_) if defined($cgi->param($_));
60   }
61 }
62
63 my $query = FS::svc_fiber->search(\%search_hash);
64 $query->{addl_from} .= ' LEFT JOIN fiber_olt USING (oltnum) ';
65 $query->{select} .= ', oltname';
66
67 my $link = [ $p.'view/svc_fiber.cgi?', 'svcnum' ];
68
69 </%init>