$messages->{'WasReturned'} = 1; # FIXME is the "= 1" right? This could be the borrower hash.
}
-
-
- # We update the holdingbranch from circControlBranch variable
- UpdateHoldingbranch($circControlBranch,$item->{'itemnumber'});
- $item->{'holdingbranch'} = $circControlBranch;
-
-
+ # the holdingbranch is updated if the document is returned to another location.
+ if ($item->{'holdingbranch'} ne $branch) {
+ UpdateHoldingbranch($branch, $item->{'itemnumber'});
+ $item->{'holdingbranch'} = $branch; # update item data holdingbranch too
+ }
ModDateLastSeen( $item->{'itemnumber'} );
ModItem({ onloan => undef }, $issue->{'biblionumber'}, $item->{'itemnumber'});
}