Verified Commit 7c2c1719 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚑 fix(systems) Attempt at fixing creation by template issues

issue #6039
parent feb4e947
......@@ -113,21 +113,26 @@ class interfacesManagement extends management implements SimpleTab
} else {
$this->interfaces[$entry->dn] = objects::open($entry->dn, $entry->getTemplatedType());
}
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->dn;
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->getInterfacesBase();
}
}
protected function setUpListing ()
private function getInterfacesBase (): string
{
/* Set baseMode to FALSE */
$this->listing = new managementListing($this, FALSE);
if ($this->dn != 'new') {
$this->listing->setBase($this->dn);
return $this->dn;
} else {
$this->listing->setBase('new,'.$this->parent->getBaseObject()->base);
return 'new,'.$this->parent->getBaseObject()->base;
}
}
protected function setUpListing ()
{
/* Set baseMode to FALSE */
$this->listing = new managementListing($this, FALSE);
$this->listing->setBase($this->getInterfacesBase());
}
protected function setUpFilter (array $filterElementDefinitions)
{
$this->filter = new interfacesManagementFilter($this, NULL, $filterElementDefinitions);
......@@ -258,11 +263,7 @@ class interfacesManagement extends management implements SimpleTab
function openTabObject ($object)
{
parent::openTabObject($object);
if ($this->dn != 'new') {
$this->tabObject->getBaseObject()->base = $this->dn;
} else {
$this->tabObject->getBaseObject()->base = 'new,'.$this->parent->getBaseObject()->base;
}
$this->tabObject->getBaseObject()->base = $this->getInterfacesBase();
if ($this->is_template) {
$this->tabObject->setTemplateMode('');
}
......@@ -351,7 +352,7 @@ class interfacesManagement extends management implements SimpleTab
logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Saving subobject');
/* The move was already done if needed by main tab, so we need to update dn of subobjects */
$object->dn = str_replace($object->getBaseObject()->base, $this->dn, $object->dn);
$object->getBaseObject()->base = $this->dn;
$object->getBaseObject()->base = $this->getInterfacesBase();
/* Save subobject and store errors if any */
$errors = array_merge($errors, $object->save());
}
......@@ -424,7 +425,7 @@ class interfacesManagement extends management implements SimpleTab
foreach ($entryIterator as $entry) {
$this->interfaces[$entry->dn] = objects::create($entry->getTemplatedType());
$this->filter->resetFromCache($entry->dn, $this->interfaces[$entry->dn]);
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->dn;
$this->interfaces[$entry->dn]->getBaseObject()->base = $this->getInterfacesBase();
}
/* Fill ip/mac fields of main tab */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment