summaryrefslogtreecommitdiff
path: root/FS/FS/cust_refund.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/cust_refund.pm')
-rw-r--r--FS/FS/cust_refund.pm33
1 files changed, 32 insertions, 1 deletions
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.