X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_device.pm;h=0f840a7bc6ed21808766a05dffdc663d8f315e93;hb=3c54c844c665ed108c7892a154fd3972fab1f3e5;hp=49635841e453fbcfc64237621697821e314b4a63;hpb=d0221fabd4656b3a04251ca6168cc45f54d23574;p=freeside.git diff --git a/FS/FS/part_device.pm b/FS/FS/part_device.pm index 49635841e..0f840a7bc 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) 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;