From 72fe0e11a6a2720ac548a6d4a88aeb810b106a41 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 1 Sep 2006 21:31:17 +0000 Subject: [PATCH] added notify_time and notify_count fleshing method git-svn-id: svn://svn.open-ils.org/ILS/trunk@5849 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Circ/Holds.pm | 43 ++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index f91b5e682d..a7a005d419 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -285,18 +285,16 @@ NOTE sub retrieve_holds_by_id { - my($self, $client, $login_session, $hold_id) = @_; - - #FIXME - #my( $user, $target, $evt ) = $apputils->checkses_requestor( - # $login_session, $user_id, 'VIEW_HOLD' ); - #return $evt if $evt; + my($self, $client, $auth, $hold_id) = @_; + my $e = new_editor(authtoken=>$auth); + $e->checkauth or return $e->event; + $e->allowed('VIEW_HOLD') or return $e->event; - my $holds = $apputils->simplereq( - 'open-ils.cstore', - "open-ils.cstore.direct.action.hold_request.search.atomic", - { id => $hold_id , fulfillment_time => undef }, - { order_by => { ahr => "request_time" } } + my $holds = $e->search_action_hold_request( + [ + { id => $hold_id , fulfillment_time => undef }, + { order_by => { ahr => "request_time" } } + ] ); flesh_hold_transits($holds); @@ -874,6 +872,28 @@ sub flesh_hold_transits { } } +sub flesh_hold_notices { + my( $holds, $e ) = @_; + $e ||= new_editor(); + + for my $hold (@$holds) { + my $notices = $e->search_action_hold_notification( + [ + { hold => $hold->id }, + { order_by => { anh => { 'notify_time desc' } } }, + ], + {idlist=>1} + ); + + $hold->notify_count(scalar(@$notices)); + if( @$notices ) { + my $n = $e->retrieve_action_hold_notification($$notices[0]) + or return $e->event; + $hold->notify_time($n->notify_time); + } + } +} + @@ -914,6 +934,7 @@ sub fetch_captured_holds { } flesh_hold_transits(\@res); + flesh_hold_notices(\@res, $e); return \@res; } -- 2.11.0