Optimize "Customer has a referring customer" condition, RT#74452
[freeside.git] / httemplate / view / svc_circuit.cgi
1 <& elements/svc_Common.html,
2   'table'       => 'svc_circuit',
3   'labels'      => \%labels,
4   'fields'      => \@fields,
5   'html_foot'   => sub { $self->call_method('.foot', @_) },
6   'edit_url'    => $fsurl.'edit/svc_circuit.html?',
7 &>
8 <%method .foot>
9 % my $svc_circuit = shift;
10 % my $link = [ 'svc_phone.cgi?', 'svcnum' ];
11 % if ( FS::svc_phone->count('circuit_svcnum = '.$svc_circuit->svcnum) ) {
12 <& /search/elements/search.html,
13
14   'title' => 'Provisioned phone services',
15   'name_singular' => 'phone number',
16   'query' => { 'table'      => 'svc_phone',
17                'hashref'    => { 'circuit_svcnum' => $svc_circuit->svcnum },
18                'addl_from'  => ' LEFT JOIN cust_svc USING (svcnum)'.
19                                ' LEFT JOIN part_svc USING (svcpart)',
20                'select'     => 'svc_phone.*, part_svc.*',
21              },
22   'count_query' => 'SELECT COUNT(*) FROM svc_phone WHERE circuit_svcnum = '.
23                     $svc_circuit->svcnum,
24   'header' => [ '#', 'Service', 'Phone number', ],
25   'fields' => [ 'svcnum', 'svc', 'phonenum' ],
26   'links'  => [ $link, $link, $link ],
27   'align'  => 'rlr',
28
29   'html_form' => '<SPAN CLASS="fsinnerbox-title">Phone services</SPAN>',
30   'nohtmlheader' => 1,
31   'disable_total' => 1,
32   'disable_maxselect' => 1,
33   'really_disable_download' => 1,
34 &>
35   <BR>
36 % }
37 </%method>
38 <%init>
39
40 my @fields = (
41   'circuit_id',
42   { field     => 'providernum',
43     type      => 'select-table',
44     table     => 'circuit_provider',
45     name_col  => 'provider',
46   },
47   { field     => 'typenum',
48     type      => 'select-table',
49     table     => 'circuit_type',
50     name_col  => 'typename',
51   },
52   { field     => 'termnum',
53     type      => 'select-table',
54     table     => 'circuit_termination',
55     name_col  => 'termination',
56   },
57   qw( vendor_qual_id vendor_order_id vendor_order_type vendor_order_status ),
58   { field     => 'desired_due_date', type => 'date' },
59   { field     => 'due_date', type => 'date' },
60   'endpoint_ip_addr',
61   { field     => 'endpoint_mac_addr', type => 'mac_addr' },
62   'internal_circuit_id',
63 );
64
65
66 my %labels = (
67   circuit_id          => 'Provider Circuit ID',
68   providernum         => 'Provider',
69   typenum             => 'Circuit type',
70   termnum             => 'Termination',
71   vendor_qual_id      => 'Qualification ID',
72   vendor_order_id     => 'Order ID',
73   vendor_order_type   => 'Order type',
74   vendor_order_status => 'Order status',
75   desired_due_date    => 'Desired due date',
76   due_date            => 'Due date',
77   endpoint_ip_addr    => 'Endpoint IP address',
78   endpoint_mac_addr   => 'MAC address',
79   internal_circuit_id => 'Internal Circuit Id',
80 );
81
82 my $self = $m->request_comp;
83 </%init>