diff options
| author | ivan <ivan> | 2009-07-07 09:23:20 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2009-07-07 09:23:20 +0000 | 
| commit | 75c3b711d30e566d4ec8dd8d8ed90926b22d4b15 (patch) | |
| tree | 74662a2412953ac02deafa5363bb0bdf43a2dbb5 /FS | |
| parent | 1350cca5dd7297a37fea8417a51d6a435635e32e (diff) | |
allow null svc_broadband.ip_addr
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/Conf.pm | 8 | ||||
| -rw-r--r-- | FS/FS/Schema.pm | 2 | ||||
| -rwxr-xr-x | FS/FS/svc_broadband.pm | 15 | 
3 files changed, 23 insertions, 2 deletions
| diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 12d6075b8..10f5d0449 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2835,6 +2835,14 @@ worry that config_items is freeside-specific and icky.      'type'        => 'text',    }, +  #more fine-grained, service def-level control could be useful eventually? +  { +    'key'         => 'svc_broadband-allow_null_ip_addr', +    'section'     => '', +    'description' => '', +    'type'        => 'checkbox', +  }, +    {      'key'         => 'tax-report_groups',      'section'     => '', diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 67ef612f3..19e1c66bc 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1763,7 +1763,7 @@ sub tables_hashref {          'blocknum', 'int', '', '', '', '',           'speed_up', 'int', '', '', '', '',           'speed_down', 'int', '', '', '', '',  -        'ip_addr', 'varchar', '', 15, '', '',  +        'ip_addr', 'varchar', 'NULL', 15, '', '',           'mac_addr', 'varchar', 'NULL', 12, '', '',           'authkey',  'varchar', 'NULL', 32, '', '',           'latitude', 'decimal', 'NULL', '', '', '',  diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 6007c7083..74cedfc77 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -246,7 +246,19 @@ sub check {      }    } +  $error = $self->_check_ip_addr; +  return $error if $error; + +  $self->SUPER::check; +} + +sub _check_ip_addr { +  my $self = shift; +    if (not($self->ip_addr) or $self->ip_addr eq '0.0.0.0') { + +    return '' if $conf->exists('svc_broadband-allow_null_ip_addr'); #&& !$self->blocknum +      return "Must supply either address or block"        unless $self->blocknum;      my $next_addr = $self->addr_block->next_free_addr; @@ -255,6 +267,7 @@ sub check {      } else {        return "No free addresses in addr_block (blocknum: ".$self->blocknum.")";      } +    }    if (not($self->blocknum)) { @@ -288,7 +301,7 @@ sub check {      return 'Router '.$router->routernum.' cannot provide svcpart '.$self->svcpart;    } -  $self->SUPER::check; +  '';  }  sub _check_duplicate { | 
