Bug 22042

Summary: BlockReturnofWithdrawn Items does not block refund generation when item is withdrawn and lost
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: Fines and feesAssignee: Nick Clemens <nick>
Status: Pushed to oldoldstable --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, azucena.aguayo, bdaeuber, jonathan.druart, lucas, martin.renvoize, michalurban177, nick, wainuiwitikapark
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35587
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.02,22.05.09, 21.11.16
Attachments: Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block
Bug 22042: [22.05.x] Block all return actions when BlockReturnOfWithdrawn items is set to block

Description Andrew Fuerste-Henry 2018-12-21 15:37:49 UTC
If BlockReturnofWithdrawnItems is set to block and an item that is both withdrawn and lost is checked in, Koha will not mark the item as returned but will mark it as found and generate a refund if circ rules allow refunds.

To test:
- Set BlockReturnofWithdrawnItems to Block
- Set BlockReturnofLostItems to Don't Block
- Set Default lost item fee refund on return policy to Yes
- Check out an item with a replacement cost to a patron
- Mark the item as lost
- Mark the item as withdrawn
- Note that the patron now has a charge for the replacement fee
- Check the item in
- Note that the patron now has a credit for the replacement fee
Comment 1 Andrew Fuerste-Henry 2018-12-21 15:38:47 UTC
Bug 21231 plugged this same hole for BlockReturnofLostItems:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21231
Comment 2 Azucena Aguayo 2020-01-23 18:37:05 UTC
This is a problematic bug for our library.

We've been on Koha for a few months and have just encounter this bug.

We use this setting to prevent our employees from check in items that our library cannot accept back. Either due to a no refund policy or due to collection agency rules.
Comment 3 Andrew Fuerste-Henry 2021-03-12 18:06:11 UTC
Still valid on master
Comment 4 Azucena Aguayo 2021-10-25 18:15:14 UTC
This bug continues to cause problems with lost-paid items that we cannot accept back and refund the money.
Comment 5 Nick Clemens 2022-04-08 18:55:33 UTC
Created attachment 133123 [details] [review]
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
Comment 6 Michal Urban 2022-06-28 18:02:42 UTC
Created attachment 136693 [details] [review]
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>
Comment 7 Martin Renvoize 2022-07-15 15:00:34 UTC
Comment on attachment 136693 [details] [review]
Bug 22042: Block all return actions when BlockReturnOfWithdrawn items is set to block

Review of attachment 136693 [details] [review]:
-----------------------------------------------------------------

Sorry Nick.. this doesn't look quite right yet..

::: C4/Circulation.pm
@@ +2096,5 @@
>  
> +    if ( $item->withdrawn ) { # book has been cancelled
> +        $messages->{'withdrawn'} = 1;
> +        $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems");
> +        return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));

This doesn't look quite right to me.. we're returning early now regardless of the BlockReturnOfWithdrawnItems preference?
Comment 8 Nick Clemens 2022-11-07 14:43:31 UTC
Created attachment 143373 [details] [review]
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
Comment 9 ByWater Sandboxes 2022-11-07 17:53:16 UTC
Created attachment 143379 [details] [review]
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: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 10 Kyle M Hall 2023-01-13 15:43:34 UTC
Created attachment 145279 [details] [review]
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: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Martin Renvoize 2023-01-18 15:49:55 UTC
Nice work everyone!

Pushed to 23.05.x for the next release
Comment 12 Jacob O'Mara 2023-01-18 17:05:38 UTC
Nice work, thanks everyone!

Pushed to 22.11.x for the next release.
Comment 13 Lucas Gass 2023-01-24 19:02:13 UTC
tests don't apply cleanly to 22.05.x, no backport. If needed please rebase
Comment 14 Nick Clemens 2023-01-25 12:32:49 UTC
Created attachment 145659 [details] [review]
Bug 22042: [22.05.x] 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: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Lucas Gass 2023-01-25 15:59:07 UTC
Backported to 22.05.x for upcoming 22.05.09
Comment 16 Arthur Suzuki 2023-01-26 13:48:23 UTC
applied to 21.11.x for 21.11.16.
Comment 17 wainuiwitikapark 2023-03-15 01:37:21 UTC
Not backported to 21.05.x