Currently, items marked opac_visible = 'f' will not user/abowling/lp1403913_items_visible_staff_client
authorAdam Bowling <abowling@emeralddata.net>
Tue, 27 Jan 2015 21:27:43 +0000 (16:27 -0500)
committerAdam Bowling <abowling@emeralddata.net>
Tue, 27 Jan 2015 21:27:43 +0000 (16:27 -0500)
appear for staff members in the staff client. This
patch corrects that by allowing items marked invisible
to show up in the copy and volume sections of the staff client
while still remaining invisible in the TPAC.

Signed-off-by: Adam Bowling <abowling@emeralddata.net>
Open-ILS/src/templates/opac/parts/misc_util.tt2

index b4bf194..fddf65d 100644 (file)
     #   get_marc_attrs( { marc_xml => doc } )
     BLOCK get_marc_attrs;
         xml = args.marc_xml;
+        is_staff = 'false';
+        IF ctx.is_staff;
+            is_staff = 'true';
+        END;
 
         # Map item types to schema.org types; impedance mismatch :(
         args.schema.itemtype = {};
             END;
 
             vol.id = volume.getAttribute('id');
-            NEXT IF volume.getAttribute('opac_visible') == 'false';
+            NEXT IF volume.getAttribute('opac_visible') == 'false' && is_staff = 'false';
             NEXT IF volume.getAttribute('deleted') == 'true';
 
             IF vol.label == '##URI##';
                         LAST IF part_label != '';
                     END;
                     # Check copy visibility
-                    cp.deleted = copy.getAttribute('deleted');    
-                    cp.visible = copy.getAttribute('opac_visible');
+                    cp.deleted = copy.getAttribute('deleted');
+                    IF is_staff == 'true';
+                        cp.visible = 'true';
+                    ELSE;
+                        cp.visible = copy.getAttribute('opac_visible');
+                    END;
                     NEXT IF (cp.deleted == 'true' OR cp.visible == 'false');
 
                     # Iterate through all of the children to determine visibility
                     FOR node IN cp.childNodes;
                         NEXT IF cp.visible == 'false';
-                        vis = node.getAttribute('opac_visible');
+                        IF is_staff == 'true';
+                            vis = 'true';
+                        ELSE;
+                            vis = node.getAttribute('opac_visible');
+                        END;
                         del = node.getAttribute('deleted');
                         IF vis == 'false' or del == 'true';
                             cp.visible = 'false';
                     NEXT IF cp.visible == 'false';
                     
                     loc = copy.findnodes('./*[local-name()="location"]');
-                    NEXT IF loc.getAttribute('opac_visible') == 'false';
+                    NEXT IF loc.getAttribute('opac_visible') == 'false' && is_staff == 'false';
 
                     circlib = copy.findnodes('./*[local-name()="circlib"]');
-                    NEXT IF circlib.getAttribute('opac_visible') == 'false';
+                    NEXT IF circlib.getAttribute('opac_visible') == 'false' && is_staff == 'false';
 
                     status = copy.findnodes('./*[local-name()="status"]');
-                    NEXT IF status.getAttribute('opac_visible') == 'false';
+                    NEXT IF status.getAttribute('opac_visible') == 'false' && is_staff == 'false';
 
                     # extract the circ_lib id from the circ_lib node
                     circ_lib = copy.findnodes('./*[local-name()="circ_lib"]');
         FOR node IN xml.findnodes(formats_xpath);
             IF node AND node.textContent;
                 ccvm = ctx.get_ccvm(node.getAttribute('cvmid'));
-                NEXT IF ccvm.opac_visible == 'f';
+                NEXT IF ccvm.opac_visible == 'f' && is_staff == 'false';
 
                 format = {};
                 type = ccvm.code.remove('-'); # blu-ray to bluray