1 <% include('elements/svc_Common.html',
2 'table' => 'svc_phone',
5 'html_foot' => $html_foot,
10 my $conf = new FS::Conf;
11 my $countrydefault = $conf->config('countrydefault') || 'US';
13 my $fields = FS::svc_phone->table_info->{'fields'};
14 my %labels = map { $_ => ( ref($fields->{$_})
15 ? $fields->{$_}{'label'}
20 my @fields = qw( countrycode phonenum );
21 push @fields, 'domain' if $conf->exists('svc_phone-domain');
22 push @fields, qw( pbx_title sip_password pin phone_name );
24 if ( $conf->exists('svc_phone-lnp') ) {
25 push @fields, 'lnp_status',
26 { field => 'portable', type => 'checkbox', },
28 { field => 'lnp_desired_due_date', type => 'date', },
29 { field => 'lnp_due_date', type => 'date', },
31 'lnp_other_provider_account';
35 my $svc_phone = shift;
43 &ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
44 '<TR><TD>Location</TD>'.
45 '<TD BGCOLOR="#FFFFFF">'.
46 $svc_phone->location_label( 'join_string' => '<BR>',
47 'double_space' => ' ',
48 'escape_function' => \&encode_entities,
49 'countrydefault' => $countrydefault,
52 '</TABLE></TD></TR></TABLE>'.
62 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;");
64 $sth->execute or die $sth->errstr;
65 my $num_part_device = $sth->fetchrow_arrayref->[0];
67 my @phone_device = $svc_phone->phone_device;
68 if ( @phone_device || $num_part_device ) {
69 my $svcnum = $svc_phone->svcnum;
71 qq[Devices (<A HREF="${p}edit/phone_device.html?svcnum=$svcnum">Add device</A>)<BR>];
72 if ( @phone_device ) {
76 function areyousure(href) {
77 if (confirm("Are you sure you want to delete this device?") == true)
78 window.location.href = href;
85 include('/elements/table-grid.html').
87 '<TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>'.
88 '<TH CLASS="grid" BGCOLOR="#cccccc">MAC Addr</TH>'.
89 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
90 '<TH CLASS="grid" BGCOLOR="#cccccc"></TH>'.
92 my $bgcolor1 = '#eeeeee';
93 my $bgcolor2 = '#ffffff';
96 foreach my $phone_device ( @phone_device ) {
98 if ( $bgcolor eq $bgcolor1 ) {
101 $bgcolor = $bgcolor1;
103 my $td = qq(<TD CLASS="grid" BGCOLOR="$bgcolor">);
105 my $devicenum = $phone_device->devicenum;
106 my $export_links = join( '<BR>', @{ $phone_device->export_links } );
109 $td. $phone_device->part_device->devicename. '</TD>'.
110 $td. $phone_device->mac_addr. '</TD>'.
111 $td. $export_links. '</TD>'.
113 qq(<A HREF="${p}edit/phone_device.html?$devicenum">edit</A> | ).
114 qq(<A HREF="javascript:areyousure('${p}misc/delete-phone_device.html?$devicenum')">delete</A>).
118 $devices .= '</TABLE><BR>';
127 tie my %what, 'Tie::IxHash',
132 my $number = $svc_phone->phonenum;
133 $number = $svc_phone->countrycode. $number
134 unless $svc_phone->countrycode eq '1';
136 #src & charged party as per voip_cdr.pm
138 my $cust_pkg = $svc_phone->cust_svc->cust_pkg;
139 if ( $cust_pkg && $cust_pkg->part_pkg->option('disable_src') ) {
140 $search = "charged_party=$number";
142 $search = "charged_party_or_src=$number";
145 #XXX default prefix as per voip_cdr.pm
146 #XXX handle toll free too
149 # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
150 # "View $_ CDRs</A>";
153 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">).
157 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
158 'View incoming CDRs</A>' );
161 # concatenate & return
166 join(' | ', @links ). '<BR>'.
167 join(' | ', @ilinks). '<BR>';