From: blake Date: Fri, 3 Feb 2017 22:45:29 +0000 (-0600) Subject: LP1170795_Deposit_base_with_LP1331174 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=176c2996729b6f83e6121ff0f2d163b7469d34fd;p=working%2FEvergreen.git LP1170795_Deposit_base_with_LP1331174 Introduce a library setting circ.void_item_deposit. When set, the money.billing deposit row will be voided. Signed-off-by: blake --- 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 8daab0cb9e..220bf4fc34 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm @@ -2429,6 +2429,9 @@ sub do_checkin { $self->handle_fines; } + # Void any item deposits if the library wants to + $self->check_circ_deposit(1); + $self->checkin_handle_circ_finish; return if $self->bail_out; $self->checkin_changed(1); @@ -2672,8 +2675,10 @@ sub finish_fines_and_voiding { # if a deposit was payed for this item, push the event +# handle deposit billing void sub check_circ_deposit { my $self = shift; + my $void = shift; return unless $self->circ; my $deposit = $self->editor->search_money_billing( { btype => 5, @@ -2681,8 +2686,20 @@ sub check_circ_deposit { voided => 'f' }, {idlist => 1})->[0]; - $self->push_events(OpenILS::Event->new( - 'ITEM_DEPOSIT_PAID', payload => $deposit)) if $deposit; + if ($deposit) { + # We have already vetted the override event when $void is set + $self->push_events(OpenILS::Event->new('ITEM_DEPOSIT_PAID', payload => $deposit)) if !$void; + # Now do the voiding when the library setting is set + if ( $U->ou_ancestor_setting_value( + $self->circ_lib, + OILS_SETTING_VOID_ITEM_DEPOSIT_ON_CHECKIN, + $self->editor) && $void + ) { + my $circ_money = OpenSRF::AppSession->connect("open-ils.circ"); + $circ_money->request('open-ils.circ.money.billing.void', $self->editor->authtoken, $deposit ); + undef $circ_money; + } + } } sub reshelve_copy { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm index 7919d5d886..d87d6367f4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm @@ -99,6 +99,7 @@ econst OILS_SETTING_LOST_IMMEDIATELY_AVAILABLE => 'circ.lost_immediatel econst OILS_SETTING_BLOCK_HOLD_FOR_EXPIRED_PATRON => 'circ.holds.expired_patron_block'; econst OILS_SETTING_GENERATE_OVERDUE_ON_LOST_RETURN => 'circ.lost.generate_overdue_on_checkin'; econst OILS_SETTING_LONG_OVERDUE_ASSESS_BILLING => 'circ.longoverdue.assess_billing'; +econst OILS_SETTING_VOID_ITEM_DEPOSIT_ON_CHECKIN => 'circ.void_item_deposit'; diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 779947cd86..e2dd3d8190 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -3689,6 +3689,15 @@ INSERT into config.org_unit_setting_type 'coust', 'description'), 'bool', null) +,( 'circ.void_item_deposit', 'circ', + oils_i18n_gettext('circ.void_item_deposit', + 'Void item depsoit fee upon checkin', + 'coust', 'label'), + oils_i18n_gettext('circ.void_item_deposit', + 'This will cause the deposit fee to be voided upon checkin', + 'coust', 'description'), + 'bool', null) + ,( 'circ.void_lost_proc_fee_on_checkin', 'circ', oils_i18n_gettext('circ.void_lost_proc_fee_on_checkin', 'Void processing fee on lost item return', diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1170795_Deposit_refunds_not_applying_as_expected_on_item_check_in.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1170795_Deposit_refunds_not_applying_as_expected_on_item_check_in.sql new file mode 100755 index 0000000000..11eb4c8f05 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1170795_Deposit_refunds_not_applying_as_expected_on_item_check_in.sql @@ -0,0 +1,17 @@ + +BEGIN; + + +INSERT into config.org_unit_setting_type +( name, grp, label, description, datatype, fm_class ) VALUES + +( 'circ.void_item_deposit', 'circ', + oils_i18n_gettext('circ.void_item_deposit', + 'Void item depsoit fee upon checkin', + 'coust', 'label'), + oils_i18n_gettext('circ.void_item_deposit', + 'This will cause the deposit fee to be voided upon checkin', + 'coust', 'description'), + 'bool', null); + +COMMIT; \ No newline at end of file