X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_refund.pm;h=53c6bac2519f3875f4b3c26e67cd8532626a884e;hb=d308c191905e5d1d982e439cb83d5304650ee77a;hp=9cd9bf845347b5c6a5458d84080cc7299dcf67fb;hpb=b89c7f126690704c8d1558dba06d5fabd7470528;p=freeside.git diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index 9cd9bf845..53c6bac25 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -221,7 +221,8 @@ Currently unimplemented (accounting reasons). =cut sub replace { - return "Can't (yet?) modify cust_refund records!"; + my $self = shift; + $self->SUPER::replace(@_); } =item check @@ -307,6 +308,36 @@ sub unapplied { =back +=head1 CLASS METHODS + +=over 4 + +=item unapplied_sql + +Returns an SQL fragment to retreive the unapplied amount. + +=cut + +sub unapplied_sql { + #my $class = shift; + + "refund + - COALESCE( + ( SELECT SUM(amount) FROM cust_credit_refund + WHERE cust_refund.refundnum = cust_credit_refund.refundnum ) + ,0 + ) + - COALESCE( + ( SELECT SUM(amount) FROM cust_pay_refund + WHERE cust_refund.refundnum = cust_pay_refund.refundnum ) + ,0 + ) + "; + +} + +=back + =head1 BUGS Delete and replace methods.