Plug the many OPAC visibility holes in search result item display
authorDan Scott <dan@coffeecode.net>
Tue, 31 May 2011 02:49:00 +0000 (22:49 -0400)
committerDan Scott <dan@coffeecode.net>
Mon, 13 Jun 2011 14:04:30 +0000 (10:04 -0400)
Check volume and circ_lib and copy status OPAC visibility (and
deleted status in the case of volumes) in addition to the existing
copy and copy-location checks.

Worst hack is hard-coded copy status IDs of 0, 7, 12 - but this is
currently used throughout the code, so one more can't hurt that much
(OWWW).

Signed-off-by: Dan Scott <dan@coffeecode.net>
Open-ILS/web/opac/skin/default/xml/result/result_table.xml

index 5ff3ba8..517ce19 100644 (file)
                                         if (item_cnt >= max_items) {
                                             return output.innerHTML;
                                         }
+                                        if (vol.getAttribute('deleted') == 't') {
+                                            return;
+                                        }
+                                        if (vol.getAttribute('opac_visible') == 'f') {
+                                            return;
+                                        }
                                         dojo.query('copy', vol).forEach(function (cp) {
                                             if (item_cnt >= max_items) {
                                                 return;
                                             if (cp.getAttribute('opac_visible') == 'f') {
                                                 return;
                                             }
+
+                                            /* Hardcoded check for copy status 0, 7, or 12 */
+                                            var ident;
+                                            dojo.query('status', cp).forEach(function (status) {
+                                                ident = status.getAttribute('ident');
+                                            });
+                                            if (parseInt(ident) !== 0 && 
+                                                parseInt(ident) != 7 &&
+                                                parseInt(ident) != 12) {
+                                                return;
+                                            }
+
+
+                                            /* Ensure the circulation library is visible */
+                                            var lib_vis;
+                                            dojo.query('circlib', cp).forEach(function (status) {
+                                                lib_vis = status.getAttribute('opac_visible');
+                                            });
+                                            if (lib_vis != 't') {
+                                                return;
+                                            }
+
                                             var cp_entry = dojo.create('div');
                                             var loc_visible;
                                             var vol_appended = false;