From ae24ed11093e9d00f68d78b6ea1ca021dd6e91e8 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 9 Sep 2009 23:23:06 +0200 Subject: [PATCH] [replaceprevious](bug #3562) fix returning document in another branch there is no transfert alert if you make a return in another branch than the homebranch. --- C4/Circulation.pm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index c260c1ef46..ab03ac7f34 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1335,20 +1335,19 @@ sub AddReturn { $messages->{'BadBarcode'} = $barcode; $doreturn = 0; } else { - if ( not %$iteminformation ) { + # find the borrower + if ( not $iteminformation->{borrowernumber} ) { $messages->{'NotIssued'} = $barcode; - # even though item is not on loan, it may still - # be transferred; therefore, get current branch information - my $curr_iteminfo = GetItem($itemnumber); - $iteminformation->{'itemnumber'} = $curr_iteminfo->{'itemnumber'}; - $iteminformation->{'homebranch'} = $curr_iteminfo->{'homebranch'}; - $iteminformation->{'holdingbranch'} = $curr_iteminfo->{'holdingbranch'}; - $iteminformation->{'itemlost'} = $curr_iteminfo->{'itemlost'}; - # These lines patch up $iteminformation enough so it can be used below for other messages $doreturn = 0; } - - my $hbr = $iteminformation->{C4::Context->preference("HomeOrHoldingBranch")} || ''; + + # even though item is not on loan, it may still + # be transferred; therefore, get current branch information + my $curr_iteminfo = GetItem($iteminformation->{'itemnumber'}); + $iteminformation->{'homebranch'} = $curr_iteminfo->{'homebranch'}; + $iteminformation->{'holdingbranch'} = $curr_iteminfo->{'holdingbranch'}; + $iteminformation->{'itemlost'} = $curr_iteminfo->{'itemlost'}; + # check if the book is in a permanent collection.... # FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. if ( $hbr ) { @@ -1450,7 +1449,7 @@ sub AddReturn { #adding message if holdingbranch is non equal a userenv branch to return the document to homebranch #we check, if we don't have reserv or transfert for this document, if not, return it to homebranch . - if ($doreturn and ($branch ne $iteminformation->{$hbr}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){ + if (($doreturn or $messages->{'NotIssued'}) and ($branch ne $iteminformation->{$hbr}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){ if (C4::Context->preference("AutomaticItemReturn") == 1) { ModItemTransfer($iteminformation->{'itemnumber'}, C4::Context->userenv->{'branch'}, $iteminformation->{$hbr}); $messages->{'WasTransfered'} = 1; -- 2.39.5