LP 1904737: Show copies with available status on the pull list
authorJason Stephenson <jason@sigio.com>
Fri, 12 Feb 2021 19:56:04 +0000 (14:56 -0500)
committerJason Stephenson <jason@sigio.com>
Tue, 30 May 2023 21:45:28 +0000 (17:45 -0400)
The pull list code previously showed only copies with hard-coded
status of 0 or 7.  This commit changes that to any copy status that is
both holdable and available (i.e. is_available: true).

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index d295fa2..1ad9713 100644 (file)
@@ -2035,7 +2035,7 @@ sub print_hold_pull_list_stream {
                         "field" => "id",
                         "fkey" => "current_copy",
                         "filter" => {
-                            "circ_lib" => $$params{org_id}, "status" => [0,7]
+                            "circ_lib" => $$params{org_id}
                         },
                         "join" => {
                             "acn" => {
@@ -2059,6 +2059,14 @@ sub print_hold_pull_list_stream {
                                 "filter" => {
                                     "location" => {"=" => {"+acp" => "location"}}
                                 }
+                            },
+                            "ccs" => {
+                                "field" => "id",
+                                "fkey" => "status",
+                                "filter" => {
+                                    "holdable" => "t",
+                                    "is_available" => "t"
+                                }
                             }
                         }
                     }
@@ -4238,10 +4246,10 @@ sub hold_has_copy_at {
                     filter => { holdable => 't', deleted => 'f' },
                     fkey => 'location'
                 },
-                ccs  => {field => 'id', filter => { holdable => 't'}, fkey => 'status'  }
+                ccs  => {field => 'id', filter => {holdable => 't', is_available => 't'}, fkey => 'status'}
             }
         },
-        where => {'+acp' => { circulate => 't', deleted => 'f', holdable => 't', circ_lib => $org_unit, status => [0,7]}},
+        where => {'+acp' => { circulate => 't', deleted => 'f', holdable => 't', circ_lib => $org_unit }},
         limit => 1
     };
 
index 07a8bfe..57d0591 100644 (file)
@@ -793,7 +793,8 @@ sub hold_pull_list {
     my $count = 1 if ($self->api_name =~/count$/o);
 
     my $status_filter = '';
-    $status_filter = 'AND a.status IN (0,7)' if ($self->api_name =~/status_filtered/o);
+    $status_filter = 'AND a.status IN (SELECT id FROM config.copy_status WHERE holdable AND is_available)'
+        if ($self->api_name =~/status_filtered/);
 
     my $select = <<"    SQL";
         SELECT  h.*