export host selection per service, RT#17914
[freeside.git] / FS / FS / part_export / http_status.pm
index 08be3a0..6fbd3fb 100644 (file)
@@ -1,8 +1,9 @@
-packages FS::part_export::http_status;
+package FS::part_export::http_status;
 use base qw( FS::part_export );
 
 use strict;
 use warnings;
+use vars qw( %info );
 use LWP::UserAgent;
 use HTTP::Request::Common;
 
@@ -16,6 +17,7 @@ tie my %options, 'Tie::IxHash',
   'svc'     => 'svc_dsl',
   'desc'    => 'Retrieve status information via HTTP or HTTPS',
   'options' => \%options,
+  'no_machine' => 1,
   'notes'   => <<'END'
 Fields from the service can be substituted in the URL as $field.
 END
@@ -26,12 +28,17 @@ sub rebless { shift; }
 sub export_getstatus {
   my( $self, $svc_x, $htmlref, $hashref ) = @_;
 
-  my $url = $self->option('url');
+  my $url;
+  my $urlopt = $self->option('url');
+  no strict 'vars';
   {
     no strict 'refs';
-    ${$_} = $svc_x->getfield($x) foreach $svc_x->fields;
+    ${$_} = $svc_x->getfield($_) foreach $svc_x->fields;
+    if ( $svc_x->table eq 'svc_dsl' ) {
+      ${$_} = $svc_x->$_() foreach (qw( gateway_access_or_phonenum ));
+    }
 
-    $url = eval(qq($url));
+    $url = eval(qq("$urlopt"));
   }
 
   my $req = HTTP::Request::Common::GET( $url );
@@ -41,7 +48,6 @@ sub export_getstatus {
   $$htmlref = $response->is_error ? $response->error_as_HTML
                                   : $response->content;
 
-
   #hash data note yet implemented for this status export
 
 }