call postAddSubfolder, add folder to fulltext index

This commit is contained in:
Uwe Steinmann 2020-12-14 07:56:15 +01:00
parent df29339c28
commit 8bc8b3ae13

View File

@ -33,7 +33,7 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
if(false === $this->callHook('preAddSubFolder')) { if(false === $this->callHook('preAddSubFolder')) {
if(empty($this->errormsg)) if(empty($this->errormsg))
$this->errormsg = 'hook_preAddSubFolder_failed'; $this->errormsg = 'hook_preAddSubFolder_failed';
return null; return false;
} }
$name = $this->getParam('name'); $name = $this->getParam('name');
@ -61,8 +61,8 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
$notificationgroups = $this->getParam('notificationgroups'); $notificationgroups = $this->getParam('notificationgroups');
$notificationusers = $this->getParam('notificationusers'); $notificationusers = $this->getParam('notificationusers');
$result = $this->callHook('addSubFolder'); $subFolder = $this->callHook('addSubFolder');
if($result === null) { if($subFolder === null) {
$subFolder = $folder->addSubFolder($name, $comment, $user, $sequence, $attributes); $subFolder = $folder->addSubFolder($name, $comment, $user, $sequence, $attributes);
if (!is_object($subFolder)) { if (!is_object($subFolder)) {
$this->errormsg = "error_occured"; $this->errormsg = "error_occured";
@ -77,13 +77,27 @@ class SeedDMS_Controller_AddSubFolder extends SeedDMS_Controller_Common {
if($subFolder->getGroupAccessMode($notgroup) >= M_READ) if($subFolder->getGroupAccessMode($notgroup) >= M_READ)
$res = $subFolder->addNotify($notgroup->getID(), false); $res = $subFolder->addNotify($notgroup->getID(), false);
} }
} elseif($subFolder === false) {
if(!$this->callHook('postAddSubFolder', $subFolder)) { if(empty($this->errormsg))
} $this->errormsg = 'hook_addFolder_failed';
$result = $subFolder; return false;
} }
return $result; if($fulltextservice && ($index = $fulltextservice->Indexer()) && $document) {
$idoc = $fulltextservice->IndexedDocument($subFolder);
if(false !== $this->callHook('preIndexFolder', $document, $idoc)) {
$index->addDocument($idoc);
$index->commit();
}
}
if(false === $this->callHook('postAddSubFolder', $subFolder)) {
if(empty($this->errormsg))
$this->errormsg = 'hook_postAddSubFoder_failed';
return false;
}
return $subFolder;
} /* }}} */ } /* }}} */
} }