Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
chenfeiCF
2016-03-31 11:04:59 +08:00
12 changed files with 60 additions and 19 deletions
+6 -2
View File
@@ -1536,9 +1536,10 @@ class bugModel extends model
*/
public function getUserBugTemplates($account)
{
$templates = $this->dao->select('id, title, content')
$templates = $this->dao->select('id,title,content,public')
->from(TABLE_USERTPL)
->where('account')->eq($account)
->orWhere('public')->eq('1')
->orderBy('id')
->fetchAll();
return $templates;
@@ -1557,7 +1558,10 @@ class bugModel extends model
->add('type', 'bug')
->stripTags('content', $this->config->allowedTags)
->get();
$this->dao->insert(TABLE_USERTPL)->data($template)->batchCheck('title, content', 'notempty')->check('title', 'unique', "account='{$this->app->user->account}'")->exec();
$condition = "account='{$this->app->user->account}'";
if($template->public == 1) $condition .= " or `public`='1'";
$this->dao->insert(TABLE_USERTPL)->data($template)->batchCheck('title, content', 'notempty')->check('title', 'unique', $condition)->exec();
}
/**