Fix checkout on alternate patron barcode
authorThomas Berezansky <tsbere@mvlc.org>
Sat, 2 Jul 2011 22:50:27 +0000 (18:50 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 5 Jul 2011 19:21:57 +0000 (15:21 -0400)
Specifically, when a non-primary patron barcode is used.
Such as via SIP2.

NOTE: This does not change the behavior of inactive cards, nor
will stock Evergreen usage produce a situation where this fix
comes into play. --miker

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 0b36f40..2d42704 100644 (file)
@@ -764,9 +764,12 @@ sub mk_env {
                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]
+               $patron = $e->retrieve_actor_user($card->usr)
                        or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
+        # Use the card we looked up, not the patron's primary, for card active checks
+        $patron->card($card);
+
     } else {
         if( my $copy = $self->copy ) {