From 388e5cba49295ad50f8e14ceb0eaf75dc099beb5 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 13 Sep 2018 15:20:36 -0400 Subject: [PATCH] LP#1562061 Make Lost/Long-overdue billings exclusive It would be nice if, for purposes of status, we could mark long- overdue items as lost, but without causing any duplicate billings. This code interprets any long-overdue/lost billing as "final" for automation purposes, and then only generates bills (and potentially reopens xacts) in cases where no "final" billing has yet taken place (based on stopfines). (indenting left in place for readability, handled in follow-up) Signed-off-by: Dan Wells --- .../src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 e52d94f341..e3de9e4d0e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm @@ -807,7 +807,6 @@ sub set_item_lost { $e, $copy_id, perm => 'SET_CIRC_LOST', status => OILS_COPY_STATUS_LOST, - alt_status => 16, #Long Overdue, ous_proc_fee => OILS_SETTING_LOST_PROCESSING_FEE, ous_void_od => OILS_SETTING_VOID_OVERDUE_ON_LOST, bill_type => 3, @@ -826,8 +825,7 @@ sub set_item_long_overdue { return $class->set_item_lost_or_lod( $e, $copy_id, perm => 'SET_CIRC_LONG_OVERDUE', - status => 16, # Long Overdue - alt_status => OILS_COPY_STATUS_LOST, + status => OILS_COPY_STATUS_LONG_OVERDUE, ous_proc_fee => 'circ.longoverdue_materials_processing_fee', ous_void_od => 'circ.void_overdue_on_longoverdue', bill_type => 10, @@ -861,7 +859,7 @@ sub set_item_lost_or_lod { $e->allowed($args{perm}, $circ->circ_lib) or return $e->die_event; return $e->die_event(OpenILS::Event->new($args{event})) - if ($copy->status == $args{status} || $copy->status == $args{alt_status}); + if ($copy->status == $args{status}); # --------------------------------------------------------------------- # fetch the related org settings @@ -877,6 +875,11 @@ sub set_item_lost_or_lod { $copy->edit_date('now'); $e->update_asset_copy($copy) or return $e->die_event; + # --------------------------------------------------------------------- + # we only figure fines once for lost/long-overdue events on the same + # circulation + my $stop_fines = $circ->stop_fines || ''; + if ($stop_fines !~ /^(LOST|LONGOVERDUE)$/) { my $price = $U->get_copy_price($e, $copy, $copy->call_number); if( $price > 0 ) { @@ -908,6 +911,7 @@ sub set_item_lost_or_lod { my $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($e, $circ->id); return $evt if $evt; + } my $ses = OpenSRF::AppSession->create('open-ils.trigger'); $ses->request( -- 2.11.0