From 27e32d09248a684e6291dd0aca5af4408271a352 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Mon, 5 Dec 2011 11:44:41 -0500 Subject: [PATCH] Code comments and tweaks for lost processing This commit is intended to do the following: * Fix case where MISSING status is not retained for items being sent 'home' (as it was in previous versions) * Be more explicit about when we unset the LOST status and when we do not in checkin_handle_lost() * Prevent update of the copy in checkin_handle_lost() unless we actually change the status * Restore log messages for special handling of LOST/MISSING checkins away from 'home' * Provide additional code comments to clarify intended behavior Note: Given the current restructure, MISSING item behavior is no longer affected by 'lost_immediately_available' setting. That seemed more bug than feature, and can be implemented later (perhaps as a separate setting) if required. Signed-off-by: Dan Wells Signed-off-by: Jason Stephenson --- .../lib/OpenILS/Application/Circ/Circulate.pm | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm index c00d662e56..50ef6d6d73 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -3297,11 +3297,17 @@ sub checkin_handle_circ { my $stat = $U->copy_status($self->copy->status)->id; if ($stat == OILS_COPY_STATUS_LOST) { - + # we will now handle lost fines, but the copy will retain its 'lost' + # status if it needs to transit home unless lost_immediately_available + # is true + # + # if we decide to also delay fine handling until the item arrives home, + # we will need to call lost fine handling code both when checking items + # in and also when receiving transits $self->checkin_handle_lost($circ_lib); - + } elsif ($circ_lib != $self->circ_lib and $stat == OILS_COPY_STATUS_MISSING) { + $logger->info("circulator: not updating copy status on checkin because copy is missing"); } else { - $self->copy->status($U->copy_status(OILS_COPY_STATUS_RESHELVING)); $self->update_copy; } @@ -3360,12 +3366,25 @@ sub checkin_handle_lost { $self->checkin_handle_lost_now_found_restore_od($circ_lib) if $restore_od && ! $self->void_overdues; } - my $immediately_available = $U->ou_ancestor_setting_value( - $circ_lib, OILS_SETTING_LOST_IMMEDIATELY_AVAILABLE, $self->editor) || 0; + if ($circ_lib != $self->circ_lib) { + # if the item is not home, check to see if we want to retain the lost + # status at this point in the process + my $immediately_available = $U->ou_ancestor_setting_value($circ_lib, OILS_SETTING_LOST_IMMEDIATELY_AVAILABLE, $self->editor) || 0; - $self->copy->status($U->copy_status(OILS_COPY_STATUS_RESHELVING)) if ($immediately_available); - - $self->update_copy; + if ($immediately_available) { + # lost item status does not need to be retained, so give it a + # reshelving status as if it were a normal checkin + $self->copy->status($U->copy_status(OILS_COPY_STATUS_RESHELVING)); + $self->update_copy; + } else { + $logger->info("circulator: not updating copy status on checkin because copy is lost"); + } + } else { + # lost item is home and processed, treat like a normal checkin from + # this point on + $self->copy->status($U->copy_status(OILS_COPY_STATUS_RESHELVING)); + $self->update_copy; + } } -- 2.43.2