From 10407ce25bbd219fa4df3bbf1f2c807e45eb9026 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Oct 2011 07:00:03 +0000 Subject: [PATCH] (refactor svc_phone to use elements/svc_devices.html) add dsl_device to track mac addresses, RT#13656 --- httemplate/view/svc_phone.cgi | 67 +++---------------------------------------- 1 file changed, 4 insertions(+), 63 deletions(-) diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi index ffb6fcc4a..0369d5c12 100644 --- a/httemplate/view/svc_phone.cgi +++ b/httemplate/view/svc_phone.cgi @@ -56,69 +56,10 @@ my $html_foot = sub { ### # Devices ### - - my $devices = ''; - - my $sth = dbh->prepare("SELECT COUNT(*) FROM part_device") #WHERE disabled = '' OR disabled IS NULL;"); - or die dbh->errstr; - $sth->execute or die $sth->errstr; - my $num_part_device = $sth->fetchrow_arrayref->[0]; - - my @phone_device = $svc_phone->phone_device; - if ( @phone_device || $num_part_device ) { - my $svcnum = $svc_phone->svcnum; - $devices .= - qq[Devices (Add device)
]; - if ( @phone_device ) { - - $devices .= qq! - - !; - - - $devices .= - include('/elements/table-grid.html'). - ''. - 'Type'. - 'MAC Addr'. - ''. - ''. - ''; - my $bgcolor1 = '#eeeeee'; - my $bgcolor2 = '#ffffff'; - my $bgcolor = ''; - - foreach my $phone_device ( @phone_device ) { - - if ( $bgcolor eq $bgcolor1 ) { - $bgcolor = $bgcolor2; - } else { - $bgcolor = $bgcolor1; - } - my $td = qq(); - - my $devicenum = $phone_device->devicenum; - my $export_links = join( '
', @{ $phone_device->export_links } ); - - $devices .= ''. - $td. $phone_device->part_device->devicename. ''. - $td. $phone_device->mac_addr. ''. - $td. $export_links. ''. - "$td( ". - qq(edit | ). - qq(delete). - ' )'. - ''; - } - $devices .= '
'; - } - $devices .= '
'; - } + my $devices = include('elements/svc_devices.html', + 'svc_x' => $svc_phone, + 'table' => 'phone_device', + ); ## # CDR links -- 2.11.0