From aafd4b76924c926a4d692f498387c8786d358f9d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 Jul 2013 14:03:35 -0400 Subject: [PATCH] Delay the count of available holds in TPAC If an org_unit has a setting for circ.hold_shelf_status_delay, also delay the incrementing of the value displayed as "ITEMS READY FOR PICKUP" Signed-off-by: root --- .../src/perlmods/lib/OpenILS/Application/Actor.pm | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 0c25c51..effec65 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1933,7 +1933,7 @@ sub hold_request_count { } my $holds = $e->json_query({ - select => {ahr => ['pickup_lib', 'current_shelf_lib']}, + select => {ahr => ['pickup_lib', 'current_shelf_lib', 'shelf_time']}, from => 'ahr', where => { usr => $user_id, @@ -1942,6 +1942,31 @@ 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 / delay_date ".$now." / ". $delay->{value}." / ".$dtime); + } + } + + return { total => scalar(@$holds), ready => scalar( -- 1.7.9.5