<% my $router; if ( $cgi->keywords ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; $router = qsearchs('router', { routernum => $1 }) or print $cgi->redirect(popurl(2)."browse/router.cgi") ; } else { $router = new FS::router ( { map { $_, scalar($cgi->param($_)) } fields('router') } ); } my $routernum = $router->routernum; my $action = $routernum ? 'Edit' : 'Add'; my $hashref = $router->hashref; print header("$action Router", menubar( 'Main Menu' => "$p", 'View all routers' => "${p}browse/router.cgi", )); if($cgi->param('error')) { %>
Error: <%=$cgi->param('error')%>
<% } %>
Router #<%=$routernum or "(NEW)"%>
Name
Custom fields:
<%=table() %> <% # I know, I know. Massive false laziness with edit/svc_broadband.cgi. But # Kristian won't let me generalize the custom field mechanism to every table in # the database, so this is what we get.
# -- MW my @part_router_field = qsearch('part_router_field', { }); my %rf = map { $_->part_router_field->name, $_->value } $router->router_field; foreach (sort { $a->name cmp $b->name } @part_router_field) { %>
<%=$_->name%>
<% if(my @opts = $_->list_values) { %>
<% foreach $opt (@opts) { %>
name}) ? ' SELECTED' : ''%>> <%=$opt%>
<% } %>
<% } else { %>
length ? 'SIZE="'.$_->length.'"' : ''%>> <% } %>
<% } %>
Select the service types available on this router
<% foreach my $part_svc ( qsearch('part_svc', { svcdb => 'svc_broadband', disabled => '' }) ) { %>
$part_svc->svcpart, routernum => $routernum } ) ? 'CHECKED' : ''%> VALUE="ON">
<%=$part_svc->svcpart%>: <%=$part_svc->svc%>
<% } %>