projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
get the dup checking right
[freeside.git]
/
FS
/
FS
/
svc_broadband.pm
diff --git
a/FS/FS/svc_broadband.pm
b/FS/FS/svc_broadband.pm
index
eb29646
..
6007c70
100755
(executable)
--- a/
FS/FS/svc_broadband.pm
+++ b/
FS/FS/svc_broadband.pm
@@
-6,6
+6,7
@@
use FS::Record qw( qsearchs qsearch dbh );
use FS::svc_Common;
use FS::cust_svc;
use FS::addr_block;
use FS::svc_Common;
use FS::cust_svc;
use FS::addr_block;
+use FS::part_svc_router;
use NetAddr::IP;
@ISA = qw( FS::svc_Common );
use NetAddr::IP;
@ISA = qw( FS::svc_Common );
@@
-110,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.
@@
-217,10
+220,6
@@
sub check {
;
return $error if $error;
;
return $error if $error;
- #redundant, but prevents further problems until column constraint in place
- 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'; }
@@
-292,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