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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 6 11:08:02 EDT 2009


Author: erickson
Date: 2009-10-06 11:08:00 -0400 (Tue, 06 Oct 2009)
New Revision: 14280

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
added a batch version of the post-checkin backdate call: open-ils.circ.post_checkin_backdate.batch.  It takes an array of circ IDs

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-10-06 14:57:26 UTC (rev 14279)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-10-06 15:08:00 UTC (rev 14280)
@@ -375,12 +375,42 @@
     }
 );
 
+__PACKAGE__->register_method(
+	method	=> "post_checkin_backdate_circ",
+	api_name	=> "open-ils.circ.post_checkin_backdate.batch",
+    stream => 1,
+	signature => {
+        desc => q/@see open-ils.circ.post_checkin_backdate.  Batch mode/,
+        params => [
+            {desc => 'Authentication token', type => 'string'},
+            {desc => 'List of Circ ID', type => 'array'},
+            {desc => 'ISO8601 backdate', type => 'string'},
+        ],
+        return => {desc => q/Set of: 1 on success, failure event on error/}
+    }
+);
+
+
 sub post_checkin_backdate_circ {
     my( $self, $conn, $auth, $circ_id, $backdate ) = @_;
-
-    my $e = new_editor(authtoken=>$auth, xact=>1);
+    my $e = new_editor(authtoken=>$auth);
     return $e->die_event unless $e->checkauth;
+    if($self->api_name =~ /batch/) {
+        $conn->respond(post_checkin_backdate_circ_impl($e, $_, $backdate)) for $circ_id;
+    } else {
+        $conn->respond_complete(post_checkin_backdate_circ_impl($e, $circ_id, $backdate));
+    }
 
+    $e->disconnect;
+    return undef;
+}
+
+
+sub post_checkin_backdate_circ_impl {
+    my($e, $circ_id, $backdate) = @_;
+
+    $e->xact_begin;
+
     my $circ = $e->retrieve_action_circulation($circ_id)
         or return $e->die_event;
 
@@ -404,7 +434,7 @@
     $evt = OpenILS::Application::Circ::CircCommon->reopen_xact($e, $circ->id);
     return $evt if $evt;
 
-    $e->commit;
+    $e->xact_commit;
     return 1;
 }
 



More information about the open-ils-commits mailing list