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;
34 &ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
35 '<TR><TD>Location</TD>'.
36 '<TD BGCOLOR="#FFFFFF">'.
37 $svc_phone->location_label( 'join_string' => '<BR>',
38 'double_space' => ' ',
39 'escape_function' => \&encode_entities,
40 'countrydefault' => $countrydefault,
43 '</TABLE></TD></TR></TABLE>'.
53 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;");
55 $sth->execute or die $sth->errstr;
56 my $num_part_device = $sth->fetchrow_arrayref->[0];
58 my @phone_device = $svc_phone->phone_device;
59 if ( @phone_device || $num_part_device ) {
60 my $svcnum = $svc_phone->svcnum;
62 qq[Devices (<A HREF="${p}edit/phone_device.html?svcnum=$svcnum">Add device</A>)<BR>];
63 if ( @phone_device ) {
67 function areyousure(href) {
68 if (confirm("Are you sure you want to delete this device?") == true)
69 window.location.href = href;
76 include('/elements/table-grid.html').
78 '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.
79 '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.
80 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
81 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
83 my $bgcolor1 = '#eeeeee';
84 my $bgcolor2 = '#ffffff';
87 foreach my $phone_device ( @phone_device ) {
89 if ( $bgcolor eq $bgcolor1 ) {
94 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
96 my $devicenum = $phone_device->devicenum;
97 my $export_links = join( '<BR>', @{ $phone_device->export_links } );
100 $td. $phone_device->part_device->devicename. '</TD>'.
101 $td. $phone_device->mac_addr. '</TD>'.
102 $td. $export_links. '</TD>'.
104 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
105 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
109 $devices .= '</TABLE><BR>';
118 tie my %what, 'Tie::IxHash',
123 #XXX src & charged party (& default prefix) as per voip_cdr.pm
124 #XXX handle toll free too
126 my $number = $svc_phone->phonenum;
127 $number = $svc_phone->countrycode. $number
128 unless $svc_phone->countrycode eq '1';
131 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
132 # "View $_ CDRs</A>";
135 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;charged_party=$number;freesidestatus=$what{$_}">).
139 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
140 'View incoming CDRs</A>' );
143 # concatenate & return
148 join(' | ', @links ). '<BR>'.
149 join(' | ', @ilinks). '<BR>';