sіmplify and possibly fix method isDescendant()

This commit is contained in:
Uwe Steinmann 2019-07-01 13:06:08 +02:00
parent 536067200e
commit d18a3389bc

View File

@ -692,15 +692,11 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
* @return boolean true if folder is a subfolder
*/
function isDescendant($folder) { /* {{{ */
if ($this->_parentID == $folder->getID())
return true;
elseif (isset($this->_parentID)) {
$res = $this->getParent();
if (!$res) return false;
return $this->_parent->isDescendant($folder);
} else
if(!$this->getParent())
return false;
if($this->getParent()->getID() == $folder->getID())
return true;
return $this->getParent()->isDescendant($folder);
} /* }}} */
/**