X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_refund.pm;h=cb9dbcef2b7bafbe458d2bc8e3400378f7e8e12d;hp=af25f177402f38f9766783fec9aadfda53400e49;hb=7f5e32275a5a2674fd1d220cd651b222b9831476;hpb=f7fd2a3e34da751cbc02bbf215e99c6dc89adc15 diff --git a/FS/FS/cust_pay_refund.pm b/FS/FS/cust_pay_refund.pm index af25f1774..cb9dbcef2 100644 --- a/FS/FS/cust_pay_refund.pm +++ b/FS/FS/cust_pay_refund.pm @@ -73,15 +73,26 @@ sub table { 'cust_pay_refund'; } Adds this cust_pay_refund to the database. If there is an error, returns the error, otherwise returns false. +=cut + +sub insert { + my $self = shift; + return "Can't apply refund to closed payment" + if $self->cust_pay->closed =~ /^Y/i; + return "Can't apply payment to closed refund" + if $self->cust_refund->closed =~ /^Y/i; + $self->SUPER::insert(@_); +} + =item delete =cut sub delete { my $self = shift; - return "Can't apply refund to closed payment" + return "Can't remove refund from closed payment" if $self->cust_pay->closed =~ /^Y/i; - return "Can't apply closed refund" + return "Can't remove payment from closed refund" if $self->cust_refund->closed =~ /^Y/i; $self->SUPER::delete(@_); } @@ -138,26 +149,26 @@ sub check { $self->SUPER::check; } -=item sub cust_credit +=item sub cust_pay -Returns the credit (see L) +Returns the payment (see L) =cut -sub cust_credit { +sub cust_pay { my $self = shift; - qsearchs( 'cust_credit', { 'crednum' => $self->crednum } ); + qsearchs( 'cust_pay', { 'paynum' => $self->paynum } ); } -=item cust_bill +=item cust_refund -Returns the invoice (see L) +Returns the refund (see L) =cut -sub cust_bill { +sub cust_refund { my $self = shift; - qsearchs( 'cust_bill', { 'invnum' => $self->invnum } ); + qsearchs( 'cust_refund', { 'refundnum' => $self->refundnum } ); } =back