X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main_invoice.pm;h=71148cab003973c551753c978027ee2bda86bb9e;hb=5f92e7e7cb4a87f4e1b823a4684497cbda498b23;hp=48f47e0cd32df349059eb037aabdc94cc4f9863f;hpb=0f32a0add6f14a71e5d5a138365ce87ef5d48a35;p=freeside.git diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index 48f47e0cd..71148cab0 100644 --- a/FS/FS/cust_main_invoice.pm +++ b/FS/FS/cust_main_invoice.pm @@ -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 @@ -132,7 +132,7 @@ sub checkdest { } 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 { @@ -159,6 +159,17 @@ sub address { } } +=item cust_main + +Returns the parent customer object (see L). + +=cut + +sub cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); +} + =back =head1 BUGS