@@ -, +, @@ doesn't re-route item to correct library --- C4/Circulation.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -2042,15 +2042,22 @@ sub AddReturn { } # find reserves..... - # if we don't have a reserve with the status W, we launch the Checkreserves routine my ($resfound, $resrec); my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'}, undef, $lookahead ) unless ( $item->{'withdrawn'} ); - if ($resfound) { + if ($resfound eq 'Waiting' and $resrec->{branchcode} ne $branch){ #If we have a waiting reserve returned at another branch it no longer waiting + $messages->{'WrongTransfer'} = $resrec->{branchcode}; + $messages->{'WrongTransferItem'} = $resrec->{'itemnumber'}; + C4::Reserves::RevertWaitingStatus({itemnumber=>$resrec->{itemnumber}}); + $validTransfert = 1; + $messages->{'ResFound'} = $resrec; + } + elsif ($resfound) { $resrec->{'ResFound'} = $resfound; $messages->{'ResFound'} = $resrec; } + # Record the fact that this book was returned. UpdateStats({ branch => $branch, --