diff --git a/module/action/model.php b/module/action/model.php index 68ce238321..42436391f4 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1900,18 +1900,19 @@ class actionModel extends model /* Build product/project/execution search condition. */ if(isset($grantedProducts)) { + if(is_string($grantedProducts)) $grantedProducts = explode(',', $grantedProducts); $productCondition = ''; - foreach(explode(',', $grantedProducts) as $product) $productCondition = empty($productCondition) ? "(execution = '0' and project = '0' and (product LIKE '%,{$product},%'" : "{$productCondition} OR product LIKE '%,{$product},%'"; + foreach($grantedProducts as $product) $productCondition = empty($productCondition) ? " OR (execution = '0' and project = '0' and (product LIKE '%,{$product},%'" : "{$productCondition} OR product LIKE '%,{$product},%'"; if(!empty($productCondition)) $productCondition .= '))'; } else { - $productCondition = "(execution = '0' and project = '0' and product like '%,{$productID},%')"; + $productCondition = " OR (execution = '0' and project = '0' and product like '%,{$productID},%')"; } $projectCondition = isset($grantedProjects) ? "(execution = '0' and project != '0' and project " . helper::dbIN($grantedProjects) . ')' : "(execution = '0' and project = '{$projectID}')"; $executionCondition = isset($grantedExecutions) ? "(execution != '0' and execution " . helper::dbIN($grantedExecutions) . ')' : "(execution != '0' and execution = '{$executionID}')"; - $condition = "((product =',0,' or product = '0' or product=',,') AND project = '0' AND execution = '0') OR {$productCondition} OR {$projectCondition} OR {$executionCondition}"; + $condition = "((product =',0,' or product = '0' or product=',,') AND project = '0' AND execution = '0') {$productCondition} OR {$projectCondition} OR {$executionCondition}"; return $condition; } diff --git a/module/action/tao.php b/module/action/tao.php index 799c0935e8..3f9ca906d2 100644 --- a/module/action/tao.php +++ b/module/action/tao.php @@ -951,13 +951,13 @@ class actionTao extends actionModel if($action->objectType == 'user') { $user = $this->dao->select('deleted')->from(TABLE_USER)->where('id')->eq($action->objectID)->fetch(); - if($user->deleted == '1') return false; + if($user && $user->deleted == '1') return false; } if($action->objectType == 'todo') { $todo = $this->dao->select('*')->from(TABLE_TODO)->where('id')->eq($action->objectID)->fetch(); - if($todo->private == 1 && $todo->account != $this->app->user->account) return false; + if($todo && $todo->private == 1 && $todo->account != $this->app->user->account) return false; } if($action->objectType == 'mr' && (empty($action->objectName) || $action->action == 'deleted')) return false; diff --git a/module/action/test/model/getdynamic.php b/module/action/test/model/getdynamic.php index 8766d647db..fbc9e846a5 100755 --- a/module/action/test/model/getdynamic.php +++ b/module/action/test/model/getdynamic.php @@ -4,6 +4,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; include dirname(__FILE__, 2) . '/action.class.php'; zdTable('action')->gen(30); +zdTable('actionrecent')->gen(30); zdTable('doclib')->config('doclib')->gen(15); zdTable('doc')->config('doc')->gen(5); zdTable('product')->gen(5); diff --git a/test/data/actionrecent.yaml b/test/data/actionrecent.yaml new file mode 100644 index 0000000000..e24923b2e4 --- /dev/null +++ b/test/data/actionrecent.yaml @@ -0,0 +1,78 @@ +title: table zt_action +desc: "系统日志" +author: automated export +version: "1.0" +fields: + - field: objectType + note: "对象类型" + range: product,story,productplan,release,project,task,build,bug,testcase,case,testtask,user,doc,doclib,todo,branch,module,testsuite,caselib,testreport,entry,webhook,review + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: objectID + note: "对象ID" + range: "1-100000" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: product + note: "产品" + range: "1-100000" + prefix: "," + postfix: "," + loop: 0 + format: "" + - field: project + note: "项目" + range: "1-100000" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: actor + note: "操作者" + fields: + - field: actor1 + range: admin,dev,test + - field: actor2 + range: "[],17-18" + prefix: "" + postfix: "" + loop: 0 + format: "" + - field: action + note: "动作" + range: common,extra,opened,created,changed,edited,assigned,closed,deleted,deletedfile,editfile,erased,undeleted,hidden,commented,activated,blocked,moved,confirmed,caseconfirmed,bugconfirmed,frombug,started,restarted,delayed,suspended,recordestimate,editestimate,deleteestimate,canceled,svncommited,gitcommited,finished,paused,verified,diff1,diff2,diff3,linked2bug + postfix: "" + loop: 0 + format: "" + - field: date + note: "日期" + range: "(-1M)-(w):1D" + type: timestamp + prefix: "" + postfix: "" + loop: 0 + format: "YYYY-MM-DD hh:mm:ss" + - field: comment + note: "备注" + range: 1-100000 + prefix: "这是一个系统日志测试备注" + postfix: "" + loop: 0 + format: "" + - field: extra + note: "附加参数" + range: 1{4},11,1{3}, 2 ,1{18},33,1{22},101,1{22},131,1{22},161,1{3} + prefix: "" + postfix: "" + loop: 0 + - field: read + note: "" + range: "0,1" + prefix: "" + postfix: "" + loop: 0 + format: ""