From e87a701dd25a5d20218924057aa0d38def2eefc1 Mon Sep 17 00:00:00 2001 From: levinse Date: Sat, 22 Jan 2011 20:03:50 +0000 Subject: populate MAC address from inventory for svc_phone devices, RT7794 --- httemplate/misc/macinventory.cgi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 httemplate/misc/macinventory.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/macinventory.cgi b/httemplate/misc/macinventory.cgi new file mode 100644 index 000000000..b07da9726 --- /dev/null +++ b/httemplate/misc/macinventory.cgi @@ -0,0 +1,25 @@ +<% objToJson(\@macs) %> +<%init> + +# XXX: this should be agent-virtualized / limited + +my $devicepart = $cgi->param('arg'); + +die 'invalid devicepart' unless $devicepart =~ /^\d+$/; + +my $part_device = qsearchs('part_device', { 'devicepart' => $devicepart } ); +die "unknown devicepart $devicepart" unless $part_device; + +my $inventory_class = $part_device->inventory_class; +die "devicepart $devicepart has no inventory" unless $inventory_class; + +my @inventory_item = + qsearch('inventory_item', { 'classnum' => $inventory_class->classnum } ); + +my @macs; + +foreach my $inventory_item ( @inventory_item ) { + push @macs, $inventory_item->item; +} + + -- cgit v1.2.1