fixing money
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 10:20:09 +0000 (10:20 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Sep 2006 10:20:09 +0000 (10:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5956 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/bills.js

index 69579ea..ffc4819 100644 (file)
@@ -1759,6 +1759,14 @@ __PACKAGE__->register_method(
        notes           => <<"  NOTES");
        Returns a list of billable transaction ids for a user that have a balance, optionally by type
        NOTES
+__PACKAGE__->register_method(
+       method  => "user_transaction_history",
+       api_name        => "open-ils.actor.user.transactions.history.still_open",
+       argc            => 1,
+       notes           => <<"  NOTES");
+       Returns a list of billable transaction ids for a user that are not finished
+       NOTES
+
 
 =head old
 sub _user_transaction_history {
@@ -1799,10 +1807,11 @@ sub user_transaction_history {
        my @xact = (xact_type =>  $type) if(defined($type));
        my @balance = (balance_owed => { "!=" => 0}) if($api =~ /have_balance/);
        my @charge  = (last_billing_ts => { "!=" => undef }) if $api =~ /have_charge/;
+       my @xact_finish  = (xact_finish => undef ) if $api =~ /still_open/;
 
        return $e->search_money_billable_transaction_summary(
                [
-                       { usr => $userid, @xact, @charge, @balance }, 
+                       { usr => $userid, @xact, @charge, @balance, @xact_finish }, 
                        { order_by => 'xact_start DESC' }
                ], {idlist => 1});
 }
index 1d4bf08..a9c531a 100644 (file)
@@ -128,6 +128,7 @@ const api = {
        'FM_MBTS_IDS_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history' },
        'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_charge' },
        'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance' },
+       'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.still_open' },
        'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' },
        'FM_MG_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.create' },
        'FM_MG_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.grocery.retrieve' },
index 7f6801d..d19c0da 100644 (file)
@@ -21,7 +21,9 @@ patron.bills.prototype = {
 
        'current_payments' : [],
 
-       'SHOW_ME_THE_BILLS' : 'FM_MOBTS_HAVING_BALANCE',
+       'SHOW_ME_THE_BILLS' : 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE',
+       //'SHOW_ME_THE_BILLS' : 'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN',
+       //'SHOW_ME_THE_BILLS' : 'FM_MOBTS_HAVING_BALANCE',
        /*'SHOW_ME_THE_BILLS' : 'FM_MOBTS_OPEN',*/
 
        'refresh' : function(dont_show_me_the_money) {
@@ -31,13 +33,22 @@ patron.bills.prototype = {
                                        obj.SHOW_ME_THE_BILLS,
                                        [ ses(), obj.patron_id ]
                                );
+                               //alert('obj.bills = ' + js2JSON(obj.bills));
 
                                for (var i = 0; i < obj.bills.length; i++) {
+                                       /*
                                        if (instanceOf(obj.bills[i],mobts)) {
                                                obj.bills[i] = { 'transaction' : obj.bills[i] }
                                        } else if (instanceOf(obj.bills[i],mbts)) {
                                                obj.bills[i] = { 'transaction' : obj.bills[i] }
+                                       } else {
+                                       */
+                                               var robj = obj.network.simple_request('FM_MBTS_RETRIEVE',[ses(),obj.bills[i]]);
+                                               //alert('refresh robj = ' + js2JSON(robj));
+                                               obj.bills[i] = { 'transaction' : robj }
+                                       /*
                                        }
+                                       */
                                }
 
                                if (!dont_show_me_the_money) {
@@ -632,9 +643,17 @@ patron.bills.prototype = {
                                                [ ses(), obj.patron_id ]
                                        );
                                        for (var i = 0; i < obj.bills.length; i++) {
+                                               /*
                                                if (instanceOf(obj.bills[i],mobts)) {
                                                        obj.bills[i] = { 'transaction' : obj.bills[i] }
+                                               } else {
+                                               */
+                                                       var robj = obj.network.simple_request('FM_MBTS_RETRIEVE',[ses(),obj.bills[i]]);
+                                                       //alert('robj = ' + js2JSON(robj));
+                                                       obj.bills[i] = { 'transaction' : robj }
+                                               /*
                                                }
+                                               */
                                        }
                                }
                } catch(E) {