삭제 할때 옵션여부의 동작을 인식하여 휴지통 기능을 실행하도록 개선

This commit is contained in:
BJRambo 2017-03-07 08:34:04 +09:00
parent 9886c92d2b
commit aefecb203c
3 changed files with 19 additions and 12 deletions

View file

@ -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
{

View file

@ -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())

View file

@ -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 = '모듈 번호가 존재하지 않습니다.';