add unused_credit flag to edit/reason.html for cancel reasons, #27911
[freeside.git] / httemplate / search / phone_inventory_provisioned.html
1 <& elements/search.html,
2               'title'         => 'LATA Search Results',
3               'name_singular' => 'LATA',
4               'query'         => {
5                                    'table'   => 'phone_avail',
6                                    'hashref' => {},
7                                    'select'  => 'distinct latanum',
8                                  },
9               'count_query'   => 'SELECT COUNT(distinct latanum) FROM phone_avail',
10               'header'        => [ 
11                                    '#',
12                                    'LATA',
13                                    'Available',
14                                    'Provisioned',
15                                    'Have Usage',
16                                  ],
17               'fields'        => [
18                 'latanum',
19                 sub { # LATA Description
20                     my $phone_avail = shift;
21                     return '' unless $phone_avail->lata;
22                     $phone_avail->lata->description;
23                 },
24                 sub { # Available
25                     my $latanum = shift->latanum;
26                     my $cnt = qsearchs({ 'table'    => 'phone_avail',
27                                  'hashref'  => 
28                                     { 'svcnum' => '',
29                                       'latanum' => $latanum,
30                                     },
31                                  'select'   => 'count(1) as cnt',
32                           });
33                     ($cnt) ? $cnt->cnt : '';
34                 },
35                 sub { # Provisioned
36                     my $latanum = shift->latanum;
37                     my $cnt = qsearchs({   'table'     => 'phone_avail',
38                         'hashref'   => { 'latanum' => $latanum,
39                                          'svcnum' => { op => '>',
40                                                         value => '0'
41                                                      },
42                                         },
43                         'select'    => 'count(1) as cnt'
44                     });
45                     ($cnt) ? $cnt->cnt : '';
46                 },
47                 sub { # Have Usage
48                     my $phone_avail = shift;
49                     return '' unless $phone_avail->lata;
50                     $phone_avail->lata->have_usage;
51                 },
52               ],
53               'align'         => 'rlrrr',
54               'links'         => [
55                 '',
56                 '',
57                 '',
58                 '',
59                 '',
60               ],
61               'color' => [ 
62                            '',
63                            '',
64                            '',
65                            '',
66                            '',
67                          ],
68               'style' => [ 
69                            '',
70                            '',
71                            '',
72                            '',
73                            '',
74                          ],
75       
76 &>
77 <%init>
78
79 die "access denied"
80   unless ( $FS::CurrentUser::CurrentUser->access_right('List inventory')
81          && $FS::CurrentUser::CurrentUser->access_right('List services')
82          );
83
84 # XXX: agent virtualize
85
86 </%init>