diff --git a/db/update17.0.beta1.sql b/db/update17.0.beta1.sql new file mode 100644 index 0000000000..6b2a1656df --- /dev/null +++ b/db/update17.0.beta1.sql @@ -0,0 +1,2 @@ +insert into zt_config(vision, owner, module, `key`, value) select 'rnd', 'system', 'story', 'forceReviewUsers', `value` from zt_config where vision='rnd' and owner='system' and module='story' and `key`='forceReview'; +insert into zt_config(vision, owner, module, `key`, value) select 'lite', 'system', 'story', 'forceReviewUsers', `value` from zt_config where vision='lite' and owner='system' and module='story' and `key`='forceReview'; diff --git a/module/custom/view/set.html.php b/module/custom/view/set.html.php index 8986c78582..b6a328bfed 100644 --- a/module/custom/view/set.html.php +++ b/module/custom/view/set.html.php @@ -42,7 +42,7 @@ EOT; .reviewBox > td {width: 500px !important;} .checkbox-primary {margin-bottom: 0px; width: 82px !important;} .storyReviewTip {padding-left: 95px;} -getClientLang() != 'zh-cn' and $app->getClientLang() !== 'zh-tw'):?> +getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw'):?> .reviewBox > th {width: 160px !important;} .storyReviewTip {padding-left: 160px;} @@ -107,7 +107,7 @@ EOT; - getClientLang() != 'zh-cn' and $app->getClientLang() !== 'zh-tw') ? ' ': '';?> + getClientLang() != 'zh-cn' and $app->getClientLang() != 'zh-tw') ? ' ': '';?>
custom->notice->forceReview, $lang->$module->common) . $lang->custom->notice->storyReviewTip;?> diff --git a/module/story/model.php b/module/story/model.php index 48269267d6..297354a178 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4323,7 +4323,7 @@ class storyModel extends model if(isset($this->config->story->forceReviewAll) and $this->config->story->forceReviewAll) return true; $forceUsers = ''; - if(!empty($this->config->story->forceReviewUsers)) $forceUsers .= $this->config->story->forceReviewUsers; + if(!empty($this->config->story->forceReviewUsers)) $forceUsers = $this->config->story->forceReviewUsers; if(!empty($this->config->story->forceReviewRoles) or !empty($this->config->story->forceReviewDepts)) { diff --git a/module/user/model.php b/module/user/model.php index 071c104a15..a7c94028ef 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -2774,25 +2774,40 @@ class userModel extends model */ public function getCanCreateStoryUsers() { - $users = $this->getPairs('noclosed|nodeleted'); - $groups = $this->dao->select('*')->from(TABLE_USERGROUP) + $users = $this->getPairs('noclosed|nodeleted'); + $groupList = $this->dao->select('*')->from(TABLE_USERGROUP) ->where('account')->in(array_keys($users)) ->fetchGroup('account', 'group'); + $hasPrivGroups = $this->dao->select('*')->from(TABLE_GROUPPRIV) + ->where('module')->eq('story') + ->andWhere('(method')->eq('create') + ->orWhere('method')->eq('batchCreate') + ->markRight(1) + ->fetchAll('group'); + foreach($users as $account => $user) { - if(empty($user) or strpos($this->app->company->admins, ",{$account},") !== false or !isset($groups[$account])) continue; + if(empty($user) or strpos($this->app->company->admins, ",{$account},") !== false) continue; - $group = $groups[$account]; - $priv = $this->dao->select('*')->from(TABLE_GROUPPRIV) - ->where('`group`')->in(array_keys($group)) - ->andWhere('module')->eq('story') - ->andWhere('(method')->eq('create') - ->orWhere('method')->eq('batchCreate') - ->markRight(1) - ->fetch(); + if(!isset($groupList[$account])) + { + unset($users[$account]); + continue; + } - if(empty($priv)) unset($users[$account]); + $groups = $groupList[$account]; + $hasPriv = false; + foreach($groups as $groupID => $group) + { + if(isset($hasPrivGroups[$groupID])) + { + $hasPriv = true; + break; + } + } + + if(!$hasPriv) unset($users[$account]); } return $users;