From 10e9d4886c8732afe4e2c660d256108c626b5377 Mon Sep 17 00:00:00 2001 From: gmc Date: Mon, 1 Nov 2010 23:24:23 +0000 Subject: [PATCH] yet another replication race condition fix 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 git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@18566 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm | 9 +++++---- Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm | 6 ++++-- Open-ILS/web/js/ui/default/acq/common/li_table.js | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm index 5398ba1e88..0d568e44b0 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm @@ -67,10 +67,11 @@ sub create_lineitem { __PACKAGE__->register_method( - method => 'retrieve_lineitem', - api_name => 'open-ils.acq.lineitem.retrieve', - signature => { - desc => 'Retrieves a lineitem', + method => 'retrieve_lineitem', + api_name => 'open-ils.acq.lineitem.retrieve', + authoritative => 1, + signature => { + desc => 'Retrieves a lineitem', params => [ {desc => 'Authentication token', type => 'string'}, {desc => 'lineitem ID to retrieve', type => 'number'}, diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm index 33f40c9d87..b6f267c903 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Search.pm @@ -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; diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 3f58eecaa7..d12d09fac0 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -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, { -- 2.11.0