From 4b88afd34488a8f659dde45b57103a2d61316c08 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Fri, 23 May 2014 15:40:23 -0400 Subject: [PATCH] LP#1322341: Count part holds on records Also fix a small mistake in metarecord matching Signed-off-by: Thomas Berezansky Signed-off-by: Kathy Lussier Signed-off-by: Ben Shum --- .../lib/OpenILS/Application/Circ/Holds.pm | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index 093908665c..8b27917b96 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -4081,15 +4081,15 @@ __PACKAGE__->register_method( } ); -# XXX Need to add type I (and, soon, type P) holds to these counts +# XXX Need to add type I holds to these counts sub rec_hold_count { my($self, $conn, $target_id, $args) = @_; $args ||= {}; my $mmr_join = { mmrsm => { - field => 'id', - fkey => 'source', + field => 'source', + fkey => 'id', filter => {metarecord => $target_id} } }; @@ -4145,6 +4145,17 @@ sub rec_hold_count { } } }, + { + '-and' => { + hold_type => 'P', + target => { + in => { + select => {bmp => ['id']}, + from => {bmp => $bre_join} + } + } + } + }, { '-and' => { hold_type => 'T', @@ -4157,7 +4168,7 @@ sub rec_hold_count { }; if($self->api_name =~ /mmr/) { - $query->{where}->{'+ahr'}->{'-or'}->[2] = { + $query->{where}->{'+ahr'}->{'-or'}->[3] = { '-and' => { hold_type => 'T', target => { @@ -4169,7 +4180,7 @@ sub rec_hold_count { } }; - $query->{where}->{'+ahr'}->{'-or'}->[3] = { + $query->{where}->{'+ahr'}->{'-or'}->[4] = { '-and' => { hold_type => 'M', target => $target_id -- 2.43.2