add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / svc_hardware.pm
index b28cc9e..dbb8b68 100644 (file)
@@ -1,10 +1,9 @@
 package FS::svc_hardware;
+use base qw( FS::svc_Common );
 
 use strict;
-use base qw( FS::svc_Common );
 use vars qw( $conf );
-use FS::Record qw( qsearch qsearchs );
-use FS::hardware_type;
+use FS::Record qw( qsearchs ); #qsearch qsearchs );
 use FS::hardware_status;
 use FS::Conf;
 
@@ -76,6 +75,7 @@ sub table_info {
     'name_plural'    => 'Hardware',
     'display_weight' => 59,
     'cancel_weight'  => 86,
+    'manual_require' => 1,
     'fields' => {
       'svcnum'    => { label => 'Service' },
       'typenum'   => { label => 'Device type',
@@ -84,6 +84,7 @@ sub table_info {
                        disable_fixed     => 1,
                        disable_default   => 1,
                        disable_inventory => 1,
+                       required => 1,
                      },
       'serial'    => { label => 'Serial number', %opts },
       'hw_addr'   => { label => 'Hardware address', %opts },
@@ -133,7 +134,17 @@ sub search_sql {
 
 sub label {
   my $self = shift;
-  $self->serial || $self->display_hw_addr;
+  my @label = ();
+  if (my $type = $self->hardware_type) {
+    push @label, 'Type:' . $type->description;
+  }
+  if (my $ser = $self->serial) {
+    push @label, 'Serial#' . $ser;
+  }
+  if (my $mac = $self->display_hw_addr) {
+    push @label, 'MAC:'. $mac;
+  }
+  return join(', ', @label);
 }
 
 =item insert
@@ -200,13 +211,6 @@ sub check {
 
 Returns the L<FS::hardware_type> object associated with this installation.
 
-=cut
-
-sub hardware_type {
-  my $self = shift;
-  return qsearchs('hardware_type', { 'typenum' => $self->typenum });
-}
-
 =item status_label
 
 Returns the 'label' field of the L<FS::hardware_status> object associated