issue 2267 if delete comment by trash module, not exist document data in document table.

so, 'not grant' message showed.
so, document object is object, set to document object from obj variables.


git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11056 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-08-22 08:26:45 +00:00
parent d505abf31c
commit c1c0a39c72

View file

@ -82,7 +82,7 @@
$document_srl = $obj->document_srl;
if(!$document_srl) return new Object();
return $this->deleteComments($document_srl, true);
return $this->deleteComments($document_srl, $obj);
}
/**
@ -662,12 +662,21 @@
* @param int $document_srl
* @return object
*/
function deleteComments($document_srl) {
function deleteComments($document_srl, &$obj = NULL) {
// create the document model object
$oDocumentModel = &getModel('document');
$oCommentModel = &getModel('comment');
// check if permission is granted
$oDocument = $oDocumentModel->getDocument($document_srl);
// check if permission is granted
if(is_object($obj))
{
$oDocument = new documentItem();
$oDocument->setAttribute($obj);
}
else
{
$oDocument = $oDocumentModel->getDocument($document_srl);
}
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
// get a list of comments and then execute a trigger(way to reduce the processing cost for delete all)
$args->document_srl = $document_srl;