diff options
author | levinse <levinse> | 2011-01-22 20:03:50 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-01-22 20:03:50 +0000 |
commit | e87a701dd25a5d20218924057aa0d38def2eefc1 (patch) | |
tree | cff56e9aa5bccc7f75f93b98d4e778edb2c79d2d /httemplate/misc/macinventory.cgi | |
parent | 0259db6a5f67fa8837c18bbaed3e424cccf7a3e0 (diff) |
populate MAC address from inventory for svc_phone devices, RT7794
Diffstat (limited to 'httemplate/misc/macinventory.cgi')
-rw-r--r-- | httemplate/misc/macinventory.cgi | 25 |
1 files changed, 25 insertions, 0 deletions
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; +} + +</%init> |