summaryrefslogtreecommitdiff
path: root/FS/FS/part_export.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-09-23 18:36:09 -0700
committerIvan Kohler <ivan@freeside.biz>2012-09-23 18:36:09 -0700
commit6868dfdef35b338f5f4f6c0bc9cae535dc344ab9 (patch)
tree624846b6fa594a7bd23153d23a6ce17110148d6b /FS/FS/part_export.pm
parent36a1e9c1661fb552d368f2f675dcb0793d733748 (diff)
export host selection per service, RT#17914
Diffstat (limited to 'FS/FS/part_export.pm')
-rw-r--r--FS/FS/part_export.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index c757d36..b0f708a 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