add quick links for unprocessed and processed CDRs to svc_phone view
authorivan <ivan>
Sat, 29 Mar 2008 09:11:54 +0000 (09:11 +0000)
committerivan <ivan>
Sat, 29 Mar 2008 09:11:54 +0000 (09:11 +0000)
httemplate/view/elements/svc_Common.html
httemplate/view/svc_phone.cgi

index 0500248..b6d8e65 100644 (file)
@@ -84,6 +84,18 @@ Service #<B><% $svcnum %></B>
 </TABLE></TD></TR></TABLE>
 
 <BR>
 </TABLE></TD></TR></TABLE>
 
 <BR>
+
+% if ( defined($opt{'html_foot'}) ) {
+
+  <% ref($opt{'html_foot'})
+       ? &{ $opt{'html_foot'} }($svc_x)
+       : $opt{'html_foot'}
+  %>
+  <BR>
+
+% }
+
+
 <% joblisting({'svcnum'=>$svcnum}, 1) %>
 
 <% include('/elements/footer.html') %>
 <% joblisting({'svcnum'=>$svcnum}, 1) %>
 
 <% include('/elements/footer.html') %>
index f540555..8bd4dba 100644 (file)
@@ -1,10 +1,36 @@
 <% include('elements/svc_Common.html',
 <% include('elements/svc_Common.html',
-              'table'  => 'svc_phone',
-              'fields' => [qw( countrycode phonenum pin )],
-              'labels' => {
-                            'countrycode' => 'Country code',
-                            'phonenum'    => 'Phone number',
-                            'pin'         => 'PIN',
-                          },
-           )
+              'table'     => 'svc_phone',
+              'fields'    => [qw( countrycode phonenum pin )],
+              'labels'    => {
+                               'countrycode' => 'Country code',
+                               'phonenum'    => 'Phone number',
+                               'pin'         => 'PIN',
+                             },
+              'html_foot' => $html_foot,
+          )
 %>
 %>
+<%init>
+
+my $html_foot = sub {
+  my $svc_phone = shift;
+
+  tie my %what, 'Tie::IxHash',
+    'pending' => 'NULL',
+    'billed'  => 'done',
+  ;
+
+  #XXX src & charged party (& default prefix) as per voip_cdr.pm
+  #XXX handle toll free too
+
+  my $number = $svc_phone->phonenum;
+
+  my @links = map {
+    qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
+    "View $_ CDRs</A>";
+  } keys(%what);
+
+  join(' | ', @links). '<BR>';
+
+};
+
+</%init>