From: erickson Date: Thu, 9 Jul 2009 14:28:36 +0000 (+0000) Subject: added another user penalty fetcher which just returns the flat list of penalties X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4e088b431dddc570436ac4427a7bd138f73edbff;p=evergreen%2Fmasslnc.git added another user penalty fetcher which just returns the flat list of penalties git-svn-id: svn://svn.open-ils.org/ILS/trunk@13554 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm index 596a016bdf..e6256ae87e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm @@ -69,19 +69,9 @@ sub calculate_penalties { sub retrieve_penalties { my($class, $e, $user_id, $context_org, @fatal_mask) = @_; - my $penalties = $e->search_actor_user_standing_penalty([ - { - usr => $user_id, - org_unit => $U->get_org_ancestors($context_org), - '-or' => [ - {stop_date => undef}, - {stop_date => {'>' => 'now'}} - ], - }, - {flesh => 1, flesh_fields => {ausp => ['standing_penalty']}} - ]); - my(@info, @fatal); + my $penalties = $class->retrieve_usr_penalties($e, $user_id, $context_org); + for my $p (@$penalties) { my $pushed = 0; if($p->standing_penalty->block_list) { @@ -99,4 +89,24 @@ sub retrieve_penalties { return {fatal_penalties => \@fatal, info_penalties => \@info}; } + +# Returns a list of actor_user_standing_penalty objects +sub retrieve_usr_penalties { + my($class, $e, $user_id, $context_org) = @_; + + return $e->search_actor_user_standing_penalty([ + { + usr => $user_id, + org_unit => $U->get_org_ancestors($context_org), + '-or' => [ + {stop_date => undef}, + {stop_date => {'>' => 'now'}} + ], + }, + {flesh => 1, flesh_fields => {ausp => ['standing_penalty']}} + ]); +} + 1; + +