From 2d4288081e74e3ecd8dae9eb8ac645f5ecc62a8c Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Tue, 29 Sep 2009 12:19:31 +0000
Subject: [PATCH] Correct the documentation for these bill retrieval methods
 and add variants that return just ids instead of full objects.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14199 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/Actor.pm | 52 +++++++++++++++++++---
 .../staff_client/chrome/content/main/constants.js  | 18 ++++----
 2 files changed, 56 insertions(+), 14 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
index d6b51961b6..b1d6c4bbc4 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
@@ -1952,14 +1952,14 @@ __PACKAGE__->register_method(
 	api_name	=> "open-ils.actor.user.transactions.history",
 	argc		=> 1,
 	notes		=> <<"	NOTES");
-	Returns a list of billable transaction ids for a user, optionally by type
+	Returns a list of billable transactions for a user, optionally by type
 	NOTES
 __PACKAGE__->register_method(
 	method	=> "user_transaction_history",
 	api_name	=> "open-ils.actor.user.transactions.history.have_charge",
 	argc		=> 1,
 	notes		=> <<"	NOTES");
-	Returns a list of billable transaction ids for a user that have an initial charge, optionally by type
+	Returns a list of billable transactions for a user that have an initial charge, optionally by type
 	NOTES
 __PACKAGE__->register_method(
 	method	=> "user_transaction_history",
@@ -1967,14 +1967,14 @@ __PACKAGE__->register_method(
     authoritative => 1,
 	argc		=> 1,
 	notes		=> <<"	NOTES");
-	Returns a list of billable transaction ids for a user that have a balance, optionally by type
+	Returns a list of billable transactions 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
+	Returns a list of billable transactions for a user that are not finished
 	NOTES
 __PACKAGE__->register_method(
 	method	=> "user_transaction_history",
@@ -1982,9 +1982,47 @@ __PACKAGE__->register_method(
     authoritative => 1,
 	argc		=> 1,
 	notes		=> <<"	NOTES");
+	Returns a list of billable transactions for a user that has billings
+	NOTES
+__PACKAGE__->register_method(
+	method	=> "user_transaction_history",
+	api_name	=> "open-ils.actor.user.transactions.history.ids",
+	argc		=> 1,
+	notes		=> <<"	NOTES");
+	Returns a list of billable transaction ids for a user, optionally by type
+	NOTES
+__PACKAGE__->register_method(
+	method	=> "user_transaction_history",
+	api_name	=> "open-ils.actor.user.transactions.history.have_charge.ids",
+	argc		=> 1,
+	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.ids",
+    authoritative => 1,
+	argc		=> 1,
+	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.ids",
+	argc		=> 1,
+	notes		=> <<"	NOTES");
+	Returns a list of billable transaction ids for a user that are not finished
+	NOTES
+__PACKAGE__->register_method(
+	method	=> "user_transaction_history",
+	api_name	=> "open-ils.actor.user.transactions.history.have_bill.ids",
+    authoritative => 1,
+	argc		=> 1,
+	notes		=> <<"	NOTES");
 	Returns a list of billable transaction ids for a user that has billings
 	NOTES
 
+
 sub user_transaction_history {
 	my( $self, $conn, $auth, $userid, $type ) = @_;
 
@@ -2030,7 +2068,11 @@ sub user_transaction_history {
 		@mbts = grep { int($_->total_owed * 100) != 0 } @mbts;
 	}
 
-	return [@mbts];
+    if ($api =~ /\.ids/) {
+    	return [map {$_->id} @mbts];
+    } else {
+        return [@mbts];
+    }
 }
 
 
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js
index 3cd0600539..41873e4481 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js
@@ -200,15 +200,15 @@ const api = {
 	'FM_MB_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billing.note.edit' },
 	'FM_MBTS_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve' },
 	'FM_MBTS_RETRIEVE.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact_summary.retrieve.authoritative' },
-	'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_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.authoritative' },
-	'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.still_open' },
-	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill' },
-	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.authoritative' },
-	'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill' },
-	'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.authoritative' },
+	'FM_MBTS_IDS_RETRIEVE_ALL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.ids' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_charge.ids' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_balance.ids.authoritative' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_STILL_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.still_open.ids' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' },
+	'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BILL.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' },
+	'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids' },
+	'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.history.have_bill.ids.authoritative' },
 	'FM_MP_RETRIEVE_VIA_MBTS_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all' },
 	'FM_MP_RETRIEVE_VIA_MBTS_ID.authoritative' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.retrieve.all.authoritative' },
 	'FM_MP_NOTE_EDIT' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment.note.edit' },
-- 
2.11.0