diff --git a/op/op.Ajax.php b/op/op.Ajax.php index b2a68d9b2..3e987b459 100644 --- a/op/op.Ajax.php +++ b/op/op.Ajax.php @@ -806,12 +806,14 @@ switch($command) { if(isset($GLOBALS['SEEDDMS_HOOKS']['indexDocument'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['indexDocument'] as $hookObj) { if (method_exists($hookObj, 'preIndexDocument')) { - $hookObj->preIndexDocument(null, $document, $idoc); + if(false !== ($ires = $hookObj->preIndexDocument(null, $document, $idoc))) { + $ires = $index->addDocument($idoc); + } } } } header('Content-Type: application/json'); - if(false === $index->addDocument($idoc)) { + if(false === $ires) { echo json_encode(array('success'=>false, 'message'=>getMLText('error_document_indexed'), 'data'=>$document->getID())); } else { echo json_encode(array('success'=>true, 'message'=>getMLText('splash_document_indexed'), 'data'=>$document->getID(), 'cmd'=>$idoc->getCmd()));