X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main_invoice.pm;h=ec01842a7a4fd3ef50be825963ea32974267b2e2;hp=71029d0968dba248591a4ac66cd21fa3109e33f7;hb=da86d5a8af2f915a340a74f6c97772451a1e23ef;hpb=5e05724a635a22776f1b973f5d7e77989da4e048 diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index 71029d096..ec01842a7 100644 --- a/FS/FS/cust_main_invoice.pm +++ b/FS/FS/cust_main_invoice.pm @@ -1,7 +1,7 @@ package FS::cust_main_invoice; use strict; -use vars qw(@ISA $conf); +use vars qw(@ISA); use Exporter; use FS::Record qw( qsearchs ); use FS::Conf; @@ -127,12 +127,16 @@ sub checkdest { my $error = $self->ut_text('dest'); return $error if $error; + my $conf = new FS::Conf; + 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 ( $conf->exists('emailinvoice-apostrophe') + ? $self->dest =~ /^\s*([\w\.\-\&\+\']+)\@(([\w\.\-]+\.)+\w+)\s*$/ + : $self->dest =~ /^\s*([\w\.\-\&\+]+)\@(([\w\.\-]+\.)+\w+)\s*$/ ){ my($user, $domain) = ($1, $2); $self->dest("$1\@$2"); } else { @@ -159,6 +163,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