* Finish task #36496.

This commit is contained in:
holan20180123
2021-03-10 09:12:07 +08:00
parent 52785d17b3
commit 8f294074bb
5 changed files with 225 additions and 10 deletions
+7 -9
View File
@@ -672,15 +672,10 @@ class actionModel extends model
/* If is project, select its related. */
$executions = array();
$products = array();
if(is_numeric($projectID))
{
$project = $this->loadModel('project')->getByID($projectID);
if(isset($project->type) and $project->type == 'project')
{
$executions = $this->loadModel('execution')->getPairs($projectID);
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
}
if(isset($project->type) and $project->type == 'project') $executions = $this->loadModel('execution')->getPairs($projectID);
}
$this->loadModel('doc');
@@ -697,9 +692,12 @@ class actionModel extends model
->beginIF($date)->andWhere('date' . ($direction == 'next' ? '<' : '>') . "'{$date}'")->fi()
->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi()
->beginIF(is_numeric($productID))->andWhere('product')->like("%,$productID,%")->fi()
->beginIF(is_numeric($projectID))->andWhere('execution')->eq($projectID)->fi()
->beginIF(!empty($executions))->markLeft()->orWhere('execution')->in($executions)->fi()->markRight()
->beginIF(!empty($products))->markLeft()->orWhere('product')->in($products)->fi()->markRight()
->andWhere()
->markLeft(1)
->where(1)
->beginIF(is_numeric($projectID))->orWhere('execution')->eq($projectID)->fi()
->beginIF(!empty($executions))->orWhere('execution')->in(array_keys($executions))->fi()
->markRight(1)
->beginIF($productID == 'notzero')->andWhere('product')->gt(0)->andWhere('product')->notlike('%,0,%')->fi()
->beginIF($projectID == 'notzero')->andWhere('execution')->gt(0)->fi()
->beginIF($projectID == 'all' or $productID == 'all')->andWhere("IF((objectType!= 'doc' && objectType!= 'doclib'), ($condition), '1=1')")->fi()