mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 07:11:42 +09:00
if file delete, update file count in document table
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12610 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d6ae208275
commit
62fec548c6
2 changed files with 34 additions and 0 deletions
|
|
@ -2237,6 +2237,30 @@ class documentController extends document
|
|||
if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
|
||||
}
|
||||
|
||||
public function updateUploaedCount($documentSrlList)
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
if(is_array($documentSrlList))
|
||||
{
|
||||
$documentSrlList = array_unique($documentSrlList);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy extra keys when module copied
|
||||
* @param object $obj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue