open-ils.actor.user.transactions.history.have_balance
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jun 2006 14:58:23 +0000 (14:58 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 15 Jun 2006 14:58:23 +0000 (14:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4628 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm

index c2582af..c38fb54 100644 (file)
@@ -1753,6 +1753,13 @@ __PACKAGE__->register_method(
        notes           => <<"  NOTES");
        Returns a list of billable transaction ids for a user that have an initial charge, optionally by type
        NOTES
+__PACKAGE__->register_method(
+       method  => "user_transaction_history",
+       api_name        => "open-ils.actor.user.transactions.history.have_balance",
+       argc            => 1,
+       notes           => <<"  NOTES");
+       Returns a list of billable transaction ids for a user that have a balance, optionally by type
+       NOTES
 sub user_transaction_history {
        my( $self, $client, $login_session, $user_id, $type ) = @_;
 
@@ -1763,14 +1770,16 @@ sub user_transaction_history {
        my $api = $self->api_name();
        my @xact;
        my @charge;
+       my @balance;
 
        @xact = (xact_type =>  $type) if(defined($type));
        @charge = (total_owed => { ">" => 0}) if($api =~ /have_charge/);
+       @balance = (balance_owed => { "!=" => 0}) if($api =~ /have_balance/);
 
        my $trans = $apputils->simple_scalar_request( 
                "open-ils.storage",
                "open-ils.storage.direct.money.billable_transaction_summary.search_where.atomic",
-               { usr => $user_id, @xact, @charge }, { order_by => 'xact_start DESC' });
+               { usr => $user_id, @xact, @charge, @balance }, { order_by => 'xact_start DESC' });
 
        return [ map { $_->id } @$trans ];
 }