From a0921f1c7d4f978fd83bc20643cab11736dc2170 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 18 Jan 2022 10:49:53 +0800 Subject: [PATCH] * Fix bug #18638, #18644. --- module/action/model.php | 12 ++++++++---- module/execution/control.php | 2 +- module/execution/js/kanban.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index a99810be8b..8ff7ca0b7b 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -352,14 +352,18 @@ class actionModel extends model } elseif($actionName == 'linked2execution') { - $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); - if($name) $action->extra = common::hasPriv('execution', 'view') ? html::a(helper::createLink('execution', 'view', "executionID=$action->execution"), $name) : $name; + $execution = $this->dao->select('name,type')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch(); + $name = $execution->name; + $method = $execution->type == 'kanban' ? 'kanban' : 'view'; + if($name) $action->extra = common::hasPriv('execution', $method) ? html::a(helper::createLink('execution', $method, "executionID=$action->execution"), $name) : $name; } elseif($actionName == 'linked2project') { - $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); + $project = $this->dao->select('name,model')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch(); $productID = trim($action->product, ','); - if($name) $action->extra = common::hasPriv('project', 'view') ? html::a(helper::createLink('project', 'view', "projectID=$action->project"), $name) : $name; + $name = $project->name; + $method = $project->model == 'kanban' ? 'index' : 'view'; + if($name) $action->extra = common::hasPriv('project', $method) ? html::a(helper::createLink('project', $method, "projectID=$action->project"), $name) : $name; } elseif($actionName == 'linked2plan') { diff --git a/module/execution/control.php b/module/execution/control.php index 254483c957..26900210a1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1978,7 +1978,7 @@ class execution extends control $userList = array(); $users = $this->loadModel('user')->getPairs('noletter|nodeleted'); - $avatarPairs = $this->dao->select('account, avatar')->from(TABLE_USER)->where('deleted')->eq(0)->fetchPairs(); + $avatarPairs = $this->user->getAvatarPairs(); foreach($avatarPairs as $account => $avatar) { if(!$avatar) continue; diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 3b6ecdf479..1f001ee590 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -338,7 +338,7 @@ function renderUserAvatar(user, objectType, objectID, size) if(!user) return $(''); if(typeof user === 'string') user = {account: user}; - if(!user.avatar && window.users && window.users[user.account]) user = {avatar: users[user.account].avatar, account: user.account, realname: users[user.account]}; + if(!user.avatar && window.userList && window.userList[user.account]) user = {avatar: userList[user.account].avatar, account: user.account, realname: userList[user.account]}; var $noPrivAvatar = $('
').avatar({user: user}); if(objectType == 'task' && !priv.canAssignTask) return $noPrivAvatar;