1 <% include('elements/svc_Common.html',
2 'table' => 'svc_phone',
5 'countrycode' => 'Country code',
6 'phonenum' => 'Phone number',
9 'sip_password' => 'SIP password',
11 'phone_name' => 'Name',
13 'html_foot' => $html_foot,
18 my $conf = new FS::Conf;
19 my $countrydefault = $conf->config('countrydefault') || 'US';
21 my @fields = qw( countrycode phonenum );
22 push @fields, 'domain' if $conf->exists('svc_phone-domain');
23 push @fields, qw( pbx_title sip_password pin phone_name );
26 my $svc_phone = shift;
32 my $loc = $svc_phone->cust_location_or_main;
36 &ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
37 '<TR><TD>Location</TD>'.
38 '<TD BGCOLOR="#FFFFFF">'.
39 $loc->location_label( 'join_string' => '<BR>',
40 'double_space' => ' ',
41 'escape_function' => \&encode_entities,
42 'countrydefault' => $countrydefault,
45 '</TABLE></TD></TR></TABLE>'.
55 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;");
57 $sth->execute or die $sth->errstr;
58 my $num_part_device = $sth->fetchrow_arrayref->[0];
60 my @phone_device = $svc_phone->phone_device;
61 if ( @phone_device || $num_part_device ) {
62 my $svcnum = $svc_phone->svcnum;
64 qq[Devices (<A HREF="${p}edit/phone_device.html?svcnum=$svcnum">Add device</A>)<BR>];
65 if ( @phone_device ) {
69 function areyousure(href) {
70 if (confirm("Are you sure you want to delete this device?") == true)
71 window.location.href = href;
78 include('/elements/table-grid.html').
80 '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.
81 '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.
82 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
83 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
85 my $bgcolor1 = '#eeeeee';
86 my $bgcolor2 = '#ffffff';
89 foreach my $phone_device ( @phone_device ) {
91 if ( $bgcolor eq $bgcolor1 ) {
96 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
98 my $devicenum = $phone_device->devicenum;
99 my $export_links = join( '<BR>', @{ $phone_device->export_links } );
102 $td. $phone_device->part_device->devicename. '</TD>'.
103 $td. $phone_device->mac_addr. '</TD>'.
104 $td. $export_links. '</TD>'.
106 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
107 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
111 $devices .= '</TABLE><BR>';
120 tie my %what, 'Tie::IxHash',
125 #XXX src & charged party (& default prefix) as per voip_cdr.pm
126 #XXX handle toll free too
128 my $number = $svc_phone->phonenum;
129 $number = $svc_phone->countrycode. $number
130 unless $svc_phone->countrycode eq '1';
133 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
134 # "View $_ CDRs</A>";
137 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
141 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
142 'View incoming CDRs</A>' );
145 # concatenate & return
150 join(' | ', @links ). '<BR>'.
151 join(' | ', @ilinks). '<BR>';