Fix copy deletion in NCIP::ILS::Evergreen->checkinitem.
authorJason Stephenson <jstephenson@mvlc.org>
Tue, 10 Nov 2015 20:05:31 +0000 (15:05 -0500)
committerJason Stephenson <jstephenson@mvlc.org>
Tue, 10 Nov 2015 20:44:15 +0000 (15:44 -0500)
We need to retrieve the copy again after a successful checkin because
its status and other details have changed.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
lib/NCIP/ILS/Evergreen.pm

index d9929e9..cd28ead 100644 (file)
@@ -449,6 +449,12 @@ sub checkinitem {
         $result = $result->[0];
     }
     if ($result->{textcode} eq 'SUCCESS') {
+        # We need to retrieve the copy again because its status may
+        # have changed, and it could have been in a state that won't
+        # let us delete it before the checkin.
+        $details = $self->retrieve_copy_details_by_barcode($copy->barcode());
+        $copy = $details->{copy};
+
         # Delete the copy. Since delete_copy checks ownership
         # before attempting to delete the copy, we don't bother
         # checking who owns it.