From: Jason Stephenson Date: Sat, 13 Dec 2014 21:57:31 +0000 (-0500) Subject: Receive or abort transit in NCIP::ILS::Evergreen->checkoutitem. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=46bdd37466a76e3dc491eb4ad6449b83adeae496;p=working%2FNCIPServer.git Receive or abort transit in NCIP::ILS::Evergreen->checkoutitem. If the copy is in transit to or from the working organizational unit of the NCIP staff user, then we have to either receive or abort the transit before the check out can proceed. Signed-off-by: Jason Stephenson --- diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index 37ea5b0..70fe5fb 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -795,6 +795,30 @@ sub checkoutitem { return $response; } + # Check for the copy being in transit and receive or abort it. + my $transit = $U->simplereq( + 'open-ils.circ.open_copy_transit.retrieve', + $self->{session}->{authtoken}, + $copy->id() + ); + if (ref($transit) eq 'Fieldmapper::action::transit_copy') { + if ($transit->dest() == $self->{session}->{work_ou}->id()) { + my $r = $U->simplereq( + 'open-ils.circ', + 'open-ils.circ.copy_transit.receive', + $self->{session}->{authtoken}, + {copyid => $copy->id()} + ); + } elsif ($transit->source() == $self->{session}->{work_ou}->id()) { + my $r = $U->simplereq( + 'open-ils.circ', + 'open-ils.circ.transit.abort', + $self->{session}->{authtoken}, + {copyid => $copy->id()} + ); + } + } + # Now, we attempt the check out. If it fails, we simply say that # the user is not allowed to check out this item, without getting # into details.