mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-11 23:01:41 +09:00
#1055 게시물 이동 시 첨부파일의 수를 갱신하는 동작을 간소화 하도록 개선
This commit is contained in:
parent
228f4aa9bc
commit
21961fb3e9
4 changed files with 32 additions and 19 deletions
|
|
@ -95,6 +95,7 @@ class documentAdminController extends document
|
|||
$oFileController = getController('file');
|
||||
|
||||
$files = $oDocument->getUploadedFiles();
|
||||
$delete_file_srls = array();
|
||||
if(is_array($files))
|
||||
{
|
||||
foreach($files as $val)
|
||||
|
|
@ -119,9 +120,10 @@ class documentAdminController extends document
|
|||
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
|
||||
}
|
||||
}
|
||||
// Delete an existing file
|
||||
$oFileController->deleteFile($val->file_srl);
|
||||
$delete_file_srls[] = $val->file_srl;
|
||||
}
|
||||
// Delete an existing file
|
||||
$oFileController->deleteFile($delete_file_srls);
|
||||
}
|
||||
// Set the all files to be valid
|
||||
$oFileController->setFilesValid($obj->document_srl);
|
||||
|
|
|
|||
|
|
@ -2482,18 +2482,13 @@ class documentController extends document
|
|||
if(is_array($documentSrlList))
|
||||
{
|
||||
$documentSrlList = array_unique($documentSrlList);
|
||||
foreach($documentSrlList AS $key=>$documentSrl)
|
||||
foreach($documentSrlList AS $key => $documentSrl)
|
||||
{
|
||||
$oldDocument = $oDocumentModel->getDocument($documentSrl);
|
||||
$fileCount = $oFileModel->getFilesCount($documentSrl);
|
||||
|
||||
if($oldDocument != null)
|
||||
{
|
||||
$newDocumentArray = $oldDocument->variables;
|
||||
$newDocumentArray['uploaded_count'] = $fileCount;
|
||||
$newDocumentObject = (object) $newDocumentArray;
|
||||
$this->updateDocument($oldDocument, $newDocumentObject);
|
||||
}
|
||||
$args = new stdClass();
|
||||
$args->document_srl = $documentSrl;
|
||||
$args->uploaded_count = $fileCount;
|
||||
executeQuery('document.updateUploadedCount', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
modules/document/queries/updateUploadedCount.xml
Normal file
11
modules/document/queries/updateUploadedCount.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="updateUploadedCount" action="update">
|
||||
<tables>
|
||||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="uploaded_count" var="uploaded_count" default="0" filter="number" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue