%
%
%# If it's stupid but it works, it's still stupid.
%# -Kristian
%
%
%use HTML::Widgets::SelectLayers;
%use Tie::IxHash;
%
%my( $svcnum, $pkgnum, $svcpart, $part_svc, $svc_broadband );
%if ( $cgi->param('error') ) {
% $svc_broadband = new FS::svc_broadband ( {
% map { $_, scalar($cgi->param($_)) } fields('svc_broadband'), qw(svcpart)
% } );
% $svcnum = $svc_broadband->svcnum;
% $pkgnum = $cgi->param('pkgnum');
% $svcpart = $svc_broadband->svcpart;
% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
% die "No part_svc entry!" unless $part_svc;
%} else {
% my($query) = $cgi->keywords;
% if ( $query =~ /^(\d+)$/ ) { #editing
% $svcnum=$1;
% $svc_broadband=qsearchs('svc_broadband',{'svcnum'=>$svcnum})
% or die "Unknown (svc_broadband) svcnum!";
%
% my($cust_svc)=qsearchs('cust_svc',{'svcnum'=>$svcnum})
% or die "Unknown (cust_svc) svcnum!";
%
% $pkgnum=$cust_svc->pkgnum;
% $svcpart=$cust_svc->svcpart;
%
% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
% die "No part_svc entry!" unless $part_svc;
%
% } else { #adding
%
% foreach $_ (split(/-/,$query)) { #get & untaint pkgnum & svcpart
% $pkgnum=$1 if /^pkgnum(\d+)$/;
% $svcpart=$1 if /^svcpart(\d+)$/;
% }
% $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart});
% die "No part_svc entry!" unless $part_svc;
%
% $svc_broadband = new FS::svc_broadband({ svcpart => $svcpart });
%
% $svcnum='';
%
% $svc_broadband->set_default_and_fixed;
%
% }
%}
%my $action = $svc_broadband->svcnum ? 'Edit' : 'Add';
%
%if ($pkgnum) {
%
% #Nothing?
%
%} elsif ( $action eq 'Edit' ) {
%
% #Nothing?
%
%} else {
% die "\$action eq Add, but \$pkgnum is null!\n";
%}
%
%my $p1 = popurl(1);
%
%my ($ip_addr, $speed_up, $speed_down, $blocknum) =
% ($svc_broadband->ip_addr,
% $svc_broadband->speed_up,
% $svc_broadband->speed_down,
% $svc_broadband->blocknum);
%
%
<%include("/elements/header.html","Broadband Service $action", '')%>
% if ($cgi->param('error')) {
Error: <%$cgi->param('error')%>
% }
Service #<%$svcnum ? $svcnum : "(NEW)"%>