From 37abdcb3f94014327522b5221226d1106556f1f8 Mon Sep 17 00:00:00 2001
From: senator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Wed, 27 Oct 2010 21:20:53 +0000
Subject: [PATCH] If we already know we're not using booking, skip a redundant
 and expensive test for the possibility of capturing a hold. We're just going
 to try actually doing it a little farther down.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18514 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 .../perlmods/OpenILS/Application/Circ/Circulate.pm | 38 ++++++++++++----------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
index 75bbccdd6d..64326432a4 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
@@ -2323,23 +2323,27 @@ sub do_checkin {
     if(!$self->noop) { # /not/ a no-op checkin, capture for hold or put item into transit
 
         if (!$self->remote_hold) {
-            my $potential_hold = $self->hold_capture_is_possible;
-            my $potential_reservation = $self->use_booking && $self->reservation_capture_is_possible;
-
-            if ($potential_hold and $potential_reservation) {
-                $logger->info("circulator: item could fulfill either hold or reservation");
-                $self->push_events(new OpenILS::Event(
-                    "HOLD_RESERVATION_CONFLICT",
-                    "hold" => $potential_hold,
-                    "reservation" => $potential_reservation
-                ));
-                return if $self->bail_out;
-            } elsif ($potential_hold) {
-                $needed_for_something =
-                    $self->attempt_checkin_hold_capture;
-            } elsif ($potential_reservation) {
-                $needed_for_something =
-                    $self->attempt_checkin_reservation_capture;
+            if ($self->use_booking) {
+                my $potential_hold = $self->hold_capture_is_possible;
+                my $potential_reservation = $self->reservation_capture_is_possible;
+
+                if ($potential_hold and $potential_reservation) {
+                    $logger->info("circulator: item could fulfill either hold or reservation");
+                    $self->push_events(new OpenILS::Event(
+                        "HOLD_RESERVATION_CONFLICT",
+                        "hold" => $potential_hold,
+                        "reservation" => $potential_reservation
+                    ));
+                    return if $self->bail_out;
+                } elsif ($potential_hold) {
+                    $needed_for_something =
+                        $self->attempt_checkin_hold_capture;
+                } elsif ($potential_reservation) {
+                    $needed_for_something =
+                        $self->attempt_checkin_reservation_capture;
+                }
+            } else {
+                $needed_for_something = $self->attempt_checkin_hold_capture;
             }
         }
         return if $self->bail_out;
-- 
2.11.0