diff options
author | Mark Wells <mark@freeside.biz> | 2012-10-30 12:16:17 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2012-10-30 12:16:17 -0700 |
commit | 87f255507af9f14dfbccd37eefd71a148f9af344 (patch) | |
tree | 7467e87ff6a27cdbe67fa60f4261e2d07a61f4b7 /httemplate/elements | |
parent | d77fe06b27410a41855e1425114ab8d9cdae4ff0 (diff) |
IP address management for svc_acct, #19567
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/tr-select-router_block_ip.html | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/httemplate/elements/tr-select-router_block_ip.html b/httemplate/elements/tr-select-router_block_ip.html index 95d1787b8..11f7c4831 100644 --- a/httemplate/elements/tr-select-router_block_ip.html +++ b/httemplate/elements/tr-select-router_block_ip.html @@ -58,12 +58,13 @@ function clearhint_ip_addr (what) { </td></tr> <& /elements/tr-td-label.html, label => 'IP address' &> <td> -% if ( $fixed{'ip_addr'} ) { - <input type="hidden" id="input_ip_addr" name="ip_addr" +% warn Dumper \%fixed; +% if ( exists $fixed{$ip_field} ) { + <input type="hidden" id="input_ip_addr" name="<% $ip_field %>" value="<% $opt{'ip_addr'} |h%>"><% $opt{'ip_addr'} || '' %> % } % else { - <input type="text" id="input_ip_addr" name="ip_addr" + <input type="text" id="input_ip_addr" name="<% $ip_field %>" value="<% $opt{'ip_addr'} |h%>" onfocus="clearhint_ip_addr(this)"> % } </td> </tr> @@ -78,6 +79,7 @@ my $conf = FS::Conf->new; my $svc_x = $opt{'object'}; if ( $svc_x ) { + # $svc_x->ip_addr does work, even for non-svc_broadband. $opt{$_} = $svc_x->$_ foreach qw(routernum blocknum ip_addr svcpart); if ( $svc_x->svcnum ) { @@ -86,6 +88,8 @@ if ( $svc_x ) { } my $svcpart = $opt{'svcpart'} || ''; +my $ip_field = $opt{'ip_field'} || 'ip_addr'; + my %fixed; # which fields are fixed $svcpart =~ /^\d*$/ or die "invalid svcpart '$svcpart'"; if ( $svcpart ) { @@ -93,13 +97,13 @@ if ( $svcpart ) { # Traditionally, columnflag 'F' on IP address means that it MUST # be auto-assigned (or, if null IP addresses are allowed, that # it must be null). - foreach (qw(routernum blocknum ip_addr)) { + foreach (qw(routernum blocknum), $ip_field) { my $psc = $part_svc->part_svc_column($_); if ( $psc and $psc->columnflag eq 'F' ) { $fixed{$_} = $psc->columnvalue; } } - if ( $fixed{'routernum'} ) { + if ( exists $fixed{'routernum'} ) { @routers = (FS::router->by_key($fixed{'routernum'})) } else { |