# the patron was provided, that it is checked out to the patron in
# question. We also verify the copy ownership and circulation
# location.
- my $problem = $self->check_circ_details($circ, $copy, $user);
+ my $problem = $self->check_circ_details($details, $user);
if ($problem) {
# We need to fill in some information, however.
if (!$problem->ProblemValue() && !$problem->ProblemElement()) {
=head2 check_circ_details
- $problem = $ils->check_circ_details($circ, $copy, $user);
+ $problem = $ils->check_circ_details($details, $user);
Checks if we can checkin or renew a circulation. That is, the
circulation is still open (i.e. the copy is still checked out), if we
either own the copy or are the circulation location, and if the
-circulation is for the optional $user argument. $circ and $copy are
-required. $user is optional.
+circulation is for the optional $user argument. The $details argument
+is required and comes from the retrieve_copy_details call. $user is
+optional.
Returns a problem if any of the above conditions fail. Returns undef
if they pass and we can proceed with the checkin or renewal.
=cut
sub check_circ_details {
- my ($self, $circ, $copy, $user) = @_;
+ my ($self, $details, $user) = @_;
+
+ my $copy = $details->{copy};
+ my $circ = $details->{circ};
+ my $transit = $details->{transit};
# Shortcut for the next check.
my $ou_id = $self->{session}->{work_ou}->id();
- if (!$circ || $circ->checkin_time() || ($circ->circ_lib() != $ou_id && $copy->circ_lib() != $ou_id)) {
+ # We need to have a circulation. The copy needs to either have
+ # been checked out at the NCIP user's working_ou or it needs to be
+ # owned there. If the circulation was subsequently checked in,
+ # then we need an open transit to the NCIP user's working_ou.
+ if (!$circ || ($circ->circ_lib() != $ou_id && $copy->circ_lib() != $ou_id)
+ || ($circ->checkin_time() && (!$transit || $transit->dest() != $ou_id))) {
# Item isn't checked out.
return NCIP::Problem->new(
{