From: Jason Stephenson Date: Tue, 3 Sep 2013 17:51:06 +0000 (-0400) Subject: Add "backdate" option to set item lost or longoverdue. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fdyrcona%2Fbackdate_lost_or_lod;p=working%2FEvergreen.git Add "backdate" option to set item lost or longoverdue. This optional parameter allows the caller to set the lost date in the past or the future, if their crystal ball is not cloudy. While the staff client may not ever use this option, it comes in handy in some utility scripts. It is also a really handy feature when writing one's own migration scripts. Signed-off-by: Jason Stephenson --- 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 1cf8cc8bed..ecae769173 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm @@ -642,7 +642,7 @@ sub copy_perm_org { sub set_item_lost { - my ($class, $e, $copy_id) = @_; + my ($class, $e, $copy_id, $backdate) = @_; return $class->set_item_lost_or_lod( $e, $copy_id, @@ -656,12 +656,13 @@ sub set_item_lost { bill_fee_note => 'Lost Materials Processing Fee', event => 'COPY_MARKED_LOST', stop_fines => OILS_STOP_FINES_LOST, + stop_fines_time => $backdate || 'now', at_hook => 'lost' ); } sub set_item_long_overdue { - my ($class, $e, $copy_id) = @_; + my ($class, $e, $copy_id, $backdate) = @_; return $class->set_item_lost_or_lod( $e, $copy_id, @@ -675,6 +676,7 @@ sub set_item_long_overdue { bill_fee_note => 'Long Overdue Materials Processing Fee', event => 'COPY_MARKED_LONG_OVERDUE', stop_fines => 'LONGOVERDUE', + stop_fines_time => $backdate || 'now', at_hook => 'longoverdue' ); } @@ -735,7 +737,7 @@ sub set_item_lost_or_lod { # --------------------------------------------------------------------- # mark the circ as lost and stop the fines $circ->stop_fines($args{stop_fines}); - $circ->stop_fines_time('now') unless $circ->stop_fines_time; + $circ->stop_fines_time($args{stop_fines_time}) unless $circ->stop_fines_time; $e->update_action_circulation($circ) or return $e->die_event; # --------------------------------------------------------------------- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm index 94dbaf86b0..7d4acddf3b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm @@ -336,7 +336,7 @@ __PACKAGE__->register_method( signature => q/ Sets the copy and related open circulation to lost @param auth - @param args : barcode + @param args : barcode, backdate / ); @@ -354,7 +354,7 @@ sub new_set_circ_lost { my $copy = $e->search_asset_copy({barcode=>$$args{barcode}, deleted=>'f'})->[0] or return $e->die_event; - my $evt = OpenILS::Application::Cat::AssetCommon->set_item_lost($e, $copy->id); + my $evt = OpenILS::Application::Cat::AssetCommon->set_item_lost($e, $copy->id, $$args{backdate}); return $evt if $evt; $e->commit;