summaryrefslogtreecommitdiff
path: root/FS/FS/part_device.pm
diff options
context:
space:
mode:
authorlevinse <levinse>2011-01-22 20:03:50 +0000
committerlevinse <levinse>2011-01-22 20:03:50 +0000
commite87a701dd25a5d20218924057aa0d38def2eefc1 (patch)
treecff56e9aa5bccc7f75f93b98d4e778edb2c79d2d /FS/FS/part_device.pm
parent0259db6a5f67fa8837c18bbaed3e424cccf7a3e0 (diff)
populate MAC address from inventory for svc_phone devices, RT7794
Diffstat (limited to 'FS/FS/part_device.pm')
-rw-r--r--FS/FS/part_device.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/FS/FS/part_device.pm b/FS/FS/part_device.pm
index 4963584..0f840a7 100644
--- a/FS/FS/part_device.pm
+++ b/FS/FS/part_device.pm
@@ -40,6 +40,7 @@ primary key
devicename
+=item inventory_classnum
=back
@@ -103,6 +104,7 @@ sub check {
my $error =
$self->ut_numbern('devicepart')
|| $self->ut_text('devicename')
+ || $self->ut_foreign_keyn('inventory_classnum', 'inventory_class', 'classnum')
;
return $error if $error;
@@ -121,6 +123,19 @@ sub part_export {
qsearch( 'export_device', { 'devicepart' => $self->devicepart } );
}
+=item inventory_class
+
+Returns the inventory class (see L<FS::inventory_class>) for this device,
+if any.
+
+=cut
+
+sub inventory_class {
+ my $self = shift;
+ return '' unless $self->inventory_classnum;
+ qsearchs('inventory_class', { 'classnum' => $self->inventory_classnum });
+}
+
sub process_batch_import {
my $job = shift;