mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +09:00
Update file count after copying document or comment with its files #2569
This commit is contained in:
parent
5e9cf872e7
commit
eaa0aee988
4 changed files with 63 additions and 2 deletions
|
|
@ -2001,6 +2001,41 @@ class CommentController extends Comment
|
||||||
$this->setMessage('success_declared_cancel');
|
$this->setMessage('success_declared_cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the number of uploaded files in the comment
|
||||||
|
*
|
||||||
|
* @param int|array $comment_srl_list
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateUploadedCount($comment_srl_list)
|
||||||
|
{
|
||||||
|
if (!is_array($comment_srl_list))
|
||||||
|
{
|
||||||
|
$comment_srl_list = array($comment_srl_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!count($comment_srl_list))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$comment_srl_list = array_unique($comment_srl_list);
|
||||||
|
|
||||||
|
foreach($comment_srl_list as $comment_srl)
|
||||||
|
{
|
||||||
|
$comment_srl = (int)$comment_srl;
|
||||||
|
if ($comment_srl <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = new stdClass;
|
||||||
|
$args->comment_srl = $comment_srl;
|
||||||
|
$args->uploaded_count = FileModel::getFilesCount($comment_srl);
|
||||||
|
executeQuery('comment.updateUploadedCount', $args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to add a pop-up menu when clicking for displaying child comments
|
* Method to add a pop-up menu when clicking for displaying child comments
|
||||||
* @param string $url
|
* @param string $url
|
||||||
|
|
|
||||||
11
modules/comment/queries/updateUploadedCount.xml
Normal file
11
modules/comment/queries/updateUploadedCount.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<query id="updateUploadedCount" action="update">
|
||||||
|
<tables>
|
||||||
|
<table name="comments" />
|
||||||
|
</tables>
|
||||||
|
<columns>
|
||||||
|
<column name="uploaded_count" var="uploaded_count" default="0" filter="number" />
|
||||||
|
</columns>
|
||||||
|
<conditions>
|
||||||
|
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
|
||||||
|
</conditions>
|
||||||
|
</query>
|
||||||
|
|
@ -3788,7 +3788,17 @@ Content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A typo of updateUploadedCount, maintained for backward compatibility.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public function updateUploaedCount($document_srl_list)
|
public function updateUploaedCount($document_srl_list)
|
||||||
|
{
|
||||||
|
return $this->updateUploadedCount($document_srl_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateUploadedCount($document_srl_list)
|
||||||
{
|
{
|
||||||
if(!is_array($document_srl_list))
|
if(!is_array($document_srl_list))
|
||||||
{
|
{
|
||||||
|
|
@ -3804,7 +3814,8 @@ Content;
|
||||||
|
|
||||||
foreach($document_srl_list as $document_srl)
|
foreach($document_srl_list as $document_srl)
|
||||||
{
|
{
|
||||||
if(!$document_srl = (int) $document_srl)
|
$document_srl = (int)$document_srl;
|
||||||
|
if ($document_srl <= 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -3824,7 +3835,7 @@ Content;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->updateUploaedCount($file->upload_target_srl);
|
$this->updateUploadedCount($file->upload_target_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2002,6 +2002,8 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
|
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
|
||||||
|
$this->setFilesValid($obj->copied->document_srl, 'doc');
|
||||||
|
DocumentController::getInstance()->updateUploadedCount($obj->copied->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerAddCopyCommentByDocument(&$obj)
|
function triggerAddCopyCommentByDocument(&$obj)
|
||||||
|
|
@ -2012,6 +2014,8 @@ class FileController extends File
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
|
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
|
||||||
|
$this->setFilesValid($obj->copied->comment_srl, 'com');
|
||||||
|
CommentController::getInstance()->updateUploadedCount($obj->copied->comment_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerCopyModule(&$obj)
|
function triggerCopyModule(&$obj)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue