From 7e055f55518d77bc680040e66bd675f870df9172 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Mon, 9 Sep 2019 15:29:47 -0400 Subject: [PATCH] LP1525394: Return Titles for All Hold Types in SIP The SIP Patron Status Response message can include hold titles if requested by the SIP client. This commit adds Issuance holds to the previous commit addressing part holds, and should finally represent full coverage for our hold types. Signed-off-by: Jason Boyer --- Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm index 034c7ef70b..feb6832dfc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm @@ -699,6 +699,10 @@ sub __hold_to_title { $e->retrieve_asset_call_number($hold->target)) if $hold->hold_type eq 'V'; + return __issuance_to_title( + $e, $hold->target) # starts with the issuance id because there's more involved for I holds. + if $hold->hold_type eq 'I'; + return __record_to_title( $e, $hold->target) if $hold->hold_type eq 'T'; @@ -731,6 +735,25 @@ sub __volume_to_title { return __record_to_title($e, $volume->record); } +sub __issuance_to_title { + my( $e, $issuance_id ) = @_; + my $bre_id = $e->json_query( + { + select => { ssub => ['record_entry'] }, + from => { + ssub => { + siss => { + field => 'subscription', + fkey => 'id', + filter => { id => $issuance_id } + } + } + } + })->[0]->{record_entry}; + + return __record_to_title($e, $bre_id); +} + sub __record_to_title { my( $e, $title_id ) = @_; -- 2.11.0