Bug 41034 - Automaticitemreturn and transfer limits interaction is very weird
Summary: Automaticitemreturn and transfer limits interaction is very weird
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-16 15:37 UTC by Baptiste Wojtkowski (bwoj)
Modified: 2025-10-17 06:47 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Wojtkowski (bwoj) 2025-10-16 15:37:41 UTC
in C4/Circulation.pm around 
2530         my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode';
2531         if  (C4::Context->preference("AutomaticItemReturn"    ) or
2532             (C4::Context->preference("UseBranchTransferLimits") and
2533              ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType )
2534            )) {
2535             my $transfer = ModItemTransfer($item->itemnumber, $branch, $returnbranch, $transfer_trigger, { skip_record_index => 1 });
2536             $messages->{'TransferTo'} = $returnbranch;
2537             $messages->{'WasTransfered'} = $transfer->id;
2538             $messages->{'TransferTrigger'} = $transfer_trigger;
# In this case we create a transfer and prompt the librarian "Reason for transfer:"
2539         } else {
2540             $messages->{'NeedsTransfer'} = $returnbranch;
2541             $messages->{'TransferTrigger'} = $transfer_trigger;
# In this case we ask the librarian whether they want to transfer or not
2542         }


These lines make no sense to me, in particular for following reasons:
- If there is AutomaticReturn, a transfer will be created without informing the user, however it is forbidden
- If there is no AutomaticReturn, and branchtransfers is forbidden from target branch to branch where we check-in (yes, in this direction), there will be a transfer without asking to the user.
- Otherwise there is a confirmation box, even if it is a forbidden transfer, and there is no mention that the transfer is forbidden.

If I understand well, there should be 3 cases.
1 - The transfer is not authorized, whatever the syspref AutomaticItemReturn, we inform the librarian that this situation should not have happened and tell to send the book to the proper library (should we there allow to create the transfer by forcing restrictions ?).
2 - The transfer is authorized, and there is an automatic transfer -> fall back in case 1
3 - The transfer is authorized, and there is no automatic transfer -> fall back in case 2
Comment 1 Baptiste Wojtkowski (bwoj) 2025-10-16 15:40:29 UTC
Note: on main the lines are 2701-2717