From 428837998440b396a0cf3bc28631b8e6b658469d Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 16 Oct 2014 18:23:14 -0400 Subject: [PATCH] JBAS-224 add date limit support to user event log UI Backporting support for the library setting 'circ.staff.max_visible_event_age' to limit the number of events displayed in the patron event log interface by date. Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index d4faa2c113..cbf50a2144 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -3562,6 +3562,20 @@ sub user_events { return $e->event unless $e->allowed('VIEW_USER', $user->home_ou); } + my $max_age = $U->ou_ancestor_setting_value( + $user->home_ou, 'circ.staff.max_visible_event_age'); + + if ($max_age) { + my $date = DateTime->now->subtract(seconds => + interval_to_seconds($max_age))->strftime('%F %T%z'); + + if ($filters->{event}) { + $filters->{event}->{add_time} = {'>=' => $date}; + } else { + $filters->{event} = {add_time => {'>=' => $date}}; + } + } + my $ses = OpenSRF::AppSession->create('open-ils.trigger'); my $req = $ses->request('open-ils.trigger.events_by_target', $obj_type, $filters, {atevdef => ['reactor', 'validator']}, 2); -- 2.11.0