* fix bug for doc's purview.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-09-26 01:29:03 +00:00
parent 8e473d2046
commit a6172913ec
2 changed files with 4 additions and 2 deletions

View File

@@ -371,7 +371,7 @@ class doc extends control
/* Get doc. */
$doc = $this->doc->getById($docID);
if(!$doc) die(js::error($this->lang->notFound) . js::locate('back'));
if(!$this->project->checkPriv($this->project->getById($doc->project)))
if($doc->project != 0 and !$this->project->checkPriv($this->project->getById($doc->project)))
{
echo(js::alert($this->lang->error->accessDenied));
die(js::locate('back'));

View File

@@ -117,11 +117,13 @@ class docModel extends model
$projects = $this->loadModel('project')->getPairs();
$keysOfProducts = array_keys($products);
$keysOfProjects = array_keys($projects);
$allKeysOfProjects = $keysOfProjects;
$allKeysOfProjects[] = 0;
return $this->dao->select('*')->from(TABLE_DOC)
->where('deleted')->eq(0)
->beginIF(is_numeric($libID))->andWhere('lib')->eq($libID)->fi()
->beginIF($libID == 'product')->andWhere('product')->in($keysOfProducts)->andWhere('project')->in($keysOfProjects)->fi()
->beginIF($libID == 'product')->andWhere('product')->in($keysOfProducts)->andWhere('project')->in($allKeysOfProjects)->fi()
->beginIF($libID == 'project')->andWhere('project')->in($keysOfProjects)->fi()
->beginIF($productID > 0)->andWhere('product')->eq($productID)->fi()
->beginIF($projectID > 0)->andWhere('project')->eq($projectID)->fi()