From 8aef3eaafb67796a99b82d8c6723d7ca6d8db78c Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Wed, 31 Oct 2018 10:27:41 +0000 Subject: [PATCH] Bug 21732: Clean up outstanding transfers on lost items When an item is marked as lost, the routine should also clean up any outstanding transfers. --- C4/Circulation.pm | 6 ++++++ ...tanding_branch_transfers_when_marked_as_lost_syspref.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_21732-cancel_outstanding_branch_transfers_when_marked_as_lost_syspref.sql diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 50d5e6d78f..f436a5e54d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3679,6 +3679,12 @@ sub LostItem{ MarkIssueReturned($borrowernumber,$itemnumber,undef,undef,$patron->privacy) if $mark_returned; } + + my $transfers = GetTransfers($itemnumber); + if ( C4::Context->preference('LostItemCancelOutstandingTransfers') && $transfers ) { + my $deletedtransfer = DeleteTransfer($itemnumber); + } + } sub GetOfflineOperations { diff --git a/installer/data/mysql/atomicupdate/bug_21732-cancel_outstanding_branch_transfers_when_marked_as_lost_syspref.sql b/installer/data/mysql/atomicupdate/bug_21732-cancel_outstanding_branch_transfers_when_marked_as_lost_syspref.sql new file mode 100644 index 0000000000..dfb0b236ee --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21732-cancel_outstanding_branch_transfers_when_marked_as_lost_syspref.sql @@ -0,0 +1 @@ +INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('LostItemCancelOutstandingTransfers', 0, 'Enable|Disable', 'When an item marked as lost has a outstanding branch transfer, cancel the outstanding transfer', 'YesNo'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 2407b6c681..c5cdca0f2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -595,6 +595,12 @@ Circulation: - pref: ReservesMaxPickUpDelay class: integer - days. + - + - pref: LostItemCancelOutstandingTransfers + choices: + yes: "Enable" + no: "Disable" + - When an item marked as lost has a outstanding branch transfer, cancel the outstanding transfer - - pref: ExpireReservesMaxPickUpDelay choices: -- 2.19.1