Fix #1773 add function to delete temp saved document

This commit is contained in:
Kijin Sung 2021-09-11 21:30:31 +09:00
parent 1a23fc3a71
commit 53a7e4d90f
3 changed files with 60 additions and 2 deletions

View file

@ -343,6 +343,34 @@ class documentController extends document
return $this->declaredDocumentCancel($document_srl);
}
/**
* Delete temporarily saved document
*/
public function procDocumentDeleteTempSaved()
{
$document_srl = Context::get('document_srl');
if ($document_srl <= 0)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
$oDocument = DocumentModel::getDocument($document_srl);
if (!$oDocument || !$oDocument->isExists())
{
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
if ($oDocument->get('member_srl') !== $this->user->member_srl || $oDocument->getStatus() !== 'TEMP' || !$oDocument->isGranted())
{
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
$output = $this->deleteDocument($document_srl);
if ($output instanceof BaseObject && !$output->toBool())
{
return $output;
}
}
/**
* Delete alias when module deleted
* @param int $module_srl