From 632955332d947e5a16fe0870f0209edd1671b092 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Tue, 23 Dec 2008 15:14:27 +0100 Subject: [PATCH] (bug #2750) Cannot return to another branch if the independantbranch option is set as ON The code was modified to change the holding branch ONLY if the return to the right branch is done. If you set IndependantBranch to on, you must return the document to the HomeBranch. And verify the return is done before show the message that allow to transfert the document to another branch. Signed-off-by: Galen Charlton --- C4/Circulation.pm | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 091c1a7938..210b8ff326 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1459,22 +1459,23 @@ sub AddReturn { } MarkIssueReturned($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'},$circControlBranch); $messages->{'WasReturned'} = 1; # FIXME is the "= 1" right? - } - - # continue to deal with returns cases, but not only if we have an issue + - # the holdingbranch is updated if the document is returned in an other location . - if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} ) { - UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'}); - # reload iteminformation holdingbranch with the userenv value - $iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'}; + # continue to deal with returns cases, but not only if we have an issue + + # the holdingbranch is updated if the document is returned in an other location . + if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} ) { + UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'}); + # reload iteminformation holdingbranch with the userenv value + $iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'}; + } + ModDateLastSeen( $iteminformation->{'itemnumber'} ); + ModItem({ onloan => undef }, $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'}); + + if ($iteminformation->{borrowernumber}){ + ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 ); + } } - ModDateLastSeen( $iteminformation->{'itemnumber'} ); - ModItem({ onloan => undef }, $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'}); - - if ($iteminformation->{borrowernumber}){ - ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 ); - } # fix up the accounts..... if ( $iteminformation->{'itemlost'} ) { $messages->{'WasLost'} = 1; @@ -1555,7 +1556,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 ( ( $branch ne $iteminformation->{'homebranch'}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){ + if ($doreturn and ($branch ne $iteminformation->{'homebranch'}) 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->{'homebranch'}); $messages->{'WasTransfered'} = 1; -- 2.39.2