LP 1473054: No-op Checkin Should Not Always Float a Floating Copy.
authorJason Stephenson <jason@sigio.com>
Tue, 22 Nov 2016 19:35:58 +0000 (14:35 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 15 Feb 2017 16:25:45 +0000 (11:25 -0500)
Prior to this patch, a no-op checkin would not check if a copy should
float using the evergreen.can_float() function.  It would simply float
the copy to the org_unit where the checkin happened if the copy had a
float value set.

This commit changes the behavior to use evergreen.can_float() to
determine if the copy should float to the org_unit where the checkin
happened.  This change makes the behavior consistent with a regular
checkin.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Josh Stompro <stomproj@larl.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 8daab0c..ad6fff2 100644 (file)
@@ -2605,10 +2605,22 @@ sub do_checkin {
             }
         }
     } else { # no-op checkin
-        if ($U->is_true( $self->copy->floating )) { # XXX floating items still stick where they are even with no-op checkin?
-            $self->checkin_changed(1);
-            $self->copy->circ_lib( $self->circ_lib );
-            $self->update_copy;
+        if ($self->copy->floating) { # XXX floating items still stick where they are even with no-op checkin?
+            my $res = $self->editor->json_query(
+                {
+                    from => [
+                        'evergreen.can_float',
+                        $self->copy->floating->id,
+                        $self->copy->circ_lib,
+                        $self->circ_lib
+                    ]
+                }
+            );
+            if ($res && @$res && $U->is_true($res->[0]->{'evergreen.can_float'})) {
+                $self->checkin_changed(1);
+                $self->copy->circ_lib( $self->circ_lib );
+                $self->update_copy;
+            }
         }
     }