1 <& elements/svc_Common.html,
2 'table' => 'svc_phone',
5 'html_foot' => $html_foot,
9 my $conf = new FS::Conf;
10 my $countrydefault = $conf->config('countrydefault') || 'US';
12 my $fields = FS::svc_phone->table_info->{'fields'};
13 my %labels = map { $_ => ( ref($fields->{$_})
14 ? $fields->{$_}{'label'}
19 my @fields = qw( countrycode phonenum );
20 push @fields, 'domain' if $conf->exists('svc_phone-domain');
21 push @fields, qw( pbx_title sip_password pin phone_name forwarddst email );
23 if ( $conf->exists('svc_phone-lnp') ) {
24 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;
42 emt('E911 Information').
43 &ntable("#cccccc"). '<TR><TD>'. ntable("#cccccc",2).
44 '<TR><TD>'.emt('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
137 #XXX handle toll free too
139 my $search = "charged_party_or_src=";
141 my $cust_pkg = $svc_phone->cust_svc->cust_pkg;
145 #XXX handle voip_inbound too
147 my @part_pkg = grep { $_->plan eq 'voip_cdr' }
148 $cust_pkg->part_pkg->self_and_bill_linked;
150 foreach my $prefix (grep $_, map $_->option('default_prefix'), @part_pkg) {
151 $number .= ",$prefix$number";
154 $search = 'charged_party='
155 unless !@part_pkg || grep { ! $_->option('disable_src',1) } @part_pkg;
162 qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">).
166 my @ilinks = ( qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;dst=$number">).
167 'View incoming CDRs</A>' );
170 # concatenate & return
175 join(' | ', @links ). '<BR>'.
176 join(' | ', @ilinks). '<BR>';