mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 12:11:19 +00:00
call hooks like in updateDocument
This commit is contained in:
parent
35fa67ae93
commit
e0bbc4bab5
|
@ -63,8 +63,8 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
|||
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
|
||||
$defaultaccessdocs = $this->getParam('defaultaccessdocs');
|
||||
|
||||
$result = $this->callHook('addDocument');
|
||||
if($result === null) {
|
||||
$document = $this->callHook('addDocument');
|
||||
if($document === null) {
|
||||
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
||||
$res = $folder->addDocument($name, $comment, $expires, $owner, $keywords,
|
||||
$cats, $userfiletmp, utf8_basename($userfilename),
|
||||
|
@ -87,13 +87,6 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
|||
}
|
||||
}
|
||||
|
||||
if($index) {
|
||||
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
|
||||
if(!$this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
}
|
||||
$index->addDocument($idoc);
|
||||
}
|
||||
|
||||
/* Add a default notification for the owner of the document */
|
||||
if($settings->_enableOwnerNotification) {
|
||||
$res = $document->addNotify($user->getID(), true);
|
||||
|
@ -107,13 +100,24 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
|||
if($document->getGroupAccessMode($notgroup) >= M_READ)
|
||||
$res = $document->addNotify($notgroup->getID(), false);
|
||||
}
|
||||
|
||||
if(!$this->callHook('postAddDocument', $document)) {
|
||||
}
|
||||
$result = $document;
|
||||
} elseif($result === false) {
|
||||
if(empty($this->errormsg))
|
||||
$this->errormsg = 'hook_addDocument_failed';
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result;
|
||||
if($index && $document) {
|
||||
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
|
||||
if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
||||
$index->addDocument($idoc);
|
||||
$index->commit();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->callHook('postAddDocument', $document)) {
|
||||
}
|
||||
|
||||
return $document;
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user