From: erickson Date: Thu, 10 Aug 2006 16:49:58 +0000 (+0000) Subject: copy details method now returns latest circ, regardless of state X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=37086fc4829521e4dc4962b25390af9938589a46;p=Evergreen.git copy details method now returns latest circ, regardless of state git-svn-id: svn://svn.open-ils.org/ILS/trunk@5426 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index c934a55350..b86945694b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -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,