LP#1235474: fix failure of authority browse context menu to render user/gmcharlt/lp1235474_fix_auth_ctx_menu_crash
authorGalen Charlton <gmc@esilibrary.com>
Fri, 4 Oct 2013 21:44:56 +0000 (14:44 -0700)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 4 Oct 2013 21:44:56 +0000 (14:44 -0700)
This patch fixes a situation where if an authority record that would
be brought up by the authority browse context menu in the MARC editor
lacks an 003 field, the context menu would not be rendered all, meaning
that the default context menu (e.g., cut/copy/paste/etc.) would be
displayed instead.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/xul/staff_client/server/cat/marcedit.js

index 7694d44..87b217e 100644 (file)
@@ -1838,7 +1838,10 @@ function browseAuthority (sf_popup, menu_id, target, sf, limit, page) {
             var see_from = [];
             var see_also = [];
             var auth_id = dojox.xml.parser.textContent(dojo.query('datafield[tag="901"]', record).query('subfield[code="c"]')[0]);
-            var auth_org = dojox.xml.parser.textContent(dojo.query('controlfield[tag="003"]', record)[0]);
+            var auth_org = '';
+            if (dojo.query('controlfield[tag="003"]', record).length > 0) {
+                auth_org = dojox.xml.parser.textContent(dojo.query('controlfield[tag="003"]', record)[0]);
+            }
 
             // Grab the fields with tags beginning with 1 (main entries) and iterate through the subfields
             dojo.query('datafield[tag^="1"]', record).forEach(function(field) {