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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 9 16:09:33 EST 2009


Author: erickson
Date: 2009-12-09 16:09:28 -0500 (Wed, 09 Dec 2009)
New Revision: 15126

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
added user version of ad-hoc A/T runner method (for receipt printing)

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm	2009-12-09 19:22:58 UTC (rev 15125)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm	2009-12-09 21:09:28 UTC (rev 15126)
@@ -1542,6 +1542,8 @@
 
     } else {
 
+        $object = $$object[0] if ref $object eq 'ARRAY';
+
         my $event_id = $self->simplereq(
             'open-ils.trigger', $auto_method, $def->id, $object, $context_org, $user_data);
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-12-09 19:22:58 UTC (rev 15125)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-12-09 21:09:28 UTC (rev 15126)
@@ -1294,6 +1294,7 @@
     return $U->fire_object_event($event_def, undef, $circ, $e->requestor->ws_ou)
 }
 
+
 __PACKAGE__->register_method(
 	method	=> "fire_circ_events", 
 	api_name	=> "open-ils.circ.fire_circ_trigger_events",
@@ -1304,16 +1305,48 @@
     /
 );
 
+__PACKAGE__->register_method(
+	method	=> "fire_circ_events", 
+	api_name	=> "open-ils.circ.fire_hold_trigger_events",
+    signature => q/
+        General event def runner for hold objects.  If no event def ID
+        is provided, the hook will be used to find the best event_def
+        match based on the context org unit
+    /
+);
+
+__PACKAGE__->register_method(
+	method	=> "fire_circ_events", 
+	api_name	=> "open-ils.circ.fire_user_trigger_events",
+    signature => q/
+        General event def runner for user objects.  If no event def ID
+        is provided, the hook will be used to find the best event_def
+        match based on the context org unit
+    /
+);
+
+
 sub fire_circ_events {
-    my($self, $conn, $auth, $org_id, $event_def, $hook, $granularity, $circ_ids, $user_data) = @_;
+    my($self, $conn, $auth, $org_id, $event_def, $hook, $granularity, $target_ids, $user_data) = @_;
 
     my $e = new_editor(authtoken => $auth);
 	return $e->event unless $e->checkauth;
-    return $e->event unless $e->allowed('VIEW_CIRCULATIONS', $org_id);
 
-    my $circs = $e->batch_retrieve_action_circulation($circ_ids);
-    return undef unless @$circs;
-    return $U->fire_object_event($event_def, $hook, $circs, $org_id, $granularity, $user_data)
+    my $targets;
+
+    if($self->api_name =~ /hold/) {
+        return $e->event unless $e->allowed('VIEW_HOLD', $org_id);
+        $targets = $e->batch_retrieve_action_hold_request($target_ids);
+    } elsif($self->api_name =~ /user/) {
+        return $e->event unless $e->allowed('VIEW_USER', $org_id);
+        $targets = $e->batch_retrieve_actor_user($target_ids);
+    } else {
+        return $e->event unless $e->allowed('VIEW_CIRCULATIONS', $org_id);
+        $targets = $e->batch_retrieve_action_circulation($target_ids);
+    }
+
+    return undef unless @$targets;
+    return $U->fire_object_event($event_def, $hook, $targets, $org_id, $granularity, $user_data)
 }
 
 __PACKAGE__->register_method(



More information about the open-ils-commits mailing list