X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main_invoice.pm;h=71148cab003973c551753c978027ee2bda86bb9e;hb=15e57a4859d967a13113602b112c4aa197ca6002;hp=bcb1437af414fd07272a0f342eb5a70745ffdb9f;hpb=c1e33a61324f4e06157c522af7882a97a021830f;p=freeside.git diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index bcb1437af..71148cab0 100644 --- a/FS/FS/cust_main_invoice.pm +++ b/FS/FS/cust_main_invoice.pm @@ -43,7 +43,7 @@ FS::Record. The following fields are currently supported: =item custnum - customer (see L) -=item dest - Invoice destination: If numeric, a svcnum (see L), if string, a literal email address, or `POST' to enable mailing (the default if no cust_main_invoice records exist) +=item dest - Invoice destination: If numeric, a svcnum (see L), if string, a literal email address, `POST' to enable mailing (the default if no cust_main_invoice records exist), or `FAX' to enable faxing via a HylaFAX server. =back @@ -91,7 +91,7 @@ sub replace { Checks all fields to make sure this is a valid invoice destination. If there is an error, returns the error, otherwise returns false. Called by the insert -and repalce methods. +and replace methods. =cut @@ -107,7 +107,7 @@ sub check { return "Unknown customer" unless qsearchs('cust_main',{ 'custnum' => $self->custnum }); - ''; #noerror + $self->SUPER::check; } =item checkdest @@ -127,16 +127,16 @@ sub checkdest { my $error = $self->ut_text('dest'); return $error if $error; - if ( $self->dest eq 'POST' ) { + if ( $self->dest =~ /^(POST|FAX)$/ ) { #contemplate our navel } elsif ( $self->dest =~ /^(\d+)$/ ) { return "Unknown local account (specified by svcnum: ". $self->dest. ")" unless qsearchs( 'svc_acct', { 'svcnum' => $self->dest } ); - } elsif ( $self->dest =~ /^([\w\.\-\&\+]+)\@(([\w\.\-]+\.)+\w+)$/ ) { + } elsif ( $self->dest =~ /^\s*([\w\.\-\&\+]+)\@(([\w\.\-]+\.)+\w+)\s*$/ ) { my($user, $domain) = ($1, $2); $self->dest("$1\@$2"); } else { - return gettext("illegal_email_invoice_address"); + return gettext("illegal_email_invoice_address"). ': '. $self->dest; } ''; #no error @@ -144,7 +144,7 @@ sub checkdest { =item address -Returns the literal email address for this record (or `POST'). +Returns the literal email address for this record (or `POST' or `FAX'). =cut @@ -159,11 +159,18 @@ sub address { } } -=back +=item cust_main + +Returns the parent customer object (see L). -=head1 VERSION +=cut -$Id: cust_main_invoice.pm,v 1.13 2002-09-18 22:50:44 ivan Exp $ +sub cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); +} + +=back =head1 BUGS