[open-ils-commits] r13554 - trunk/Open-ILS/src/perlmods/OpenILS/Utils (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 9 10:28:38 EDT 2009


Author: erickson
Date: 2009-07-09 10:28:36 -0400 (Thu, 09 Jul 2009)
New Revision: 13554

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm
Log:
added another user penalty fetcher which just returns the flat list of penalties

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm	2009-07-09 03:24:19 UTC (rev 13553)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/Penalty.pm	2009-07-09 14:28:36 UTC (rev 13554)
@@ -69,19 +69,9 @@
 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);
 
-    my(@info, @fatal);
     for my $p (@$penalties) {
         my $pushed = 0;
         if($p->standing_penalty->block_list) {
@@ -99,4 +89,24 @@
     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;
+
+



More information about the open-ils-commits mailing list