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);

View file

@ -248,12 +248,18 @@ class commentModel extends comment
//check if module is using validation system
$oCommentController = getController('comment');
$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
$module_info = getModel('module')->getModuleInfoByDocumentSrl($document_srl);
$use_comment_massage = $module_info->comment_delete_message;
if($using_validation)
{
$args->status = 1;
}
elseif($use_comment_massage == 'Y')
{
$args->status = 1;
}
$output = executeQuery('comment.getCommentCount', $args, NULL, 'master');
$total_count = $output->data->count;

View file

@ -10,5 +10,6 @@
<condition operation="equal" column="document_srl" var="document_srl" filter="number" pipe="and" />
<condition operation="in" column="module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="like_prefix" column="regdate" var="regDate" pipe="and" />
<condition operation="equal" column="status" var="status" pipe="and" />
</conditions>
</query>