Improving do not count the deleted comments.

This commit is contained in:
BJRambo 2016-05-24 21:32:41 +09:00
parent 5e036bf586
commit fb4ff53a6f
3 changed files with 26 additions and 1 deletions

View file

@ -939,6 +939,24 @@ class commentController extends comment
// call a trigger by delete (after)
ModuleHandler::triggerCall('comment.updateCommentByDelete', 'after', $obj);
// update the number of comments
$oCommentModel = getModel('comment');
$comment_count = $oCommentModel->getCommentCount($obj->document_srl);
// only document is exists
if(isset($comment_count))
{
// create the controller object of the document
$oDocumentController = getController('document');
// update comment count of the article posting
$output = $oDocumentController->updateCommentCount($obj->document_srl, $comment_count, NULL, FALSE);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
}
$oDB->commit();
$output->add('document_srl', $obj->document_srl);