package definition browse/search, filter by package class, RT#5255
[freeside.git] / httemplate / view / svc_phone.cgi
1 <% include('elements/svc_Common.html',
2               'table'     => 'svc_phone',
3               'fields'    => [qw(
4                                   countrycode
5                                   phonenum
6                                   sip_password
7                                   pin
8                                   phone_name
9                              )],
10               'labels'    => {
11                                'countrycode'  => 'Country code',
12                                'phonenum'     => 'Phone number',
13                                'sip_password' => 'SIP password',
14                                'pin'          => 'PIN',
15                                'phone_name'   => 'Name',
16                              },
17               'html_foot' => $html_foot,
18           )
19 %>
20 <%init>
21
22 my $html_foot = sub {
23   my $svc_phone = shift;
24
25   tie my %what, 'Tie::IxHash',
26     'pending' => 'NULL',
27     'billed'  => 'done',
28   ;
29
30   #XXX src & charged party (& default prefix) as per voip_cdr.pm
31   #XXX handle toll free too
32
33   my $number = $svc_phone->phonenum;
34   $number = $svc_phone->countrycode. $number
35     unless $svc_phone->countrycode eq '1';
36
37   #my @links = map {
38   #  qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
39   #  "View $_ CDRs</A>";
40   #} keys(%what);
41   my @links = map {
42     qq(<A HREF="${p}search/cdr.html?cdrbatch=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
43     "View $_ CDRs</A>";
44   } keys(%what);
45
46   my @ilinks = ( qq(<A HREF="${p}search/cdr.html?dst=$number">).
47                  'View incoming CDRs</A>' );
48
49   join(' | ', @links ). '<BR>'.
50   join(' | ', @ilinks). '<BR>';
51
52 };
53
54 </%init>