2 % $cgi->param('error', $error);
5 <% $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum") %>
10 unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
12 $cgi->param('op') =~ /^(register|transfer|revoke|renew)$/ or die "Illegal operation";
14 #my($query) = $cgi->keywords;
16 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
18 my $svc_domain = qsearchs({
19 'select' => 'svc_domain.*',
20 'table' => 'svc_domain',
21 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '.
22 ' LEFT JOIN cust_pkg USING ( pkgnum ) '.
23 ' LEFT JOIN cust_main USING ( custnum ) ',
24 'hashref' => {'svcnum'=>$svcnum},
25 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
27 die "Unknown svcnum" unless $svc_domain;
29 my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
30 my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
31 die "Unknown svcpart" unless $part_svc;
35 my @exports = $part_svc->part_export();
40 # Find the first export that does domain registration
42 $export = $_ if $_->can('registrar');
45 my $period = 1; # Current OpenSRS export can only handle 1 year registrations
47 # If we have a domain registration export, get the registrar object
49 if ($operation eq 'register') {
50 $error = $export->register( $svc_domain, $period );
51 } elsif ($operation eq 'transfer') {
52 $error = $export->transfer( $svc_domain );
53 } elsif ($operation eq 'revoke') {
54 $error = $export->revoke( $svc_domain );
55 } elsif ($operation eq 'renew') {
56 $cgi->param('period') =~ /^(\d+)$/ or die "Illegal renewal period!";
58 $error = $export->renew( $svc_domain, $period );