From f0e726474a09f8a06b1f00e2624848bd7dea26fe Mon Sep 17 00:00:00 2001 From: Johanna Raisa Date: Mon, 25 Sep 2017 14:21:29 +0300 Subject: [PATCH 1/2] Bug 9525: Fixing floating on return --- C4/Circulation.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 92c013318a..a8b2add6ae 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2133,12 +2133,14 @@ sub AddReturn { my $floatingType = Koha::FloatingMatrix::CheckFloating($item, $branch, $returnbranch); # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer - if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'} && (not($floatingType) || $floatingType eq 'POSSIBLE')){ + if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'} and (not $floatingType || $floatingType eq 'POSSIBLE')){ my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode'; - if ( not($floatingType && $floatingType eq 'POSSIBLE') and - (C4::Context->preference("AutomaticItemReturn" ) or - (C4::Context->preference("UseBranchTransferLimits") and - ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType ))) + if ( not ($floatingType && $floatingType eq 'POSSIBLE') and + ( + C4::Context->preference("AutomaticItemReturn") or + (C4::Context->preference("UseBranchTransferLimits") and + ! IsBranchTransferAllowed($branch, $returnbranch, $item->{C4::Context->preference("BranchTransferLimitsType")} )) + ) ) { $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $returnbranch; @@ -2152,7 +2154,7 @@ sub AddReturn { #This elsif-clause copypastes the upper if-clause. This is horrible and I cry, but cannot refactor this mess now :( due to Koha upstream master stuff looming. elsif (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) - and not($messages->{'WrongTransfer'}) + and not $messages->{'WrongTransfer'} && $floatingType){ #So if we would otherwise transfer, but we have a floating rule overriding it. #We can infer that the transfer was averted because of a floating rule. #Make sure we dont log the same floating denial multiple times -- 2.17.1