[open-ils-commits] r19379 - in trunk/Open-ILS: src/perlmods/lib/OpenILS/Application xul/staff_client/chrome/content/main (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Feb 3 19:14:26 EST 2011


Author: erickson
Date: 2011-02-03 19:14:26 -0500 (Thu, 03 Feb 2011)
New Revision: 19379

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
Log:
ported open-ils.actor.user.transaction.[fleshed.]retrieve to CStoreEditor both for cleanup and to take advantage of .authoritative.  Use authoritative version in staff client

Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm	2011-02-03 23:50:16 UTC (rev 19378)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm	2011-02-04 00:14:26 UTC (rev 19379)
@@ -1749,6 +1749,7 @@
     method   => "user_transaction_retrieve",
     api_name => "open-ils.actor.user.transaction.fleshed.retrieve",
     argc     => 1,
+    authoritative => 1,
     notes    => "Returns a fleshed transaction record"
 );
 
@@ -1756,68 +1757,55 @@
     method   => "user_transaction_retrieve",
     api_name => "open-ils.actor.user.transaction.retrieve",
     argc     => 1,
+    authoritative => 1,
     notes    => "Returns a transaction record"
 );
 
 sub user_transaction_retrieve {
-	my( $self, $client, $login_session, $bill_id ) = @_;
+	my($self, $client, $auth, $bill_id) = @_;
 
-	# I think I'm deprecated... make sure.   phasefx says, "No, I'll use you :)
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
 
-	my $trans = $apputils->simple_scalar_request( 
-		"open-ils.cstore",
-		"open-ils.cstore.direct.money.billable_transaction_summary.retrieve",
-		$bill_id
-	);
+    my $trans = $e->retrieve_money_billable_transaction_summary(
+        [$bill_id, {flesh => 1, flesh_fields => {mbts => ['usr']}}]) or return $e->event;
 
-	my( $user_obj, $target, $evt ) = $apputils->checkses_requestor(
-		$login_session, $trans->usr, 'VIEW_USER_TRANSACTIONS' );
-	return $evt if $evt;
-	
-	my $api = $self->api_name();
-	if($api !~ /fleshed/o) { return $trans; }
+    return $e->event unless $e->allowed('VIEW_USER_TRANSACTIONS', $trans->usr->home_ou);
 
-	if( $trans->xact_type ne 'circulation' ) {
-		$logger->debug("Returning non-circ transaction");
-		return {transaction => $trans};
-	}
+    $trans->usr($trans->usr->id); # de-flesh for backwards compat
 
-	my $circ = $apputils->simple_scalar_request(
-			"open-ils.cstore",
-			"open-ils.cstore.direct.action.circulation.retrieve",
-			$trans->id );
+    return $trans unless $self->api_name =~ /flesh/;
+    return {transaction => $trans} if $trans->xact_type ne 'circulation';
 
-	return {transaction => $trans} unless $circ;
-	$logger->debug("Found the circ transaction");
+    my $circ = $e->retrieve_action_circulation([
+        $trans->id, {
+            flesh => 3,
+            flesh_fields => {
+                circ => ['target_copy'],
+                acp => ['call_number'],
+                acn => ['record']
+            }
+        }
+    ]);
 
-	my $title = $apputils->simple_scalar_request(
-		"open-ils.storage", 
-		"open-ils.storage.fleshed.biblio.record_entry.retrieve_by_copy",
-		$circ->target_copy );
-
-	return {transaction => $trans, circ => $circ } unless $title;
-	$logger->debug("Found the circ title");
-
 	my $mods;
-    my $copy = $apputils->simple_scalar_request(
-        "open-ils.cstore",
-        "open-ils.cstore.direct.asset.copy.retrieve",
-        $circ->target_copy );
+    my $copy = $circ->target_copy;
 
-	try {
+    if($circ->target_copy->call_number->id == OILS_PRECAT_CALL_NUMBER) {
+        $mods = new Fieldmapper::metabib::virtual_record;
+        $mods->doc_id(OILS_PRECAT_RECORD);
+        $mods->title($copy->dummy_title);
+        $mods->author($copy->dummy_author);
+
+    } else {
 		my $u = OpenILS::Utils::ModsParser->new();
-		$u->start_mods_batch($title->marc());
+		$u->start_mods_batch($circ->target_copy->call_number->record->marc);
 		$mods = $u->finish_mods_batch();
-	} otherwise {
-		if ($title->id == OILS_PRECAT_RECORD) {
-			$mods = new Fieldmapper::metabib::virtual_record;
-			$mods->doc_id(OILS_PRECAT_RECORD);
-			$mods->title($copy->dummy_title);
-			$mods->author($copy->dummy_author);
-		}
-	};
+	}
 
-	$logger->debug("MODSized the circ title");
+    # more de-fleshiing
+    $circ->target_copy($circ->target_copy->id);
+    $copy->call_number($copy->call_number->id);
 
 	return {transaction => $trans, circ => $circ, record => $mods, copy => $copy };
 }

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2011-02-03 23:50:16 UTC (rev 19378)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2011-02-04 00:14:26 UTC (rev 19379)
@@ -63,7 +63,7 @@
     'BILL_PAY' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.payment' },
     'BLOB_AU_PARTS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.retrieve.parts', 'cacheable' : true, 'ttl' : 120000 },
     'BLOB_MARC_CALLNUMBERS_RETRIEVE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.marc_cn.retrieve', 'secure' : false },
-    'BLOB_MBTS_DETAILS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transaction.fleshed.retrieve', 'secure' : false },
+    'BLOB_MBTS_DETAILS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transaction.fleshed.retrieve.authoritative', 'secure' : false },
     'BLOB_MOBTS_CIRC_MVR_HAVING_BALANCE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.have_balance.fleshed' },
     'BLOB_MOBTS_CIRC_MVR_OPEN' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.transactions.fleshed' },
     'BLOB_BALANCE_OWED_VIA_USERGROUP' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.usergroup.members.balance_owed.authoritative' },



More information about the open-ils-commits mailing list