ACQ+Vandelay import/merge user interface components
authorBill Erickson <berick@esilibrary.com>
Tue, 6 Dec 2011 18:50:29 +0000 (13:50 -0500)
committerBen Shum <bshum@biblio.org>
Tue, 13 Mar 2012 19:26:33 +0000 (15:26 -0400)
Acquisitions support for leveraging Vandelay import/merge controls
for loading ACQ records and/or linking ACQ records to existing
catalog records.

Dev includes:

* General purpose Vandelay input form and merge progress indicator (VLAgent)
* VLAgent is now shown in the following interfaces when a bib load/merge/link action is required:
 * Vendor record upload interface
 * PO creation
 * PO "load bibs and items" action
 * PO activation

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/templates/acq/common/li_table.tt2
Open-ILS/src/templates/acq/common/vlagent.tt2 [new file with mode: 0644]
Open-ILS/src/templates/acq/picklist/upload.tt2
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/js/ui/default/acq/common/vlagent.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/acq/picklist/upload.js
Open-ILS/web/js/ui/default/acq/po/view_po.js

index b0ab837..1c92c2e 100644 (file)
@@ -533,7 +533,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
        <class id="vms" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::match_set" oils_persist:tablename="vandelay.match_set" reporter:label="Record Matching Definition Set">
                <fields oils_persist:primary="id" oils_persist:sequence="vandelay.match_set_id_seq">
-                       <field reporter:label="Match Set ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Match Set ID" name="id" reporter:datatype="id" reporter:selector="name"/>
                        <field reporter:label="Name" name="name" reporter:datatype="text"/>
                        <field reporter:label="Owning Library" name="owner" reporter:datatype="link"/>
                        <field reporter:label="Match Set Type" name="mtype" reporter:datatype="text"/>
index 7b10181..374e816 100644 (file)
@@ -1,4 +1,5 @@
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/acq/common/base64.js"> </script>
+<script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/common/vlagent.js'> </script>
 <script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/common/li_table.js'> </script>
 <script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/financial/claim_voucher.js'> </script>
 <div id='acq-lit-table-container'>
         </div>
     </div>
 
-    <div class='hidden' id='acq-lit-progress-numbers'>
+
+    [% PROCESS 'acq/common/vlagent.tt2' %]
+    <div class='hidden' id='acq-lit-asset-creator'>
         <table class='oils-generic-table'>
             <tbody>
+                [% PROCESS vlagent_form %]
                 <tr>
-                    <td>Lineitems Processed</td>
-                    <td><span id='acq-pl-lit-li-processed'>0</span></td>
-                </tr>
-                <tr>
-                    <td>Items Processed</td>
-                    <td><span id='acq-pl-lit-lid-processed'>0</span></td>
-                </tr>
-                <tr>
-                    <td>Debits Encumbered</td>
-                    <td><span id='acq-pl-lit-debits-processed'>0</span></td>
-                </tr>
-                <tr>
-                    <td>Bib Records Imported</td>
-                    <td><span id='acq-pl-lit-bibs-processed'>0</span></td>
-                </tr>
-                <tr>
-                    <td>Bib Records Indexed</td>
-                    <td><span id='acq-pl-lit-indexed-processed'>0</span></td>
-                </tr>
-                <tr>
-                    <td>Copies Processed</td>
-                    <td><span id='acq-pl-lit-copies-processed'>0</span></td>
+                    <td>
+                        <span style='margin-left:10px;'>
+                            <button dojoType="dijit.form.Button" jsId='assetCreatorButton'>[% l('Submit') %]</button>
+                        </span>
+                    </td>
                 </tr>
             </tbody>
         </table>
     </div>
 
+    <div class='hidden' id='acq-lit-progress-numbers'>
+        [% PROCESS vlagent_results %]
+    </div>
+
     <div class='hidden'>
         <div dojoType='dijit.Dialog' jsId='acqLitPoCreateDialog'>
             <table class='oils-generic-table'>
diff --git a/Open-ILS/src/templates/acq/common/vlagent.tt2 b/Open-ILS/src/templates/acq/common/vlagent.tt2
new file mode 100644 (file)
index 0000000..7c8ee66
--- /dev/null
@@ -0,0 +1,78 @@
+[% BLOCK vlagent_form %]
+    <tr>
+        <td>[% l('Upload to Queue') %]</td>
+        <td><div id='acq_vl:existing_queue'></div></td>
+        <td>
+            <span>[% l('Or create a new queue') %]</span>
+            <input dojoType='dijit.form.TextBox' id='acq_vl:queue_name' size='32'></input>
+        </td>
+    </tr>
+    <tr>
+        <td>[% l('Record Match Set') %]</td>
+        <td><div id='acq_vl:match_set'></div></td>
+    </tr>
+    <tr>
+        <td>[% l('Merge Profile') %]</td>
+        <td><div id='acq_vl:merge_profile'></div></td>
+    </tr>
+    <tr>
+        <td>[% l('Import Non-Matching Records') %]</td>
+        <td><input dojoType='dijit.form.CheckBox' id='acq_vl:import_no_match'></input></td>
+        <td><span style='padding-right:10px;'>[% l('Record Source') %]</span> <div id='acq_vl:bib_source'></div></td>
+    </tr>
+    <tr>
+        <td>[% l('Merge On Exact Match (901c)') %]</td>
+        <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_exact'></input></td>
+    </tr>
+    <tr>
+        <td>[% l('Merge On Single Match') %]</td>
+        <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_1match'></input></td>
+    </tr>
+    <tr>
+        <td>[% l('Merge On Best Match') %]</td>
+        <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_best_match'></input></td>
+    </tr>
+    <tr>
+        <td>[% l('Best/Single Match Minimum Quality Ratio') %]</td>
+        <td colspan='4'>
+            <input style='width:3em' value='0.0' id='acq_vl:match_quality_ratio' dojoType='dijit.form.TextBox'/>
+            <span style='padding-left: 10px; font-size:90%'>[% l('New Record Quality / Quality of Best Match') %]</span>
+        </td>
+    </tr>
+    <tr>
+        <td>[% l('Insufficient Quality Fall-Through Profile') %]</td>
+        <td><div id='acq_vl:fall_through_merge_profile'></div></td>
+    </tr>
+[% END %]
+
+[% BLOCK vlagent_results %]
+    <table class='oils-generic-table'>
+        <tbody>
+            <tr>
+                <td>[% l('Lineitems Processed') %]</td>
+                <td><span id='acq_vl:li-processed'>0</span></td>
+            </tr>
+            <tr>
+                <td>[% l('Vandelay Records Processed') %]</td>
+                <td><span id='acq_vl:vqbr-processed'>0</span></td>
+            </tr>
+            <tr>
+                <td>[% l('Bib Records Merged/Imported') %]</td>
+                <td><span id='acq_vl:bibs-processed'>0</span></td>
+            </tr>
+            <tr>
+                <td>[% l('ACQ Copies Processed') %]</td>
+                <td><span id='acq_vl:lid-processed'>0</span></td>
+            </tr>
+            <tr>
+                <td>[% l('Debits Encumbered') %]</td>
+                <td><span id='acq_vl:debits-processed'>0</span></td>
+            </tr>
+            <tr>
+                <td>[% l('Real Copies Processed') %]</td>
+                <td><span id='acq_vl:copies-processed'>0</span></td>
+            </tr>
+        </tbody>
+    </table>
+[% END %]
+
index 31b7620..fc03106 100644 (file)
@@ -1,4 +1,5 @@
 [% WRAPPER 'base.tt2' %]
+[% PROCESS 'acq/common/vlagent.tt2' %]
 
 <h1>Upload</h1><br/>
 <form id="acq-pl-upload-form" enctype="multipart/form-data">
@@ -8,20 +9,13 @@
             <tr>
                 <td>Create Purchase Order</td>
                 <td>
-                    <input dojoType='dijit.form.CheckBox' name='create_po'></input>
+                    <input dojoType='dijit.form.CheckBox' jsId='acqPlUploadCreatePo'></input>
                 </td>
             </tr>
             <tr>
                 <td>Activate Purchase Order</td>
                 <td>
-                    <input dojoType='dijit.form.CheckBox' name='activate_po'></input>
-                </td>
-            </tr>
-            <tr>
-                <!-- XXX CHECK IMPORT PERMS TO ENABLE -->
-                <td>Load Bibs and Items into the ILS</td>
-                <td>
-                    <input dojoType='dijit.form.CheckBox' name='create_assets'></input>
+                    <input dojoType='dijit.form.CheckBox' jsId='acqPlUploadActivatePo'></input>
                 </td>
             </tr>
             <tr>
                     <select jsId='acqPlUploadPlSelector' dojoType='dijit.form.ComboBox'></select>
                 </td>
             </tr>
+
+            <tr><td colspan='2'><hr/></td></tr>
+            [% PROCESS vlagent_form %]
+            <tr><td colspan='2'><hr/></td></tr>
+
             <tr>
-                <td>Records File</td>
-                <td><input size='36' type="file" name="marc_upload"></input></td>
-            </tr>
-            <tr>
-                <td align='center' colspan='2'>
-                    <button dojoType="dijit.form.Button" onClick="acqUploadRecords()">Upload</button>
+                <td colspan='5'>
+                    <span id="vl-file-label">[% l('File to Upload:') %]</span>
+                    <input size='48' style='border:1px solid #888;' type="file" name="marc_upload"/>
+                    <span style='margin-left:10px;'><button dojoType="dijit.form.Button" onclick="acqUploadRecords()">[% l('Upload') %]</button></span>
                 </td>
             </tr>
+
         </tbody>
     </table>
 
         <div id='acq-pl-upload-progress-bar'>
             <div dojoType="dijit.ProgressBar" style="width:300px" indeterminate="true"></div>
         </div>
-        <div>
-            <table class='oils-generic-table'>
-                <tbody>
-                    <tr>
-                        <td>Lineitems Processed</td>
-                        <td><span id='acq-pl-upload-li-processed'>0</span></td>
-                    </tr>
-                    <tr>
-                        <td>Items Processed</td>
-                        <td><span id='acq-pl-upload-lid-processed'>0</span></td>
-                    </tr>
-                    <tr>
-                        <td>Debits Encumbered</td>
-                        <td><span id='acq-pl-upload-debits-processed'>0</span></td>
-                    </tr>
-                    <tr>
-                        <td>Bib Records Imported</td>
-                        <td><span id='acq-pl-upload-bibs-processed'>0</span></td>
-                    </tr>
-                    <tr>
-                        <td>Bib Records Indexed</td>
-                        <td><span id='acq-pl-upload-indexed-processed'>0</span></td>
-                    </tr>
-                    <tr>
-                        <td>Copies Created</td>
-                        <td><span id='acq-pl-upload-copies-processed'>0</span></td>
-                    </tr>
-                </tbody>
-                <tbody id='acq-pl-upload-complete' class='hidden'>
-                    <tr><td colspan='2'>Upload Complete!</td></tr>
-                    <tr><td colspan='2'><a id='acq-pl-upload-complete-po'>View Purchase Order</a></td></tr>
-                    <tr><td colspan='2'><a id='acq-pl-upload-complete-pl'>View Selection List</a></td></tr>
-                </tbody>
-            </table>
+        [% PROCESS vlagent_results %]
+        <div id='acq-pl-upload-complete' class='hidden'>
+            <div>Upload Complete!</div><br/>
+            <div><a id='acq-pl-upload-complete-po'>View Purchase Order</a></div><br/>
+            <div><a id='acq-pl-upload-complete-pl'>View Selection List</a></div><br/>
+            <div><a id='acq-pl-upload-complete-q'></a></div><br/>
         </div>
     </div>
 </form>
+<script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/common/vlagent.js'> </script>
 <script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/picklist/upload.js'> </script>
 [% END %]
index 6ee88d2..b05bd41 100644 (file)
@@ -79,6 +79,7 @@ function AcqLiTable() {
             self.fetchClaimInfo(li.id(), /* force update */ true);
         }
     );
+    this.vlAgent = new VLAgent();
 
     dojo.byId("acq-lit-li-actions-selector").onchange = function() { 
         self.applySelectedLiAction(this.options[this.selectedIndex].value);
@@ -154,6 +155,7 @@ function AcqLiTable() {
         openils.Util.hide('acq-lit-li-details');
         openils.Util.hide('acq-lit-notes-div');
         openils.Util.hide('acq-lit-real-copies-div');
+        openils.Util.hide('acq-lit-asset-creator');
         switch(div) {
             case 'list':
                 openils.Util.show('acq-lit-table-div');
@@ -170,6 +172,9 @@ function AcqLiTable() {
             case 'notes':
                 openils.Util.show('acq-lit-notes-div');
                 break;
+            case 'asset-creator':
+                openils.Util.show('acq-lit-asset-creator');
+                break;
             default:
                 if(div) 
                     openils.Util.show(div);
@@ -2037,7 +2042,7 @@ function AcqLiTable() {
                 break;
 
             case 'create_assets':
-                this.createAssets();
+                this.showAssetCreator();
                 break;
 
             case 'export_attr_list':
@@ -2099,18 +2104,26 @@ function AcqLiTable() {
         );
     };
 
-    this.createAssets = function() {
+    this.showAssetCreator = function(onAssetsCreated) {
+        this.show('asset-creator');
+        if(!this.vlAgent.loaded)
+            this.vlAgent.init();
+        var self = this;
+        dojo.connect(assetCreatorButton, 'onClick', 
+            function() { self.createAssets(onAssetsCreated) });
+    }
+
+    this.createAssets = function(onAssetsCreated) {
         if(!this.isPO) return;
-        if(!confirm(localeStrings.CREATE_PO_ASSETS_CONFIRM)) return;
         this.show('acq-lit-progress-numbers');
         var self = this;
         fieldmapper.standardRequest(
             ['open-ils.acq', 'open-ils.acq.purchase_order.assets.create'],
             {   async: true,
-                params: [this.authtoken, this.isPO],
+                params: [this.authtoken, this.isPO, {vandelay : this.vlAgent.values()}],
                 onresponse: function(r) {
                     var resp = openils.Util.readResponse(r);
-                    self._updateProgressNumbers(resp, true);
+                    self._updateProgressNumbers(resp, !Boolean(onAssetsCreated), onAssetsCreated);
                 }
             }
         );
@@ -2347,16 +2360,15 @@ function AcqLiTable() {
         );
     }
 
-    this._updateProgressNumbers = function(resp, reloadOnComplete) {
-        if(!resp) return;
-        dojo.byId('acq-pl-lit-li-processed').innerHTML = resp.li;
-        dojo.byId('acq-pl-lit-lid-processed').innerHTML = resp.lid;
-        dojo.byId('acq-pl-lit-debits-processed').innerHTML = resp.debits_accrued;
-        dojo.byId('acq-pl-lit-bibs-processed').innerHTML = resp.bibs;
-        dojo.byId('acq-pl-lit-indexed-processed').innerHTML = resp.indexed;
-        dojo.byId('acq-pl-lit-copies-processed').innerHTML = resp.copies;
-        if(resp.complete && reloadOnComplete) 
-            location.href = location.href;
+    this._updateProgressNumbers = function(resp, reloadOnComplete, onComplete) {
+        this.vlAgent.handleResponse(resp,
+            function(resp, res) {
+                if(reloadOnComplete)
+                     location.href = location.href;
+                if (onComplete)
+                    onComplete(resp, res);
+            }
+        );
     }
 
 
@@ -2383,30 +2395,37 @@ function AcqLiTable() {
 
     this._createPOFromLineitems = function(fields, selected) {
         if (selected.length == 0) return;
+        var self = this;
 
-        this.show("acq-lit-progress-numbers");
         var po = new fieldmapper.acqpo();
         po.provider(this.createPoProviderSelector.attr("value"));
         po.ordering_agency(this.createPoAgencySelector.attr("value"));
         po.prepayment_required(fields.prepayment_required[0] ? true : false);
 
+        // if we're creating assets, delay the asset creation 
+        // until after the PO is created.  This will allow us to 
+        // use showAssetCreator() directly.
+
         fieldmapper.standardRequest(
             ["open-ils.acq", "open-ils.acq.purchase_order.create"],
             {   async: true,
                 params: [
                     openils.User.authtoken, 
-                    po, {
-                        lineitems : selected,
-                        create_assets : fields.create_assets[0],
-                    }
+                    po, {lineitems : selected}
                 ],
-
                 onresponse : function(r) {
                     var resp = openils.Util.readResponse(r);
-                    self._updateProgressNumbers(resp);
                     if (resp.complete) {
-                        location.href = oilsBasePath + "/acq/po/view/" +
-                            resp.purchase_order.id();
+                        // self.isPO is needed for showAssetCreator();
+                        self.isPO = resp.purchase_order.id(); 
+                        var redir = oilsBasePath + "/acq/po/view/" + self.isPO;
+                        if (fields.create_assets[0]) {
+                            self.showAssetCreator(
+                                function() {location.href = redir}
+                            );
+                        } else {
+                           location.href = redir;
+                        }
                     }
                 }
             }
diff --git a/Open-ILS/web/js/ui/default/acq/common/vlagent.js b/Open-ILS/web/js/ui/default/acq/common/vlagent.js
new file mode 100644 (file)
index 0000000..1af1f77
--- /dev/null
@@ -0,0 +1,98 @@
+dojo.require('openils.widget.AutoFieldWidget');
+
+function VLAgent(args) {
+    args = args || {};
+    for (var key in args) { 
+        this[key] = args[key]; 
+    }
+
+    this.widgets = [  
+        {key : 'import_no_match'},
+        {key : 'auto_overlay_exact'},
+        {key : 'auto_overlay_1match'},
+        {key : 'auto_overlay_best_match'},
+        {key : 'match_quality_ratio'},
+        {key : 'queue_name'},
+        {key : 'match_set', cls : 'vms'},
+        {key : 'bib_source', cls : 'cbs'},
+        {key : 'merge_profile', cls : 'vmp'},
+        {key : 'fall_through_merge_profile', cls : 'vmp'},
+        {key : 'existing_queue', cls : 'vbq'}
+    ];
+    
+    this.loaded = false;
+
+    this.init = function() {
+        var self = this;
+
+        dojo.forEach(this.widgets,
+            function(widg) {
+                if (widg.cls) { // selectors
+
+                    new openils.widget.AutoFieldWidget({
+                        fmClass : widg.cls,
+                        selfReference : true,
+                        orgLimitPerms : [self.limitPerm || 'CREATE_PURCHASE_ORDER'],
+                        parentNode : dojo.byId('acq_vl:' + widg.key)
+                    }).build(function(dijit) { 
+                        widg.dijit = dijit; 
+                    }); 
+
+                } else { // bools
+                    widg.dijit = dijit.byId('acq_vl:' + widg.key);
+                }
+            }
+        );
+        
+        // loaded != all widgets are done rendering,
+        // only that init() has been called.
+        this.loaded = true;
+    }
+
+    this.values = function() {
+        var values = {};
+        dojo.forEach(this.widgets,
+            function(widg) {
+                values[widg.key] = widg.dijit.attr('value');
+            }
+        );
+        return values;
+    }
+
+    this.handleResponse = function(resp, oncomplete) {
+        if(!resp) return;
+        var res = {}
+
+        console.log('vandelay import returned : ' + js2JSON(resp));
+
+        // update the display counts
+        dojo.byId('acq_vl:li-processed').innerHTML = resp.li;
+        dojo.byId('acq_vl:vqbr-processed').innerHTML = resp.vqbr;
+        dojo.byId('acq_vl:bibs-processed').innerHTML = resp.bibs;
+        dojo.byId('acq_vl:lid-processed').innerHTML = resp.lid;
+        dojo.byId('acq_vl:debits-processed').innerHTML = resp.debits_accrued;
+        dojo.byId('acq_vl:copies-processed').innerHTML = resp.copies;
+
+        if (resp.complete) {
+
+            if(resp.picklist) {
+                res.picklist_url = oilsBasePath + '/acq/picklist/view/' + resp.picklist.id();
+            } 
+
+            if(resp.purchase_order) {
+                res.po_url = oilsBasePath + '/acq/po/view/' + resp.purchase_order.id();
+            }
+
+            if (resp.queue) {
+                res.queue_url = oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + resp.queue.id();
+            }
+
+            if (oncomplete) 
+                oncomplete(resp, res);
+
+            return res;
+        }
+
+        return false; // not yet complete
+    }
+}
index 62a7145..d857b62 100644 (file)
@@ -13,6 +13,7 @@ dojo.require('openils.acq.Picklist');
 var VANDELAY_URL = '/vandelay-upload';
 var providerWidget;
 var orderAgencyWidget;
+var vlAgent;
 
 function init() {
     dojo.byId('acq-pl-upload-ses').value = openils.User.authtoken;
@@ -35,6 +36,9 @@ function init() {
         function(w) { orderAgencyWidget = w }
     );
 
+    vlAgent = new VLAgent();
+    vlAgent.init();
+
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.picklist.user.retrieve.atomic'],
         {   async: true,
@@ -64,7 +68,7 @@ function acqUploadRecords() {
                         function(plId) { acqSendUploadForm({picklist:plId}) }
                     );
                 } else {
-                    acqSendUploadForm({picklist:items[0].id});
+                    acqSendUploadForm({picklist:items[0].id[0]});
                 }
             }
         });
@@ -79,53 +83,58 @@ function acqSendUploadForm(args) {
         method: "post",
         handleAs: "html",
         form: dojo.byId('acq-pl-upload-form'),
-        content : {
-            picklist : args.picklist,
-            provider : providerWidget.attr('value'),
-            ordering_agency : orderAgencyWidget.attr('value')
-        },
         handle: function(data, ioArgs){
-            acqHandlePostUpload(data.documentElement.textContent);
+            acqHandlePostUpload(data.documentElement.textContent, args.picklist);
         }
     });
 }
 
 
-function acqHandlePostUpload(key) {
+function acqHandlePostUpload(key, plId) {
+
+    var args = {
+        picklist : plId,
+        provider : providerWidget.attr('value'),
+        ordering_agency : orderAgencyWidget.attr('value'),
+        create_po : acqPlUploadCreatePo.attr('value'),
+        activate_po : acqPlUploadActivatePo.attr('value'),
+        vandelay : vlAgent.values()
+    };
+
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.process_upload_records'],
         {   async: true,
-            params: [openils.User.authtoken, key],
+            params: [openils.User.authtoken, key, args],
             onresponse : function(r) {
-                var resp = openils.Util.readResponse(r);
-                console.log(js2JSON(resp));
-                if(!resp) return;
-                if(resp.complete) {
-                    openils.Util.hide('acq-pl-upload-complete-pl');
-                    openils.Util.hide('acq-pl-upload-complete-po');
-                    openils.Util.hide('acq-pl-upload-progress-bar');
-                    openils.Util.show('acq-pl-upload-complete');
-
-                    if(resp.picklist) {
-                        openils.Util.show('acq-pl-upload-complete-pl');
-                        dojo.byId('acq-pl-upload-complete-pl').setAttribute(
-                            'href', oilsBasePath + '/acq/picklist/view/' + resp.picklist.id());
-                    } 
-
-                    if(resp.purchase_order) {
-                        openils.Util.show('acq-pl-upload-complete-po');
-                        dojo.byId('acq-pl-upload-complete-po').setAttribute(
-                            'href', oilsBasePath + '/acq/po/view/' + resp.purchase_order.id());
-                    }
 
-                } else {
-                    dojo.byId('acq-pl-upload-li-processed').innerHTML = resp.li;
-                    dojo.byId('acq-pl-upload-lid-processed').innerHTML = resp.lid;
-                    dojo.byId('acq-pl-upload-debits-processed').innerHTML = resp.debits_accrued;
-                    dojo.byId('acq-pl-upload-bibs-processed').innerHTML = resp.bibs;
-                    dojo.byId('acq-pl-upload-indexed-processed').innerHTML = resp.indexed;
-                    dojo.byId('acq-pl-upload-copies-processed').innerHTML = resp.copies;
-                }
+                vlAgent.handleResponse(
+                    openils.Util.readResponse(r),
+                    function(resp, res) {
+
+                        openils.Util.hide('acq-pl-upload-complete-pl');
+                        openils.Util.hide('acq-pl-upload-complete-po');
+                        openils.Util.hide('acq-pl-upload-complete-q');
+                        openils.Util.hide('acq-pl-upload-progress-bar');
+                        openils.Util.show('acq-pl-upload-complete');
+
+                        if(res.picklist_url) {
+                            openils.Util.show('acq-pl-upload-complete-pl');
+                            dojo.byId('acq-pl-upload-complete-pl').setAttribute('href', res.picklist_url);
+                        } 
+
+                        if(res.po_url) {
+                            openils.Util.show('acq-pl-upload-complete-po');
+                            dojo.byId('acq-pl-upload-complete-po').setAttribute('href', res.po_url);
+                        }
+
+                        if (res.queue_url) {
+                            link = dojo.byId('acq-pl-upload-complete-q');
+                            openils.Util.show(link);
+                            link.setAttribute('href', res.queue_url);
+                            link.innerHTML = resp.queue.name();
+                        }
+                    }
+                );
             },
         }
     );
index 8e510f9..6c08ce1 100644 (file)
@@ -513,6 +513,23 @@ function activatePo() {
             return false;
     }
 
+    // first, let's see if this PO has any LI's that need to be merged/imported
+    pcrud.search('jub', {purchase_order : poId, eg_bib_id : null}, {
+        id_list : true,
+        oncomplete : function(r) {
+            var resp = openils.Util.readResponse(r);
+            if (resp && resp.length) {
+                // kick off the merge/import process
+                liTable.showAssetCreator(activatePoStage2);
+            } else {
+                activatePoStage2();
+            }
+        }
+    });
+}
+
+function activatePoStage2() {
+
     var want_refresh = false;
     progressDialog.show(true);
     fieldmapper.standardRequest(