X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_hardware.pm;h=dc9ac59dfc07ea37b7dff3a125d6bbad77b9bc07;hb=d353c1f9bbfee93e96219851af27a78f56837c50;hp=96502e41e0e5b29dd50ff998c0ae9b118a4711f9;hpb=1d0f88642d94e7bbc4861c7c08290967794883b3;p=freeside.git diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm index 96502e41e..dc9ac59df 100644 --- a/FS/FS/svc_hardware.pm +++ b/FS/FS/svc_hardware.pm @@ -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; @@ -105,9 +104,13 @@ sub search_sql { my ($class, $string) = @_; my @where = (); - my $ip = NetAddr::IP->new($string); - if ( $ip ) { - push @where, $class->search_sql_field('ip_addr', $ip->addr); + if ( $string =~ /^[\d\.:]+$/ ) { + # if the string isn't an IP address, this will waste several seconds + # attempting a DNS lookup. so try to filter those out. + my $ip = NetAddr::IP->new($string); + if ( $ip ) { + push @where, $class->search_sql_field('ip_addr', $ip->addr); + } } if ( $string =~ /^(\w+)$/ ) { @@ -196,13 +199,6 @@ sub check { Returns the L 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 object associated