X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Ftr-select-router_block_ip.html;h=95d1787b85565d39ed3f79b356f1fc37610bb3c4;hb=acbc4a9ff91b668197012772172af24b9cc42df6;hp=45d1dacd873451798882ba2f67e6e0b8d2698a04;hpb=97830d790f335a46aae8a03235b19177169d1bb2;p=freeside.git diff --git a/httemplate/elements/tr-select-router_block_ip.html b/httemplate/elements/tr-select-router_block_ip.html index 45d1dacd8..95d1787b8 100644 --- a/httemplate/elements/tr-select-router_block_ip.html +++ b/httemplate/elements/tr-select-router_block_ip.html @@ -1,14 +1,33 @@ <& /elements/tr-td-label.html, label => ($opt{'label'} || 'Router') &> @@ -19,7 +38,7 @@ function hide_if_auto_addr(obj, i) { records => \@routers, name_col => 'routername', value_col => 'routernum', - onchange => 'hide_if_auto_addr', + onchange => 'update_ip_addr', curr_value=> $opt{'routernum'}, }, { @@ -31,6 +50,7 @@ function hide_if_auto_addr(obj, i) { name_col => 'cidr', link_col => 'routernum', empty_label => '(any)', + onchange => 'update_ip_addr', curr_value => $opt{'blocknum'}, }, ] @@ -44,17 +64,17 @@ function hide_if_auto_addr(obj, i) { % } % else { + value="<% $opt{'ip_addr'} |h%>" onfocus="clearhint_ip_addr(this)"> % } - <% $opt{'ip_addr'} || '' %> - (automatic) <%init> + my %opt = @_; my @routers; +my $conf = FS::Conf->new; my $svc_x = $opt{'object'}; if ( $svc_x ) { @@ -91,5 +111,17 @@ else { @routers = qsearch('router', {}); } -my %auto_addr_routernum = map { $_->routernum, $_->auto_addr } @routers; +my %manual_addr_routernum = map { $_->routernum, $_->manual_addr } @routers; + +if ( $conf->exists('auto_router') ) { + # Then show an "(automatic)" router, with no blocks. manual_addr is on + # so that the ip_addr field will be unlocked. + unshift @routers, FS::router->new({ + 'routernum' => '', + 'routername' => '(automatic)', + 'manual_addr' => 'Y', + }); + $manual_addr_routernum{''} = 'Y'; +} +