JBAS-769 CHS title/author subfield trimming
authorBill Erickson <berickxx@gmail.com>
Fri, 7 Aug 2015 15:48:56 +0000 (11:48 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Title now shows 245a,b and author is 100a,c

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/opac/extras/circ/alt_holds_print.html
Open-ILS/web/opac/extras/circ/alt_holds_print.js

index 3ad3145..17d6fb7 100644 (file)
                     <td only="shelf_expired_holds">${usr.display_name}</td>
                     <td only="shelf_expired_holds">${action}</td>
                     <td>${hold_type}</td>
+                    <!--
                     <td type='opac/slot-data' query='datafield[tag="245"]'></td>
                     <td type='opac/slot-data' query='datafield[tag^="1"]' limit='1'> </td>
+                    -->
+                    <td>${title}</td>
+                    <td>${author}</td>
                     <td>${current_copy.location.name}</td>
                     <td>${current_copy.call_number.prefix.label} ${current_copy.call_number.label} ${current_copy.call_number.suffix.label}</td>
                     <td>${current_copy.barcode} ${current_copy.parts_stringified}</td>
index 4075a98..8597543 100644 (file)
@@ -214,6 +214,37 @@ function do_clear_holds_from_cache(cache_key) {
                         var hold = hashify_fields(resp.hold_details);
                         hold.action = resp.action;
 
+                        var xmlDoc = new DOMParser().parseFromString(
+                            hold.current_copy.call_number.record.marc,"text/xml");
+
+                        var m100a = '';
+                        var m100c = '';
+                        var m245a = '';
+                        var m245b = '';
+
+                        dojo.forEach(
+                            xmlDoc.documentElement.getElementsByTagName('datafield'), 
+                            function(node) {
+                                var tag = node.getAttribute('tag');
+                                if (tag == '100') {
+                                    dojo.forEach(node.childNodes, function(sub_node) {
+                                        var code = sub_node.getAttribute('code');
+                                        if (code == 'a') m100a = sub_node.textContent;
+                                        if (code == 'c') m100c = sub_node.textContent;
+                                    });
+                                } else if (tag == '245') {
+                                    dojo.forEach(node.childNodes, function(sub_node) {
+                                        var code = sub_node.getAttribute('code');
+                                        if (code == 'a') m245a = sub_node.textContent;
+                                        if (code == 'b') m245b = sub_node.textContent;
+                                    });
+                                }
+                            }
+                        );
+
+                        hold.author = m100a + ' ' + m100c;
+                        hold.title = m245a + ' ' + m245b;
+
                         if(resp.hold_details.hold_type) {
                             hold.hold_type = resp.hold_details.hold_type;
                         } else {