diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index 683364090..5414c155b 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -527,12 +527,14 @@ class boardController extends board // generate comment controller object $oCommentController = getController('comment'); + $updateComment = false; if($this->module_info->comment_delete_message === 'yes' && $instant_delete != 'Y') { $output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager); + $updateComment = true; if($this->module_info->trash_use == 'Y') { - $output = $oCommentController->moveCommentToTrash($comment); + $output = $oCommentController->moveCommentToTrash($comment, $updateComment); } } elseif(starts_with('only_comm', $this->module_info->comment_delete_message) && $instant_delete != 'Y') @@ -541,16 +543,17 @@ class boardController extends board if(count($childs) > 0) { $output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager); + $updateComment = true; if($this->module_info->trash_use == 'Y') { - $output = $oCommentController->moveCommentToTrash($comment); + $output = $oCommentController->moveCommentToTrash($comment, $updateComment); } } else { if($this->module_info->trash_use == 'Y') { - $output = $oCommentController->moveCommentToTrash($comment); + $output = $oCommentController->moveCommentToTrash($comment, $updateComment); } else { @@ -566,7 +569,7 @@ class boardController extends board { if($this->module_info->trash_use == 'Y') { - $output = $oCommentController->moveCommentToTrash($comment); + $output = $oCommentController->moveCommentToTrash($comment, $this->module_info->comment_delete_message); } else { diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 401977148..42c562bb6 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -1193,7 +1193,7 @@ class commentController extends comment * @param $obj * @return object */ - function moveCommentToTrash($obj) + function moveCommentToTrash($obj, $updateComment = false) { $logged_info = Context::get('logged_info'); $trash_args = new stdClass(); @@ -1221,7 +1221,7 @@ class commentController extends comment if($trash_args->module_srl === 0) { - return false; + return new Object(-1, 'msg_module_srl_not_exists'); } $trash_args->document_srl = $obj->document_srl; $trash_args->comment_srl = $obj->comment_srl; @@ -1241,9 +1241,9 @@ class commentController extends comment require_once(RX_BASEDIR.'modules/trash/model/TrashVO.php'); $oTrashVO = new TrashVO(); $oTrashVO->setTrashSrl(getNextSequence()); - $oTrashVO->setTitle(trim(strip_tags($oComment->variables['content']))); + $oTrashVO->setTitle(trim(strip_tags($obj->variables['content']))); $oTrashVO->setOriginModule('comment'); - $oTrashVO->setSerializedObject(serialize($oComment->variables)); + $oTrashVO->setSerializedObject(serialize($obj->variables)); $oTrashVO->setDescription($obj->description); $oTrashAdminController = getAdminController('trash'); @@ -1254,11 +1254,14 @@ class commentController extends comment return $output; } - $output = executeQuery('comment.deleteComment', $trash_args); - if(!$output->toBool()) + if($updateComment !== true) { - $oDB->rollback(); - return $output; + $output = executeQuery('comment.deleteComment', $trash_args); + if(!$output->toBool()) + { + $oDB->rollback(); + return $output; + } } if($oComment->hasUploadedFiles()) diff --git a/modules/comment/lang/ko.php b/modules/comment/lang/ko.php index 4538f56c5..6feb1e192 100644 --- a/modules/comment/lang/ko.php +++ b/modules/comment/lang/ko.php @@ -56,3 +56,4 @@ $lang->msg_admin_deleted_comment = '관리자가 삭제한 댓글입니다.'; $lang->msg_no_text_comment = '글자가 없는 댓글입니다.'; $lang->msg_comment_notify_mail = '[%s] 새로운 댓글이 등록되었습니다 : %s'; $lang->msg_admin_comment_no_move_to_trash = '최고관리자의 댓글을 휴지통으로 이동시킬 권한이 없습니다.'; +$lang->msg_module_srl_not_exists = '모듈 번호가 존재하지 않습니다.';