Commit e9503f2f authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen Committed by Petter Goksøyr Åsen
Browse files

DEICH-5580 consider c/o location on checkin

Unfortunately, we haven't completed the transition to using
item location lives|goes|co, but still is left with a mix of
old logic (read: branchtransfers) and partly implemented location
logic.

This change makes checkin consider the branch of c/o location if present,
and complete branchtransfer if the branch is the same as the branch
where the checkin is performed, disregarding the branchtransfer.tobranch.
parent 6b56287f
......@@ -125,9 +125,20 @@ sub Checkin {
}
# IN TRANSFER?
my $co_branch;
try { $self->Deichman::Item::Transfer::GetActive() };
if ($self->{transfer}) {
if ($self->{transfer}->{tobranch} eq $self->{library}->{branchcode}) {
# If location c/o is set, we need to match for that as well, to
# ensure item is marked as arrived and available if it c/o location
# belongs to the branch where checkin is beeing beformed.
# TODO this is a temporary hack until we have removed branchtransfers
# and completed the transiation to using location
my $co = $self->{location}->{co};
$co_branch = $co ? (split /\./, $co)[0] : undef;
if (($self->{transfer}->{tobranch} eq $self->{library}->{branchcode}) or
($co and $self->{library}->{branchcode} eq $co_branch)) {
# ARRIVED AT RIGHT BRANCH
$self->Deichman::Item::Transfer::FinishActive();
} else {
......@@ -219,7 +230,7 @@ sub Checkin {
# TODO: This should be rewritten much simpler with location
# getBranchItemRule doesnt do what it says...it just returns item's homebranch
# Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer
$returnbranch ||= $self->getBranchItemRule();
$returnbranch ||= ($co_branch or $self->getBranchItemRule());
my $is_in_rotating_collection = C4::RotatingCollections::isItemInAnyCollection( $self->{item}->{itemnumber} );
# FIX TRANSFER WHEN WRONG BRANCH - Should this use return branch policies?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment