From: Mark Wells Date: Thu, 26 Apr 2012 20:25:50 +0000 (-0700) Subject: better duplicate checking for ip address, #17515 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=88269174c839d6953f30e2f849bc60327dd10f07 better duplicate checking for ip address, #17515 --- diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 3894f65f8..d42b946f2 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2556,7 +2556,7 @@ sub tables_hashref { 'plan_id', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'svcnum', - 'unique' => [ [ 'mac_addr' ] ], + 'unique' => [ [ 'ip_addr' ], [ 'mac_addr' ] ], 'index' => [], }, diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 64cc3770e..82102697d 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -543,9 +543,9 @@ sub _check_ip_addr { sub _check_duplicate { my $self = shift; - - $self->lock_table; - + # Not a reliable check because the table isn't locked, but + # that's why we have a unique index. This is just to give a + # friendlier error message. my @dup; @dup = $self->find_duplicates('global', 'ip_addr'); if ( @dup ) {