From: Jason Boyer Date: Tue, 24 Sep 2019 11:03:56 +0000 (-0400) Subject: moving toward fixing SIP hold titles X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=29c0582c0bd0bc070c81d6010d98e6e7f0224efc;p=working%2FEvergreen.git moving toward fixing SIP hold titles Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm index ef487c391e..0ca8fc0561 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm @@ -635,6 +635,40 @@ sub find_copy_for_hold { {call_number => $hold->target, deleted => 'f'}, {limit => 1}])->[0] if $hold->hold_type eq 'V'; + return $e->json_query( + { + select => { acp => ['id'] }, + from => { + acp => { + acpm => { + field => 'target_copy', + fkey => 'id', + filter => { part => $hold->target } + } + } + }, + where => { '+acp' => { deleted => 'f' } }, + limit => 1 + })->[0]->{id} if $hold->hold_type eq 'P'; + + + return $e->json_query( + { + select => { acp => ['id'] }, + from => { + acp => { + sitem => { + field => 'unit', + fkey => 'id', + filter => { issuance => $hold->target } + } + } + }, + where => { '+acp' => { deleted => 'f' } }, + limit => 1 + })->[0]->{id} if $hold->hold_type eq 'I'; + + my $bre_ids = [$hold->target]; if ($hold->hold_type eq 'M') { @@ -697,6 +731,25 @@ sub find_hold_from_copy { return $hold if $hold = $run_hold_query->( target => $map->metarecord, hold_type => 'M'); + + # part holds + my $part = $e->search_asset_copy_part_map( + { target_copy => $copy->id })->[0]; + + if ($part) { + return $hold if $hold = $run_hold_query->( + target => $part->id, hold_type => 'P'); + } + + # issuance holds + my $iss = $e->search_serial_item( + { unit => $copy->id })->[0]; + + if ($iss) { + return $hold if $hold = $run_hold_query->( + target => $iss->id, hold_type => 'I'); + } + # volume holds return $hold if $hold = $run_hold_query->( target => $copy->call_number->id, hold_type => 'V');