copy details method now returns latest circ, regardless of state
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Aug 2006 16:49:58 +0000 (16:49 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Aug 2006 16:49:58 +0000 (16:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5426 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index c934a55..b869456 100644 (file)
@@ -731,22 +731,13 @@ sub copy_details {
        my $transit = $e->search_action_transit_copy(
                { target_copy => $copy_id, dest_recv_time => undef } )->[0];
 
+       # find the latest circ, open or closed
        my $circ = $e->search_action_circulation(
-               { target_copy => $copy_id, stop_fines => undef })->[0];
-
-       unless( $circ ) {
-               $circ = $e->search_action_circulation(
-                       { 
-                               target_copy => $copy_id, 
-                               xact_finish => undef,
-                               stop_fines      => [ 
-                                       OILS_STOP_FINES_CLAIMSRETURNED, 
-                                       OILS_STOP_FINES_LOST, 
-                                       OILS_STOP_FINES_LONGOVERDUE, 
-                               ]
-                       } 
-               )->[0];
-       }
+               [
+                       { target_copy => $copy_id },
+                       { order_by => { circ => 'xact_start desc' }, limit => 1 }
+               ]
+       )->[0];
 
        return {
                copy            => $copy,