From: ivan Date: Tue, 4 Nov 2003 17:30:18 +0000 (+0000) Subject: make snarf info available to exports X-Git-Tag: freeside_1_4_2beta1~408 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=e99bf710db502f6a750b789beaea429f544a1b4a;p=freeside.git make snarf info available to exports --- diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm index da24e5ca7..f65638984 100644 --- a/FS/FS/part_export/shellcommands.pm +++ b/FS/FS/part_export/shellcommands.pm @@ -40,6 +40,13 @@ sub _export_command { { no strict 'refs'; ${$_} = $svc_acct->getfield($_) foreach $svc_acct->fields; + + my $count = 1; + foreach my $acct_snarf ( $svc_acct->acct_snarf ) { + ${"snarf_$_$count"} = shell_quote( $acct_snarf->get($_) ) + foreach qw( machine username _password ); + $count++; + } } my $cust_pkg = $svc_acct->cust_svc->cust_pkg; diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 3ec0f1e6c..0b37f0620 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -17,7 +17,7 @@ use Carp; use Fcntl qw(:flock); use FS::UID qw( datasrc ); use FS::Conf; -use FS::Record qw( qsearch qsearchs fields dbh ); +use FS::Record qw( qsearch qsearchs fields dbh dbdef ); use FS::svc_Common; use Net::SSH; use FS::cust_svc; @@ -966,6 +966,22 @@ sub email { $self->username. '@'. $self->domain; } +=item acct_snarf + +Returns an array of FS::acct_snarf records associated with the account. +If the acct_snarf table does not exist or there are no associated records, +an empty list is returned + +=cut + +sub acct_snarf { + my $self = shift; + return () unless dbdef->table('acct_snarf'); + eval "use FS::acct_snarf;"; + die $@ if $@; + qsearch('acct_snarf', { 'svcnum' => $self->svcnum } ); +} + =item seconds_since TIMESTAMP Returns the number of seconds this account has been online since TIMESTAMP,