From 12757f3d4e0767e9d23bf2c4172553360f0842cd Mon Sep 17 00:00:00 2001
From: Bill Erickson <berick@esilibrary.com>
Date: Fri, 6 Jan 2012 16:31:22 -0500
Subject: [PATCH] ACQ+Vandelay link to vandelay queue from lineitem list UI

In the general purpose lineitem interface (li_table), there is now a
link to the Vandelay queue which contains the queued bib record used to
load/merge/link the lineitem.  Queue opens in a new staff client tab.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
---
 Open-ILS/src/templates/acq/common/li_table.tt2    |  1 +
 Open-ILS/web/js/ui/default/acq/common/li_table.js | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2
index 374e8161d6..3a233519c3 100644
--- a/Open-ILS/src/templates/acq/common/li_table.tt2
+++ b/Open-ILS/src/templates/acq/common/li_table.tt2
@@ -108,6 +108,7 @@
                                         <span name='po' class='hidden'> | <a title='Purchase Order' name='po_link' href='javascript:void(0);'>&#x2318; </a></span>
                                         <span name="show_requests"> | <a title='Patron Requests' name="show_requests_link" href="javascript:void(0);">requests</a></span> 
                                         <span name='pro' class='hidden'> | <a title='[% l('Provider') %]' name='pro_link' href='javascript:void(0);'>&#x235F; </a></span>
+                                        <span name='queue' class='hidden'> | <a title='[% l('Import Queue') %]' name='queue_link' href='javascript:void(0);'>&#x27AC; Queue</a></span>
                                     </td>
                                 </tr>
                             </tbody>
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 b05bd41726..fc7e2e6aec 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
@@ -366,6 +366,24 @@ function AcqLiTable() {
             nodeByName("link_to_catalog_link", row).onclick = function() { self.drawBibFinder(li) };
         }
 
+        if (li.queued_record()) {
+            this.pcrud.retrieve('vqbr', li.queued_record(),
+                {   async : true, 
+                    oncomplete : function(r) {
+                        var qrec = openils.Util.readResponse(r);
+                        openils.Util.show(nodeByName('queue', row), 'inline');
+                        var link = nodeByName("queue_link", row);
+                        link.onclick = function() { 
+                            // open a new tab to the vandelay queue for this record
+                            openils.XUL.newTabEasy(
+                                oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + qrec.queue()
+                            );
+                        }
+                    }
+                }
+            );
+        }
+
         nodeByName("worksheet_link", row).href =
             oilsBasePath + "/acq/lineitem/worksheet/" + li.id();
 
-- 
2.11.0