X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay_refund.pm;h=b799f69e72bf4ef00c0f21354ce1b75e7158a0e7;hb=fe4515eb37d76849dd08c62782d86bc7ba311dcd;hp=15e0e533ac0ef3570b250ecf5036e48ffc33929c;hpb=33aeb33a7fafaf099c679c6d7150b54b99e4810f;p=freeside.git diff --git a/FS/FS/cust_pay_refund.pm b/FS/FS/cust_pay_refund.pm index 15e0e533a..b799f69e7 100644 --- a/FS/FS/cust_pay_refund.pm +++ b/FS/FS/cust_pay_refund.pm @@ -2,7 +2,6 @@ package FS::cust_pay_refund; use strict; use vars qw( @ISA ); #$conf ); -use FS::UID qw( getotaker ); use FS::Record qw( qsearchs ); # qsearch ); use FS::cust_main; use FS::cust_pay; @@ -73,15 +72,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(@_); }