% include('/elements/header.html', "$action $svc", '') %> <% include('/elements/error.html') %>
<% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? my $conf = new FS::Conf; my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_cert ); if ( $cgi->param('error') ) { $svc_cert = new FS::svc_cert ( { map { $_, scalar($cgi->param($_)) } fields('svc_cert') } ); $svcnum = $svc_cert->svcnum; $pkgnum = $cgi->param('pkgnum'); $svcpart = $cgi->param('svcpart'); $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } ); die "No part_svc entry!" unless $part_svc; } elsif ( $cgi->param('pkgnum') && $cgi->param('svcpart') ) { #adding $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'unparsable pkgnum'; $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/ or die 'unparsable svcpart'; $svcpart = $1; $part_svc=qsearchs('part_svc',{'svcpart'=>$svcpart}); die "No part_svc entry!" unless $part_svc; $svc_cert = new FS::svc_cert({}); $svcnum=''; $svc_cert->set_default_and_fixed; } else { #editing my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "unparsable svcnum"; $svcnum=$1; $svc_cert=qsearchs('svc_cert',{'svcnum'=>$svcnum}) or die "Unknown (svc_cert) 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; } my $action = $svcnum ? 'Edit' : 'Add'; my $svc = $part_svc->getfield('svc'); #my $otaker = getotaker; my $p1 = popurl(1); my $link_query = "?svcnum=$svcnum;pkgnum=$pkgnum;svcpart=$svcpart"; %init>