X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_device.pm;h=ac987400a7ac237db886cdbfced1168742a11d31;hp=49635841e453fbcfc64237621697821e314b4a63;hb=389b6f1116c3309c2ee57a6c295ed1a793503095;hpb=d0221fabd4656b3a04251ca6168cc45f54d23574 diff --git a/FS/FS/part_device.pm b/FS/FS/part_device.pm index 49635841e..ac987400a 100644 --- a/FS/FS/part_device.pm +++ b/FS/FS/part_device.pm @@ -38,8 +38,15 @@ primary key =item devicename -devicename +device name (used in Freeside) +=item inventory_classnum + +L used to track inventory of these devices. + +=item title + +external device name (for export) =back @@ -103,6 +110,8 @@ sub check { my $error = $self->ut_numbern('devicepart') || $self->ut_text('devicename') + || $self->ut_foreign_keyn('inventory_classnum', 'inventory_class', 'classnum') + || $self->ut_textn('title') ; return $error if $error; @@ -121,6 +130,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;