mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 18:03:37 +02:00
Added possibility to create nested structures of elements using Mass Import
This commit is contained in:
parent
22950f2476
commit
07f95bc6ea
7 changed files with 126 additions and 12 deletions
|
@ -148,9 +148,20 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
return false;
|
||||
}
|
||||
|
||||
//If this' parents element, is $another_element, then we are finished
|
||||
return ($this->parent->getID() === $another_element->getID())
|
||||
|| $this->parent->isChildOf($another_element); //Otherwise, check recursively
|
||||
//If the parent element is equal to the element we want to compare, return true
|
||||
if ($this->getParent()->getID() === null || $this->getParent()->getID() === null) {
|
||||
//If the IDs are not yet defined, we have to compare the objects itself
|
||||
if ($this->getParent() === $another_element) {
|
||||
return true;
|
||||
}
|
||||
} else { //If the IDs are defined, we can compare the IDs
|
||||
if ($this->getParent()->getID() === $another_element->getID()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Otherwise, check recursively
|
||||
return $this->parent->isChildOf($another_element);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue