added auto-import of non-colliding recs support
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 19 Sep 2008 18:49:35 +0000 (18:49 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 19 Sep 2008 18:49:35 +0000 (18:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10647 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/vandelay/vandelay.js

index 3528bf8..67a9aa8 100644 (file)
@@ -587,6 +587,29 @@ function vlImportSelectedRecords() {
     );
 }
 
+function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
+    displayGlobalDiv('vl-generic-progress-with-total');
+    var method = 'open-ils.vandelay.bib_queue.import';
+    if(noMatchOnly)
+        method = method.replace('import', 'nomatch.import');
+    if(type == 'auth')
+        method = method.replace('bib', 'auth');
+
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', method],
+        {   async: true,
+            params: [authtoken, queueId],
+            onresponse: function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp))
+                    return alert(e);
+                vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+            },
+            oncomplete: function() {onload();}
+        }
+    );
+}
+
 
 /**
   * Create queue, upload MARC, process spool, load the newly created queue 
@@ -597,7 +620,15 @@ function batchUpload() {
 
     var handleProcessSpool = function() {
         console.log('records uploaded and spooled');
-        retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+        if(vlUploadQueueAutoImport.checked) {
+            vlImportRecordQueue(currentType, currentQueueId, true,  
+                function() {
+                    retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+                }
+            );
+        } else {
+            retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+        }
     }
 
     var handleUploadMARC = function(key) {