From f6a10f23f413f42b6364a7e309238f00d54aa9bf Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 8 Sep 2013 12:41:34 -0400 Subject: [PATCH] Swap order of circ and copy updates in AssetCommon->set_item_lost_or_lod We update the copy's status and status_changed_time after updating the stop_fines of the ciculation because a trigger on action.circulation will update the copy's status which causes our status_changed_time to be overwritten. Signed-off-by: Jason Stephenson --- .../lib/OpenILS/Application/Cat/AssetCommon.pm | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm index ce2fbd7278..d0b7167a0b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm @@ -712,6 +712,25 @@ sub set_item_lost_or_lod { $owning_lib, $args{ous_void_od}, $e) || 0; # --------------------------------------------------------------------- + # mark the circ as lost and stop the fines + $circ->stop_fines($args{stop_fines}); + $circ->stop_fines_time($args{stop_fines_time}) unless $circ->stop_fines_time; + $e->update_action_circulation($circ) or return $e->die_event; + + # --------------------------------------------------------------------- + # void all overdue fines on this circ if configured + if( $void_overdue ) { + my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ); + return $evt if $evt; + } + + # --------------------------------------------------------------------- + # Update trigger on action.circulation will change the status on + # the copy when the circulation is updated, so we need to update + # the copy after updating the circulation to prevent our + # status_changed_time from being overwritten when we try to + # backdate. + # --------------------------------------------------------------------- # move the copy into LOST status $copy->status($args{status}); $copy->status_changed_time($args{stop_fines_time}); @@ -735,19 +754,6 @@ sub set_item_lost_or_lod { return $evt if $evt; } - # --------------------------------------------------------------------- - # mark the circ as lost and stop the fines - $circ->stop_fines($args{stop_fines}); - $circ->stop_fines_time($args{stop_fines_time}) unless $circ->stop_fines_time; - $e->update_action_circulation($circ) or return $e->die_event; - - # --------------------------------------------------------------------- - # void all overdue fines on this circ if configured - if( $void_overdue ) { - my $evt = OpenILS::Application::Circ::CircCommon->void_overdues($e, $circ); - return $evt if $evt; - } - my $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($e, $circ->id); return $evt if $evt; -- 2.11.0