X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main_invoice.pm;h=ec01842a7a4fd3ef50be825963ea32974267b2e2;hp=add0ccab13035fc6174a6f6bdfe82d430edf1f3d;hb=da86d5a8af2f915a340a74f6c97772451a1e23ef;hpb=2041a9143fac20b79ead4a1ae01224dedf5b27c2 diff --git a/FS/FS/cust_main_invoice.pm b/FS/FS/cust_main_invoice.pm index add0ccab1..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; @@ -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 @@ -127,16 +127,20 @@ sub checkdest { my $error = $self->ut_text('dest'); return $error if $error; - if ( $self->dest eq 'POST' ) { + 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 { - return gettext("illegal_email_invoice_address"); + return gettext("illegal_email_invoice_address"). ': '. $self->dest; } ''; #no error @@ -144,7 +148,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 +163,18 @@ sub address { } } -=back +=item cust_main + +Returns the parent customer object (see L). + +=cut -=head1 VERSION +sub cust_main { + my $self = shift; + qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); +} -$Id: cust_main_invoice.pm,v 1.14 2003-08-05 00:20:42 khoff Exp $ +=back =head1 BUGS