diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 6680f6d9d..51be6bb5f 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -519,6 +519,24 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ return true; } /* }}} */ + /** + * Check, if this document is below of a given folder + * + * @param object $folder parent folder + * @return boolean true if folder is a subfolder + */ + function isDescendant($folder) { /* {{{ */ + /* First check if the parent folder is folder looking for */ + if ($this->getFolder()->getID() == $folder->getID()) + return true; + /* Second, check for the parent folder of this document to be + * below the given folder + */ + if($this->getFolder()->isDescendant($folder)) + return true; + return false; + } /* }}} */ + /** * Return the parent folder of the document *