4 <% include("/elements/errorpage.html", "No configuration data produced.") %>
9 unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
12 if ( $cgi->param('exportnum') ) {
13 $cgi->param('exportnum') =~ /^(\d+)$/ or die "unparsable exportnum";
17 die "no export provided"
21 if ( $cgi->param('svcnum') ) {
22 $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
27 if ( $cgi->param('devicenum') ) {
28 $cgi->param('devicenum') =~ /^(\d+)$/ or die "unparsable devicenum";
32 die "no device or service provided"
33 unless $svcnum || $devicenum;
35 my $part_export = qsearchs('part_export', { 'exportnum' => $exportnum })
36 or die "Unknown exportnum $exportnum\n";
41 $phone_device = qsearchs('phone_device', { 'devicenum' => $devicenum })
42 or die "Unknown device $devicenum\n";
43 $svc_phone = $phone_device->svc_phone;
45 $svc_phone = qsearchs('svc_phone', { 'svcnum' => $svcnum })
46 or die "Unknown svc_phone $svcnum\n";
49 my $config = $part_export->export_device_config($svc_phone, $phone_device);
52 http_header('Content-Type' => 'application/octet-stream');
53 http_header('Content-Disposition' => 'attachment;filename="config"');
54 http_header('Content-Length' => length($config));