[open-ils-commits] r15117 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 9 09:30:10 EST 2009
Author: erickson
Date: 2009-12-09 09:30:08 -0500 (Wed, 09 Dec 2009)
New Revision: 15117
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Log:
added API open-ils.actor.user.transactions.history.have_bill_or_payment[.ids] which will capture xacts where all billings have been voided but 1 or more payments toward the billing have been made.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-12-09 14:29:50 UTC (rev 15116)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm 2009-12-09 14:30:08 UTC (rev 15117)
@@ -2123,8 +2123,25 @@
notes => <<" NOTES");
Returns a list of billable transaction ids for a user that has billings
NOTES
+__PACKAGE__->register_method(
+ method => "user_transaction_history",
+ api_name => "open-ils.actor.user.transactions.history.have_bill_or_payment",
+ authoritative => 1,
+ argc => 1,
+ notes => <<" NOTES");
+ Returns a list of billable transactions for a user that has non-zero-sum billings or at least 1 payment
+ NOTES
+__PACKAGE__->register_method(
+ method => "user_transaction_history",
+ api_name => "open-ils.actor.user.transactions.history.have_bill_or_payment.ids",
+ authoritative => 1,
+ argc => 1,
+ notes => <<" NOTES");
+ Returns a list of billable transaction ids for a user that has non-zero-sum billings or at least 1 payment
+ NOTES
+
sub user_transaction_history {
my( $self, $conn, $auth, $userid, $type ) = @_;
@@ -2151,15 +2168,20 @@
@$mbts = grep { $_->xact_type eq $type } @$mbts;
}
- if($api =~ /have_balance/o) {
+ if($api =~ /have_bill_or_payment/o) {
+
+ # includes xacts that have all-voided billings and at least 1 payment
+ @$mbts = grep {
+ int($_->balance_owed * 100) != 0 ||
+ defined($_->last_payment_ts) } @$mbts;
+
+ } elsif( $api =~ /have_balance/o) {
@$mbts = grep { int($_->balance_owed * 100) != 0 } @$mbts;
- }
- if($api =~ /have_charge/o) {
+ } elsif( $api =~ /have_charge/o) {
@$mbts = grep { defined($_->last_billing_ts) } @$mbts;
- }
- if($api =~ /have_bill/o) {
+ } elsif( $api =~ /have_bill/o) {
@$mbts = grep { int($_->total_owed * 100) != 0 } @$mbts;
}
More information about the open-ils-commits
mailing list