From bebcf469b038cc8a65b25220e46e0bfcc7635040 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 9 Dec 2009 14:30:08 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15117 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Actor.pm | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 176eb2ec1f..20939be6a0 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -2123,6 +2123,23 @@ __PACKAGE__->register_method( 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 { @@ -2151,15 +2168,20 @@ sub user_transaction_history { @$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; } -- 2.11.0