X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=site_perl%2Fcust_main_invoice.pm;h=90d653a4ae8bc6f352221a4bc5dccf6e1b89203e;hp=67e112a75e5de85be38324ff612add22176cc2e6;hb=819a983adc011bdc6eb2f3aaabd4ef1da1d4a8d8;hpb=0c9ef98c0194200190b3e2f0b8032def8bf647fc diff --git a/site_perl/cust_main_invoice.pm b/site_perl/cust_main_invoice.pm index 67e112a75..90d653a4a 100644 --- a/site_perl/cust_main_invoice.pm +++ b/site_perl/cust_main_invoice.pm @@ -1,15 +1,18 @@ package FS::cust_main_invoice; use strict; -use vars qw(@ISA $conf); +use vars qw(@ISA $conf $mydomain); use Exporter; use FS::Record; # qw(qsearch qsearchs); use FS::Conf; @ISA = qw(FS::Record); -$conf = new FS::Conf; -my $mydomain = $conf->config('domain'); +#ask FS::UID to run this stuff for us later +$FS::UID::callback{'FS::cust_main_invoice'} = sub { + $conf = new FS::Conf; + $mydomain = $conf->config('domain'); +}; =head1 NAME @@ -30,6 +33,8 @@ FS::cust_main_invoice - Object methods for cust_main_invoice records $error = $record->check; + $email_address = $record->address; + =head1 DESCRIPTION An FS::cust_main_invoice object represents an invoice destination. FS::cust_main_invoice inherits from @@ -159,11 +164,27 @@ sub check { ''; #no error } +=item address + +Returns the literal email address for this record (or `POST'). + +=cut + +sub address { + my $self = shift; + if ( $self->dest =~ /(\d+)$/ ) { + my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $1 } ); + $svc_acct->username . '@' . $mydomain; + } else { + $self->dest; + } +} + =back =head1 VERSION -$Id: cust_main_invoice.pm,v 1.1 1998-12-16 07:40:02 ivan Exp $ +$Id: cust_main_invoice.pm,v 1.2 1998-12-16 09:58:53 ivan Exp $ =head1 BUGS @@ -179,7 +200,10 @@ added hfields ivan@sisd.com 97-nov-13 $Log: cust_main_invoice.pm,v $ -Revision 1.1 1998-12-16 07:40:02 ivan +Revision 1.2 1998-12-16 09:58:53 ivan +library support for editing email invoice destinations (not in sub collect yet) + +Revision 1.1 1998/12/16 07:40:02 ivan new table Revision 1.3 1998/11/15 04:33:00 ivan