Fix hold has copy at lookup
authorThomas Berezansky <tsbere@mvlc.org>
Mon, 7 May 2012 19:42:35 +0000 (15:42 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 9 May 2012 15:59:56 +0000 (11:59 -0400)
Filter on available or reshelving, and add more hold type support for lookup
purposes (parts and issuance holds).

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>

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

index 70325f9..906ec53 100644 (file)
@@ -3540,7 +3540,7 @@ sub hold_has_copy_at {
                 ccs  => {field => 'id', filter => { holdable => 't'}, fkey => 'status'  }
             }
         },
-        where => {'+acp' => { circulate => 't', deleted => 'f', holdable => 't', circ_lib => $org_unit}},
+        where => {'+acp' => { circulate => 't', deleted => 'f', holdable => 't', circ_lib => $org_unit, status => [0,7]}},
         limit => 1
     };
 
@@ -3551,7 +3551,23 @@ sub hold_has_copy_at {
     } elsif($hold_type eq 'V') {
 
         $query->{where}->{'+acp'}->{call_number} = $hold_target;
-    
+
+    } elsif($hold_type eq 'P') {
+
+        $query->{from}->{acp}->{acpm} = {
+            field  => 'target_copy',
+            fkey   => 'id',
+            filter => {part => $hold_target},
+        };
+
+    } elsif($hold_type eq 'I') {
+
+        $query->{from}->{acp}->{sitem} = {
+            field  => 'unit',
+            fkey   => 'id',
+            filter => {issuance => $hold_target},
+        };
+
     } elsif($hold_type eq 'T') {
 
         $query->{from}->{acp}->{acn} = {