LP#1999944: fix bug that can break drawing the folder tree for reports
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Fri, 9 Dec 2022 20:40:54 +0000 (15:40 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 21 Feb 2023 21:09:39 +0000 (16:09 -0500)
Specifically, skip drawfolders iteration if parent node cannot be
found and eport invalid parent folder in the browser console.

For example, if a user creates a template folder that is not shared
that has a child folder that _is_ shared, another user at the library
that the folder is shared with would see their report folders be
incompletely rendered.

Signed-off-by: Llewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Signed-off-by: blake <blake@mobiusconsortium.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/web/reports/oils_rpt_folders.js

index 03c961d..1f1a77d 100644 (file)
@@ -304,7 +304,11 @@ oilsRptFolderManager.prototype.drawFolders = function(type, folders) {
                id = node.treeId;
                if( folder.parent() ) {
             var pnode = this.findNode(type, folder.parent());
-                       pid = pnode.treeId;
+                       if(!pnode){
+                console.error("An error occurred retrieving "+type+" folder #"+folder.parent());
+                continue;
+            }
+            pid = pnode.treeId;
             node.depth = pnode.depth + 1;
         } else {
             node.depth = 0;