yet another replication race condition fix
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 1 Nov 2010 23:22:53 +0000 (23:22 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 1 Nov 2010 23:22:53 +0000 (23:22 +0000)
Fixes problems that can occur when creating a lineitem
from an existing bib in the catalog; adds an authoritative
version of open-ils.acq.lineitem.retrieve.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18565 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm
Open-ILS/web/js/ui/default/acq/common/li_table.js

index 0903e31..3f3940b 100644 (file)
@@ -69,6 +69,7 @@ sub create_lineitem {
 __PACKAGE__->register_method(
     method    => 'retrieve_lineitem',
     api_name  => 'open-ils.acq.lineitem.retrieve',
+    authoritative => 1,
     signature => {
         desc   => 'Retrieves a lineitem',
         params => [
index 33f40c9..b6f267c 100644 (file)
@@ -602,10 +602,12 @@ sub bib_search {
 
     $logger->info("created @li_ids new lineitems for picklist $picklist");
 
-    # new editor, no transaction needed this time
-    $e = new_editor("authtoken" => $auth) or return $e->die_event;
+    # new editor, but still using transaction to ensure correct retrieval
+    # in a replicated setup
+    $e = new_editor("authtoken" => $auth, xact => 1) or return $e->die_event;
     return $e->die_event unless $e->checkauth;
     $conn->respond($RETRIEVERS{"lineitem"}->($e, $_, $opts)) foreach @li_ids;
+    $e->rollback;
     $e->disconnect;
 
     undef;
index 3f58eec..d12d09f 100644 (file)
@@ -794,7 +794,7 @@ function AcqLiTable() {
             return handler(li);
         
         fieldmapper.standardRequest(
-            ['open-ils.acq', 'open-ils.acq.lineitem.retrieve'],
+            ['open-ils.acq', 'open-ils.acq.lineitem.retrieve.authoritative'],
             {   async: true,
 
                 params: [self.authtoken, liId, {