add quick links for unprocessed and processed CDRs to svc_phone view
[freeside.git] / httemplate / view / svc_phone.cgi
1 <% include('elements/svc_Common.html',
2               'table'     => 'svc_phone',
3               'fields'    => [qw( countrycode phonenum pin )],
4               'labels'    => {
5                                'countrycode' => 'Country code',
6                                'phonenum'    => 'Phone number',
7                                'pin'         => 'PIN',
8                              },
9               'html_foot' => $html_foot,
10           )
11 %>
12 <%init>
13
14 my $html_foot = sub {
15   my $svc_phone = shift;
16
17   tie my %what, 'Tie::IxHash',
18     'pending' => 'NULL',
19     'billed'  => 'done',
20   ;
21
22   #XXX src & charged party (& default prefix) as per voip_cdr.pm
23   #XXX handle toll free too
24
25   my $number = $svc_phone->phonenum;
26
27   my @links = map {
28     qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
29     "View $_ CDRs</A>";
30   } keys(%what);
31
32   join(' | ', @links). '<BR>';
33
34 };
35
36 </%init>