projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2611973
)
get the dup checking right
author
jeff
<jeff>
Mon, 16 Mar 2009 08:08:44 +0000
(08:08 +0000)
committer
jeff
<jeff>
Mon, 16 Mar 2009 08:08:44 +0000
(08:08 +0000)
FS/FS/svc_broadband.pm
patch
|
blob
|
history
diff --git
a/FS/FS/svc_broadband.pm
b/FS/FS/svc_broadband.pm
index
d9a25b4
..
6007c70
100755
(executable)
--- 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 { '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.
=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;
;
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'; }
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;
}
$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
=item NetAddr
Returns a NetAddr::IP object containing the IP address of this service. The netmask