X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export.pm;h=ed66b41a1069fd5cc1868db672e7b9c0d717f2f0;hb=a2a69f909cad813d7164bae805e87f5874a9fdae;hp=c757d368d37e1fecde36f8e153aa040470aa1031;hpb=806d426d106efea2b2b13314108c4ac046511e1c;p=freeside.git diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index c757d368d..ed66b41a1 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -9,6 +9,7 @@ use FS::Record qw( qsearch qsearchs dbh ); use FS::part_svc; use FS::part_export_option; use FS::part_export_machine; +use FS::svc_export_machine; use FS::export_svc; #for export modules, though they should probably just use it themselves @@ -470,6 +471,26 @@ sub _rebless { $self; } +=item svc_machine + +=cut + +sub svc_machine { + my( $self, $svc_x ) = @_; + + return $self->machine unless $self->machine eq '_SVC_MACHINE'; + + my $svc_export_machine = qsearchs('svc_export_machine', { + 'svcnum' => $svc_x->svcnum, + 'exportnum' => $self->exportnum, + }) + #would only happen if you add this export to existing services without a + #machine set then try to run exports without setting it... right? + or die "No hostname selected for ".($self->exportname || $self->exporttype); + + return $svc_export_machine->part_export_machine->machine; +} + #these should probably all go away, just let the subclasses define em =item export_insert SVC_OBJECT @@ -594,6 +615,19 @@ sub weight { export_info()->{$self->exporttype}->{'weight'} || 0; } +=item info + +Returns a reference to (a copy of) the export's %info hash. + +=cut + +sub info { + my $self = shift; + $self->{_info} ||= { + %{ export_info()->{$self->exporttype} } + }; +} + =back =head1 SUBROUTINES