Bugzilla – Attachment 136693 Details for
Bug 22042
BlockReturnofWithdrawn Items does not block refund generation when item is withdrawn and lost
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug-22042-Block-all-return-actions-when-BlockRetur.patch (text/plain), 2.80 KB, created by
Michal Urban
on 2022-06-28 18:02:42 UTC
(
hide
)
Description:
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Filename:
MIME Type:
Creator:
Michal Urban
Created:
2022-06-28 18:02:42 UTC
Size:
2.80 KB
patch
obsolete
>From a56329141b9bacfe88ce9a10b67ed77d31fbb4a7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 8 Apr 2022 18:52:09 +0000 >Subject: [PATCH] Bug 22042: Block all return actions when > BlockReturnOfWithdrawn items is set to block > >Currently this syspref only bokcs the literal 'return' from a patron, i.e. the checkin > >It still processes transfers, refunds lost items, updates NotForLoan status etc. > >We should block all of these things > >To test: >1 - Set BlockReturnOfWithdrawn to block >2 - Set an item as lost and withdrawn >3 - Check it in >4 - Item is found >5 - Apply patch >6 - Repeat 1-3 >7 - Checkin is blocked, item still lost > >Signed-off-by: Michal Urban <michalurban177@gmail.com> >--- > C4/Circulation.pm | 12 +++++++----- > t/db_dependent/Circulation.t | 14 ++++++++++++++ > 2 files changed, 21 insertions(+), 5 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 457f9e5b5a..eabdabc7c3 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2094,6 +2094,13 @@ sub AddReturn { > } > } > >+ if ( $item->withdrawn ) { # book has been cancelled >+ $messages->{'withdrawn'} = 1; >+ $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); >+ return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); >+ } >+ >+ > # full item data, but no borrowernumber or checkout info (no issue) > my $hbr = GetBranchItemRule($item->homebranch, $itemtype)->{'returnbranch'} || "homebranch"; > # get the proper branch to which to return the item >@@ -2163,11 +2170,6 @@ sub AddReturn { > return ( $doreturn, $messages, $issue, $patron_unblessed); > } > >- if ( $item->withdrawn ) { # book has been cancelled >- $messages->{'withdrawn'} = 1; >- $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); >- } >- > if ( $item->itemlost and C4::Context->preference("BlockReturnOfLostItems") ) { > $doreturn = 0; > } >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e2a1d5dbf9..0be649f91d 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -5470,6 +5470,20 @@ subtest "GetSoonestRenewDate tests" => sub { > ); > }; > >+subtest 'Tests for BlockReturnOfWithdrawnItems' => sub { >+ >+ plan tests => 1; >+ >+ t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1); >+ my $item = $builder->build_sample_item(); >+ $item->withdrawn(1)->itemlost(1)->store; >+ my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); >+ is_deeply( >+ \@return, >+ [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "Item returned as withdrawn, no other messages"); >+ >+}; >+ > $schema->storage->txn_rollback; > C4::Context->clear_syspref_cache(); > $branches = Koha::Libraries->search(); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22042
:
133123
|
136693
|
143373
|
143379
|
145279
|
145659