[open-ils-commits] r936 - conifer/branches/rel_1_6_0/web/js/ui/default/cat/storage (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 22 14:55:07 EDT 2010


Author: dbs
Date: 2010-07-22 14:55:03 -0400 (Thu, 22 Jul 2010)
New Revision: 936

Modified:
   conifer/branches/rel_1_6_0/web/js/ui/default/cat/storage/move.js
Log:
Separate the readers from the writer to avoid transaction race fun


Modified: conifer/branches/rel_1_6_0/web/js/ui/default/cat/storage/move.js
===================================================================
--- conifer/branches/rel_1_6_0/web/js/ui/default/cat/storage/move.js	2010-07-22 16:37:56 UTC (rev 935)
+++ conifer/branches/rel_1_6_0/web/js/ui/default/cat/storage/move.js	2010-07-22 18:55:03 UTC (rev 936)
@@ -5,6 +5,7 @@
 dojo.require('openils.XUL');
 
 var pcrud;
+var pcrudRead;
 var staff;
 var copy;
 var volume;
@@ -18,6 +19,7 @@
 function load() {
     staff = new openils.User().user;
     pcrud = new openils.PermaCrud();
+    pcrudRead = new openils.PermaCrud();
     cgi = new openils.CGI();
     var barcode = cgi.param('barcode');
 
@@ -43,20 +45,21 @@
         return;
     }
 
-    copy = fieldmapper.standardRequest(
-        ['open-ils.search', 'open-ils.search.asset.copy.find_by_barcode'],
-        {params: [barcode]}
-    );
+    copy = pcrud.search('acp', {"barcode":barcode});
+    // There can be only one copy
+    copy = copy[0];
     if (!copy.location) {
        dojo.place('<div class="alert">Barcode [' + barcode + '] was not found!</div>', 'resultsDiv', 'only');
        return;
     }
+
     copy.location(152);
     copy.ischanged(1);
     pcrud.update(copy);
 
-    volume = pcrud.retrieve("acn", copy.call_number());
-    record = pcrud.retrieve("bre", volume.record());
+    volume = pcrudRead.retrieve("acn", copy.call_number());
+    record = pcrudRead.retrieve("bre", volume.record());
+
     dojo.place("<div class='barcode'>" + copy.barcode() + "</div>", 'resultsDiv', 'only');
     dojo.place("<div class='call_number'>" + volume.label() + "</div>", 'resultsDiv', 'last');
     dojo.place("<div style='display:none'>" + record.marc() + "</div>", dojo.body(), 'last');



More information about the open-ils-commits mailing list