X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=3f811357a7c4b53f4c2338bea257dd67865c5400;hb=1aa750eba2b9b73b4f09f28b9acd748ee3669bd4;hp=21365c1ebba3b9ff1eb812eed9bd2d8112714810;hpb=357faffb9564be9d77815cde87645efd955adb4d;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 21365c1eb..3f811357a 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -57,10 +57,12 @@ L and L for conversion functions. =item payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free) -=item payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username) +=item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively =item paybatch - text field for tracking card processing +=item closed - books closed flag, empty or `Y' + =back =head1 METHODS @@ -208,7 +210,9 @@ Currently unimplemented (accounting reasons). =cut sub delete { - return "Can't (yet?) delete cust_pay records!"; + my $self = shift; + return "Can't delete closed payment" if $self->closed =~ /^Y/i; + $self->SUPER::delete(@_); } =item replace OLD_RECORD @@ -237,9 +241,12 @@ sub check { || $self->ut_money('paid') || $self->ut_numbern('_date') || $self->ut_textn('paybatch') + || $self->ut_enum('closed', [ '', 'Y' ]) ; return $error if $error; + return "paid must be > 0 " if $self->paid <= 0; + return "unknown cust_main.custnum: ". $self->custnum unless $self->invnum || qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); @@ -249,6 +256,7 @@ sub check { $self->payby =~ /^(CARD|BILL|COMP)$/ or return "Illegal payby"; $self->payby($1); + #false laziness with cust_refund::check if ( $self->payby eq 'CARD' ) { my $payinfo = $self->payinfo; $payinfo =~ s/\D//g; @@ -304,7 +312,7 @@ sub unapplied { =head1 VERSION -$Id: cust_pay.pm,v 1.9 2001-12-08 10:07:27 ivan Exp $ +$Id: cust_pay.pm,v 1.14 2002-01-28 06:57:23 ivan Exp $ =head1 BUGS