| Lines 2133-2144
          sub AddReturn {
      
      
        Link Here | 
        
          | 2133 |  | 2133 |  | 
        
          | 2134 |     my $floatingType = Koha::FloatingMatrix::CheckFloating($item, $branch, $returnbranch); | 2134 |     my $floatingType = Koha::FloatingMatrix::CheckFloating($item, $branch, $returnbranch); | 
        
          | 2135 |     # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer | 2135 |     # Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer | 
          
            
              | 2136 |     if (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'} && (not($floatingType) || $floatingType eq 'POSSIBLE')){ | 2136 |     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')){ | 
        
          | 2137 |         my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode'; | 2137 |         my $BranchTransferLimitsType = C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ? 'effective_itemtype' : 'ccode'; | 
          
            
              | 2138 |         if  ( not($floatingType && $floatingType eq 'POSSIBLE') and | 2138 |         if  ( not ($floatingType && $floatingType eq 'POSSIBLE') and | 
            
              | 2139 |             (C4::Context->preference("AutomaticItemReturn"    ) or | 2139 |             ( | 
            
              | 2140 |             (C4::Context->preference("UseBranchTransferLimits") and | 2140 |                 C4::Context->preference("AutomaticItemReturn") or | 
            
              | 2141 |              ! IsBranchTransferAllowed($branch, $returnbranch, $item->$BranchTransferLimitsType ))) | 2141 |                 (C4::Context->preference("UseBranchTransferLimits") and | 
            
              |  |  | 2142 |                  ! IsBranchTransferAllowed($branch, $returnbranch, $item->{C4::Context->preference("BranchTransferLimitsType")} )) | 
            
              | 2143 |             )           | 
        
          | 2142 |            ) | 2144 |            ) | 
        
          | 2143 |         { | 2145 |         { | 
        
          | 2144 |             $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $returnbranch; | 2146 |             $debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $returnbranch; | 
  
    | Lines 2152-2158
          sub AddReturn {
      
      
        Link Here | 
        
          | 2152 |     #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. | 2154 |     #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. | 
        
          | 2153 |     elsif (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) | 2155 |     elsif (!$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) | 
        
          | 2154 |         and !$resfound and ($branch ne $returnbranch) | 2156 |         and !$resfound and ($branch ne $returnbranch) | 
          
            
              | 2155 |         and not($messages->{'WrongTransfer'}) | 2157 |         and not $messages->{'WrongTransfer'} | 
        
          | 2156 |         && $floatingType){ #So if we would otherwise transfer, but we have a floating rule overriding it. | 2158 |         && $floatingType){ #So if we would otherwise transfer, but we have a floating rule overriding it. | 
        
          | 2157 |                            #We can infer that the transfer was averted because of a floating rule. | 2159 |                            #We can infer that the transfer was averted because of a floating rule. | 
        
          | 2158 |         #Make sure we dont log the same floating denial multiple times | 2160 |         #Make sure we dont log the same floating denial multiple times | 
            
              | 2159 | -  |  |  |