[open-ils-commits] r17116 - branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ (gmc)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 5 21:22:58 EDT 2010


Author: gmc
Date: 2010-08-05 21:22:56 -0400 (Thu, 05 Aug 2010)
New Revision: 17116

Modified:
   branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
bug 614150: bail out on ACTOR_USER_NOT_FOUND

This fixes a bug where uploading an offline checkout
that refers to a missing patron returns an INTERNAL_SERVER_ERROR
instead of ACTOR_USER_NOT_FOUND.  More generally, this avoids
an exception in case case where a circ operation is made
without checking the existence of the patron record beforehand.

mk_env could use a better name, too.

Signed-off-by: Galen Charlton <gmc at esilibrary.com>


Modified: branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2010-08-06 01:22:39 UTC (rev 17115)
+++ branches/rel_1_6_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2010-08-06 01:22:56 UTC (rev 17116)
@@ -556,15 +556,17 @@
 	};
 
 	if( $self->patron_id ) {
-		$patron = $e->retrieve_actor_user([$self->patron_id, $flesh]) or return $e->event;
+		$patron = $e->retrieve_actor_user([$self->patron_id, $flesh])
+			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
 	} elsif( $self->patron_barcode ) {
 
-		my $card = $e->search_actor_card( 
-			{barcode => $self->patron_barcode})->[0] or return $e->event;
+		# note: throwing ACTOR_USER_NOT_FOUND instead of ACTOR_CARD_NOT_FOUND is intentional
+		my $card = $e->search_actor_card({barcode => $self->patron_barcode})->[0] 
+			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
-		$patron = $e->search_actor_user([ 
-			{card => $card->id}, $flesh])->[0] or return $e->event;
+		$patron = $e->search_actor_user([{card => $card->id}, $flesh])->[0]
+			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
 	} else {
 		if( my $copy = $self->copy ) {



More information about the open-ils-commits mailing list