From 8e70e767b1fc7384d11d38246868d17ea0ec560e Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 4 Nov 2003 17:30:15 +0000 Subject: [PATCH] make snarf info available to exports --- FS/FS/part_export/shellcommands.pm | 7 +++++++ FS/FS/svc_acct.pm | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) 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 4ea7734d4..e4acf7459 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -16,7 +16,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 FS::cust_svc; use FS::part_svc; @@ -951,6 +951,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, -- 2.11.0