From a85291e6392a5aed8cc1802db5f5e7b3ed184724 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 28 Mar 2023 16:08:03 +0800 Subject: [PATCH] * Code for task #89135. --- module/doc/control.php | 5 +++++ module/doc/model.php | 14 +++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 3ecc2969bb..c29eee4a80 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -310,6 +310,11 @@ class doc extends control $objectType = $lib->type; $objectID = strpos(',product,project,execution,', ",$objectType,") !== false ? $lib->{$objectType} : 0; + if($this->app->tab == 'doc' and $objectType == 'execution') + { + $objectType = 'project'; + $objectID = $lib->project; + } $browseLink = $this->createLink('doc', $from, "type=$objectType&objectID=$objectID"); return print(js::locate($browseLink, 'parent')); diff --git a/module/doc/model.php b/module/doc/model.php index e5aff7372a..97f720ca06 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -192,7 +192,7 @@ class docModel extends model $lib = fixer::input('post') ->setForce('product', $this->post->type == 'product' ? $this->post->product : 0) ->setForce('project', $this->post->type == 'project' ? $this->post->project : 0) - ->setForce('execution', $this->post->type == 'execution' ? $this->post->execution : 0) + ->setForce('execution', $this->post->type == 'execution' || $this->post->execution ? $this->post->execution : 0) ->join('groups', ',') ->join('users', ',') ->add('addedBy', $this->app->user->account) @@ -1487,7 +1487,11 @@ class docModel extends model ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) ->andWhere($type)->eq($objectID) - ->beginIF(!empty($executionIDList))->orWhere('execution')->in(array_keys($executionIDList))->fi() + ->beginIF(!empty($executionIDList)) + ->orWhere('(execution')->in(array_keys($executionIDList)) + ->andWhere('deleted')->eq(0) + ->markRight(1) + ->fi() ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() ->orderBy('`order` asc, id_asc') ->fetchAll('id'); @@ -2832,7 +2836,7 @@ class docModel extends model foreach($libs as $lib) { if($lib->type != 'execution') continue; - $executionLibs[$lib->execution][$libID] = $lib; + $executionLibs[$lib->execution][$lib->id] = $lib; } $executionPairs = $this->dao->select('id,name')->from(TABLE_EXECUTION) @@ -2876,11 +2880,11 @@ class docModel extends model } $libTree['execution'][$executionID] = $execution; - continue; + if(count($executionLibs[$executionID]) == 1) continue; } $libTree['execution'][$executionID]->active = $item->active ? 1 : $libTree['execution'][$executionID]->active; - $libTree['execution'][$executionID]->children[$lib->id] = $item; + $libTree['execution'][$executionID]->children[] = $item; } }