[freeside-commits] freeside/FS/FS svc_broadband.pm,1.19,1.20
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Mar 16 01:08:47 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12650
Modified Files:
svc_broadband.pm
Log Message:
get the dup checking right
Index: svc_broadband.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_broadband.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- svc_broadband.pm 16 Mar 2009 04:22:42 -0000 1.19
+++ svc_broadband.pm 16 Mar 2009 08:08:44 -0000 1.20
@@ -111,6 +111,8 @@
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 @@
;
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 @@
$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
More information about the freeside-commits
mailing list