diff options
| author | Mark Wells <mark@freeside.biz> | 2012-04-26 13:26:11 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-04-26 13:26:11 -0700 |
| commit | 03cd85038089d04b3cd68db559ce24696e0ffbba (patch) | |
| tree | 4c9e4bac3d2306028834964dd3ec9cde5070bd69 | |
| parent | f0e8baa6b05d1f71b76edcf19050a29218b7db60 (diff) | |
better duplicate checking for ip address, #17515
| -rw-r--r-- | FS/FS/Schema.pm | 2 | ||||
| -rwxr-xr-x | FS/FS/svc_broadband.pm | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index fdf29e0a0..a403af309 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2544,7 +2544,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 636ba1fd9..307493264 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -542,9 +542,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 ) { |
