From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 19 Jul 2010 14:06:34 +0000 (+0000)
Subject: when calculating estimed hold wait time, don't ignore copies that have no circ modifier
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4b4056b7b1266c6bde0786a4ed240ba193dff74b;p=evergreen%2Fpines.git

when calculating estimed hold wait time, don't ignore copies that have no circ modifier

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16977 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
index 4ecde194c4..56062fee93 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
@@ -1094,6 +1094,20 @@ sub retrieve_hold_queue_status_impl {
         where => {'+ahcm' => {hold => $hold->id}}
     });
 
+
+    # take into account copies that have no circ modifier
+    my $no_circ_mods = $e->json_query({
+        select => {
+            acp => [
+                {column => 'id', transform => 'count', aggregate => 1, alias => 'count'}
+            ]
+        },
+        from => {ahcm => 'acp'},
+        where => {'+ahcm' => {hold => $hold->id}, '+acp' => {circ_modifier => undef}}
+    })->[0];
+
+    push(@$hold_data, {count => $no_circ_mods->{count}}) if $no_circ_mods;
+
     my $user_org = $e->json_query({select => {au => ['home_ou']}, from => 'au', where => {id => $hold->usr}})->[0]->{home_ou};
 
     my $default_wait = $U->ou_ancestor_setting_value($user_org, OILS_SETTING_HOLD_ESIMATE_WAIT_INTERVAL);