X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=site_perl%2Fcust_main_invoice.pm;h=2823294c18f648b82b92f04d494bab37c7184ee3;hb=1e3eae905b861761f93643aa5fce14a8be5d9ed2;hp=9c1a86a12b1c72c879c3f8899ad3da0bbbbc18aa;hpb=1f2d8690193476319d61b20b78461eb1a3ff106e;p=freeside.git diff --git a/site_perl/cust_main_invoice.pm b/site_perl/cust_main_invoice.pm index 9c1a86a12..2823294c1 100644 --- a/site_perl/cust_main_invoice.pm +++ b/site_perl/cust_main_invoice.pm @@ -86,7 +86,7 @@ returns the error, otherwise returns false. sub replace { my ( $new, $old ) = ( shift, shift ); - return "Can't change custnum!" unless $old->custnum eq $new->custnum; + return "Can't change custnum!" unless $old->custnum == $new->custnum; $new->SUPER::replace; } @@ -103,21 +103,36 @@ and repalce methods. sub check { my $self = shift; - my $error = $self->ut_number('destnum') - or $self->ut_number('custnum') - or $self->ut_text('dest') + my $error = $self->ut_numbern('destnum') + || $self->ut_number('custnum') + || $self->checkdest; ; return $error if $error; return "Unknown customer" unless qsearchs('cust_main',{ 'custnum' => $self->custnum }); + ''; #noerror +} + +=item checkdest + +Checks the dest field only. + +=cut + +sub checkdest { + my $self = shift; + + my $error = $self->ut_text('dest'); + return $error if $error; + if ( $self->dest eq 'POST' ) { #contemplate our navel } elsif ( $self->dest =~ /^(\d+)$/ ) { return "Unknown local account (specified by svcnum)" unless qsearchs( 'svc_acct', { 'svcnum' => $self->dest } ); - } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]\.)+\w+)$/ ) { + } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]+\.)+\w+)$/ ) { my($user, $domain) = ($1, $2); if ( $domain eq $mydomain ) { my $svc_acct = qsearchs( 'svc_acct', { 'username' => $user } ); @@ -152,7 +167,7 @@ sub address { =head1 VERSION -$Id: cust_main_invoice.pm,v 1.3 1998-12-29 11:59:42 ivan Exp $ +$Id: cust_main_invoice.pm,v 1.6 1999-01-25 12:26:10 ivan Exp $ =head1 BUGS @@ -168,7 +183,16 @@ added hfields ivan@sisd.com 97-nov-13 $Log: cust_main_invoice.pm,v $ -Revision 1.3 1998-12-29 11:59:42 ivan +Revision 1.6 1999-01-25 12:26:10 ivan +yet more mod_perl stuff + +Revision 1.5 1999/01/18 21:58:05 ivan +esthetic: eq and ne were used in a few places instead of == and != + +Revision 1.4 1999/01/18 09:22:42 ivan +changes to track email addresses for email invoicing + +Revision 1.3 1998/12/29 11:59:42 ivan mostly properly OO, some work still to be done with svc_ stuff Revision 1.2 1998/12/16 09:58:53 ivan