Skip shelved holds at checkout auto-fill
authorThomas Berezansky <tsbere@mvlc.org>
Tue, 15 Nov 2011 16:08:00 +0000 (11:08 -0500)
committerMike Rylander <mrylander@gmail.com>
Tue, 15 Nov 2011 21:12:08 +0000 (16:12 -0500)
Already happened for volume/title hold, but target map checking wasn't
checking to see if the current copy was shelved.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 720bc68..2b99396 100644 (file)
@@ -1716,6 +1716,11 @@ sub find_related_user_hold {
                 ahcm => {
                     field => 'hold',
                     fkey => 'id'
+                },
+                acp => {
+                    field => 'id', 
+                    fkey => 'current_copy',
+                    type => 'left' # there may be no current_copy
                 }
             }
         }, 
@@ -1732,6 +1737,12 @@ sub find_related_user_hold {
             '+ahcm' => {
                 target_copy => $self->copy->id
             },
+            '+acp' => {
+                '-or' => [
+                    {id => undef}, # left-join copy may be nonexistent
+                    {status => {'!=' => OILS_COPY_STATUS_ON_HOLDS_SHELF}},
+                ]
+            }
         },
         order_by => {ahr => {request_time => {direction => 'asc'}}},
         limit => 1