From: Bill Ott Date: Thu, 8 Jun 2017 18:30:39 +0000 (-0400) Subject: Consider aous hold_shelf delay when displaying available hold count. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fbott%2Fcopy_note_functions_for_upgrade;p=working%2FEvergreen.git Consider aous hold_shelf delay when displaying available hold count. Signed-off-by: Bill Ott --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 6cc2e8b558..7de106075e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -2024,7 +2024,7 @@ sub hold_request_count { } my $holds = $e->json_query({ - select => {ahr => ['pickup_lib', 'current_shelf_lib', 'behind_desk']}, + select => {ahr => ['pickup_lib', 'current_shelf_lib', 'shelf_time', 'behind_desk']}, from => 'ahr', where => { usr => $user_id, @@ -2033,9 +2033,33 @@ sub hold_request_count { } }); + my $now = DateTime->now(time_zone => 'local'); + foreach (@$holds){ + if($_->{current_shelf_lib}) { + my $delay = $e->json_query({ + select => {aous => ['value']}, + from => 'aous', + where => { + name => {"=" => 'circ.hold_shelf_status_delay'}, + org_unit => {"=" => $_->{current_shelf_lib}} + } + })->[0]; + + my $dtime = DateTime::Format::ISO8601->parse_datetime(clense_ISO8601($_->{shelf_time})); + if ($delay->{value}){ + $dtime->add( seconds => OpenSRF::Utils::interval_to_seconds($delay->{value}) ); + $_->{delay} = $dtime; + }else{ + $_->{delay} = $now; + } + $logger->info("now / delay / dleay_date ".$now." / ". $delay->{value}." / ".$dtime); + } + } + my @ready = grep { $_->{current_shelf_lib} and # avoid undef warnings $_->{pickup_lib} eq $_->{current_shelf_lib} + and $now ge $_->{delay} } @$holds; my $resp = {