From 46bdd37466a76e3dc491eb4ad6449b83adeae496 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sat, 13 Dec 2014 16:57:31 -0500 Subject: [PATCH 1/1] 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 --- lib/NCIP/ILS/Evergreen.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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. -- 2.43.2