summaryrefslogtreecommitdiff
path: root/FS/FS/svc_broadband.pm
diff options
context:
space:
mode:
authorjeff <jeff>2009-03-16 08:08:44 +0000
committerjeff <jeff>2009-03-16 08:08:44 +0000
commit59a12152b6521065b8a2a82a48575445b6cd61d8 (patch)
treed1ac17176bffdc88f949d7522fb243c577639d9d /FS/FS/svc_broadband.pm
parent26119738eaf2b519d91c855c23986f873303887f (diff)
get the dup checking right
Diffstat (limited to 'FS/FS/svc_broadband.pm')
-rwxr-xr-xFS/FS/svc_broadband.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm
index d9a25b4..6007c70 100755
--- a/FS/FS/svc_broadband.pm
+++ b/FS/FS/svc_broadband.pm
@@ -111,6 +111,8 @@ sub table_info {
sub table { 'svc_broadband'; }
+sub table_dupcheck_fields { ( 'mac_addr' ); }
+
=item search_sql STRING
Class method which returns an SQL fragment to search for the given string.
@@ -218,10 +220,6 @@ sub check {
;
return $error if $error;
- #redundant, but better error message
- return "MAC already in use"
- if scalar( qsearch( 'svc_broadband', { 'mac_addr', $self->mac_addr } ) );
-
if($self->speed_up < 0) { return 'speed_up must be positive'; }
if($self->speed_down < 0) { return 'speed_down must be positive'; }
@@ -293,6 +291,18 @@ sub check {
$self->SUPER::check;
}
+sub _check_duplicate {
+ my $self = shift;
+
+ return "MAC already in use"
+ if ( $self->mac_addr &&
+ scalar( qsearch( 'svc_broadband', { 'mac_addr', $self->mac_addr } ) )
+ );
+
+ '';
+}
+
+
=item NetAddr
Returns a NetAddr::IP object containing the IP address of this service. The netmask