added another user penalty fetcher which just returns the flat list of penalties
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Jul 2009 14:28:36 +0000 (14:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Jul 2009 14:28:36 +0000 (14:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13554 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm

index 596a016..e6256ae 100644 (file)
@@ -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;
+
+