mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +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');
|
$maxsizeforfulltext = $this->getParam('maxsizeforfulltext');
|
||||||
$defaultaccessdocs = $this->getParam('defaultaccessdocs');
|
$defaultaccessdocs = $this->getParam('defaultaccessdocs');
|
||||||
|
|
||||||
$result = $this->callHook('addDocument');
|
$document = $this->callHook('addDocument');
|
||||||
if($result === null) {
|
if($document === null) {
|
||||||
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
$filesize = SeedDMS_Core_File::fileSize($userfiletmp);
|
||||||
$res = $folder->addDocument($name, $comment, $expires, $owner, $keywords,
|
$res = $folder->addDocument($name, $comment, $expires, $owner, $keywords,
|
||||||
$cats, $userfiletmp, utf8_basename($userfilename),
|
$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 */
|
/* Add a default notification for the owner of the document */
|
||||||
if($settings->_enableOwnerNotification) {
|
if($settings->_enableOwnerNotification) {
|
||||||
$res = $document->addNotify($user->getID(), true);
|
$res = $document->addNotify($user->getID(), true);
|
||||||
|
@ -107,13 +100,24 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
|
||||||
if($document->getGroupAccessMode($notgroup) >= M_READ)
|
if($document->getGroupAccessMode($notgroup) >= M_READ)
|
||||||
$res = $document->addNotify($notgroup->getID(), false);
|
$res = $document->addNotify($notgroup->getID(), false);
|
||||||
}
|
}
|
||||||
|
} elseif($result === false) {
|
||||||
|
if(empty($this->errormsg))
|
||||||
|
$this->errormsg = 'hook_addDocument_failed';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)) {
|
if(!$this->callHook('postAddDocument', $document)) {
|
||||||
}
|
}
|
||||||
$result = $document;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
return $document;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user