From 1b024cd41ba8e3e293b3d44725ac792cedad60a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Tue, 18 Apr 2023 07:09:21 +0000 Subject: [PATCH 1/3] * Fix bug for attend. --- db/update18.3.sql | 5 +++++ db/zentao.sql | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/db/update18.3.sql b/db/update18.3.sql index f6efd25a12..b982b579f3 100644 --- a/db/update18.3.sql +++ b/db/update18.3.sql @@ -341,6 +341,11 @@ CHANGE `editedBy` `editedBy` varchar(30) NOT NULL DEFAULT '', CHANGE `editedDate` `editedDate` datetime NULL; ALTER TABLE `zt_attend` +CHANGE `signIn` `signIn` time NULL, +CHANGE `signOut` `signOut` time NULL, +CHANGE `manualIn` `manualIn` time NULL, +CHANGE `manualOut` `manualOut` time NULL, +CHANGE `desc` `desc` text NULL, CHANGE `reviewedBy` `reviewedBy` char(30) NULL DEFAULT '', CHANGE `reviewedDate` `reviewedDate` datetime NULL; diff --git a/db/zentao.sql b/db/zentao.sql index b976da3927..8b6fe74c0d 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -2711,16 +2711,16 @@ CREATE TABLE IF NOT EXISTS `zt_attend` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `account` char(30) NOT NULL, `date` date NOT NULL, - `signIn` time NOT NULL, - `signOut` time NOT NULL, + `signIn` time NULL, + `signOut` time NULL, `status` varchar(30) NOT NULL DEFAULT '', `ip` varchar(15) NOT NULL, `device` varchar(30) NOT NULL, `client` varchar(20) NOT NULL, - `manualIn` time NOT NULL, - `manualOut` time NOT NULL, + `manualIn` time NULL, + `manualOut` time NULL, `reason` varchar(30) NOT NULL DEFAULT '', - `desc` text NOT NULL, + `desc` text NULL, `reviewStatus` varchar(30) NULL, `reviewedBy` char(30) NOT NULL DEFAULT '', `reviewedDate` datetime NULL, From 39138ca85bc96bcfd55fb9e19f34c8cbcc145d9d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 18 Apr 2023 15:23:26 +0800 Subject: [PATCH 2/3] * fix bug. --- module/doc/control.php | 25 +++---------------------- module/doc/model.php | 31 +++++++++++++++++++------------ 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index e7d181ae5f..077964abb0 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -540,10 +540,10 @@ class doc extends control if(!empty($changes)) { $newType = $_POST['status']; - if($doc->status == 'draft' and $newType == 'draft') $action = 'savedDraft'; if($doc->status == 'draft' and $newType == 'normal') $action = 'releasedDoc'; - if($doc->status == 'normal' and $newType == 'normal') $action = 'Edited'; + if($doc->status == $newType) $action = 'Edited'; } + $fileAction = ''; if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n"; $actionID = $this->action->create('doc', $docID, $action, $fileAction . $this->post->comment); @@ -1221,26 +1221,7 @@ class doc extends control } } - $doc = $docID ? $doc : ''; - - /* Crumbs links array. */ - $moduleName = 'doc'; - $methodName = in_array($type, array('product', 'project')) ? $objectType . 'Space' : 'teamSpace'; - $linkParams = "objectID={$objectID}&libID={$lib->id}"; - if($this->app->tab == 'execution') - { - $moduleName = 'execution'; - $methodName = 'doc'; - $linkParams = "executionID=$objectID"; - } - elseif($type == 'mine') - { - $linkParams = "type=mine&libID={$lib->id}"; - $methodName = 'mySpace'; - } - - $spaceType = $objectType . 'Space'; - $this->view->title = isset($this->lang->doc->{$spaceType}) ? $this->lang->doc->{$spaceType} : $this->lang->doc->common; + $this->view->title = $this->lang->doc->common . $this->lang->colon . $doc->title; $this->view->docID = $docID; $this->view->doc = $doc; $this->view->version = $version; diff --git a/module/doc/model.php b/module/doc/model.php index 12d00e8d6c..f18eeadd11 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -730,7 +730,7 @@ class docModel extends model { $modules = $module && $mode == 'children' ? $this->loadModel('tree')->getAllChildID($module) : $module; $stmt = $this->dao->select('*')->from(TABLE_DOC) - ->where('1=1') + ->where('vision')->eq($this->config->vision) ->beginIF(!empty($modules))->andWhere('module')->in($modules)->fi() ->beginIF($mode == 'normal')->andWhere('deleted')->eq(0)->fi() ->beginIF($this->config->doc->notArticleType)->andWhere('type')->notIN($this->config->doc->notArticleType)->fi() @@ -2156,19 +2156,26 @@ class docModel extends model */ public function getStatisticInfo() { - $allLibs = array_keys($this->getLibs('all')); - $docIdList = $this->getPrivDocs($allLibs); - $myDocList = $this->dao->select('id')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->fetchPairs('id'); - $today = date('Y-m-d'); - $statistic = $this->dao->select("count(id) as totalDocs, count(IF(editedDate like '{$today}%', 1, null)) as todayEditedDocs, - count(IF(editedBy = '{$this->app->user->account}', 1, null)) as myEditedDocs, count(IF(addedBy = '{$this->app->user->account}', 1, null)) as myDocs")->from(TABLE_DOC) - ->where('deleted')->eq(0) - ->andWhere('vision')->eq($this->config->vision) - ->andWhere('id')->in($docIdList) - ->fetch(); + $statistic = new stdclass(); + $statistic->totalDocs = $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('deleted')->eq('0')->fetch('count'); + $statistic->todayEditedDocs = $this->dao->select('count(DISTINCT objectID) as count')->from(TABLE_ACTION) + ->where('objectType')->eq('doc') + ->andWhere('action')->eq('edited') + ->andWhere('actor')->eq($this->app->user->account) + ->andWhere('LEFT(date, 10)')->eq($today) + ->fetch('count'); + $statistic->myEditedDocs = $this->dao->select('count(DISTINCT objectID) as count')->from(TABLE_ACTION) + ->where('objectType')->eq('doc') + ->andWhere('action')->eq('edited') + ->andWhere('actor')->eq($this->app->user->account) + ->fetch('count'); - $statistic->myDoc = $this->dao->select("count(IF(`action` = 'view', 1, null)) as docViews, count(IF(`action` = 'collect', 1, null)) as docCollects")->from(TABLE_DOCACTION)->where('doc')->in($myDocList)->fetch(); + $my = $this->dao->select("count(*) as myDocs, SUM(views) as docViews, SUM(collects) as docCollects")->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch(); + $statistic->myDocs = $my->myDocs; + $statistic->myDoc = new stdclass(); + $statistic->myDoc->docViews = $my->docViews; + $statistic->myDoc->docCollects = $my->docCollects; return $statistic; } From 186d901af77cb7cf379ccefaa7d0f63fb2856e7d Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 18 Apr 2023 15:41:38 +0800 Subject: [PATCH 3/3] * getXmindImport,showXmindImport,saveXmindImport use importXmind permission. --- config/zentaopms.php | 3 +++ module/group/lang/resource.php | 8 +------- module/testcase/control.php | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 2140908abe..484caa737e 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -229,6 +229,9 @@ $config->openMethods[] = 'task.editteam'; $config->openMethods[] = 'feedback.mergeproductmodule'; $config->openMethods[] = 'zanode.nodelist'; $config->openMethods[] = 'action.restoreStages'; +$config->openMethods[] = 'testcase.getXmindImport'; +$config->openMethods[] = 'testcase.showXMindImport'; +$config->openMethods[] = 'testcase.saveXmindImport'; $config->openModules = array(); $config->openModules[] = 'install'; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 0c71e80add..d173ec7322 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1098,10 +1098,7 @@ $lang->resource->testcase->batchChangeScene = 'batchChangeScene'; $lang->resource->testcase->updateOrder = 'updateOrder'; $lang->resource->testcase->importXmind = 'importXmind'; -$lang->resource->testcase->saveXmindImport = 'saveXmindImport'; $lang->resource->testcase->exportXmind = 'exportXmind'; -$lang->resource->testcase->getXmindImport = 'getXmindImport'; -$lang->resource->testcase->showXMindImport = 'showXMindImport'; $lang->testcase->methodOrder[0] = 'index'; $lang->testcase->methodOrder[5] = 'browse'; @@ -1142,10 +1139,7 @@ $lang->testcase->methodOrder[170] = 'changeScene'; $lang->testcase->methodOrder[175] = 'batchChangeScene'; $lang->testcase->methodOrder[180] = 'updateOrder'; $lang->testcase->methodOrder[185] = 'importXmind'; -$lang->testcase->methodOrder[190] = 'getXmindImport'; -$lang->testcase->methodOrder[195] = 'showXMindImport'; -$lang->testcase->methodOrder[200] = 'exportXmind'; -$lang->testcase->methodOrder[205] = 'saveXmindImport'; +$lang->testcase->methodOrder[190] = 'exportXmind'; /* Test task. */ $lang->resource->testtask = new stdclass(); diff --git a/module/testcase/control.php b/module/testcase/control.php index 98abfc8003..d5a387a6e4 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -3208,6 +3208,7 @@ class testcase extends control */ public function getXmindImport() { + if(!commonModel::hasPriv("testcase", "importXmind")) $this->loadModel('common')->deny('testcase', 'importXmind'); $folder = $this->session->xmindImport; $type = $this->session->xmindImportType; @@ -3407,6 +3408,7 @@ class testcase extends control */ public function saveXmindImport() { + if(!commonModel::hasPriv("testcase", "importXmind")) $this->loadModel('common')->deny('testcase', 'importXmind'); if(!empty($_POST)) { $result = $this->testcase->saveXmindImport(); @@ -3426,6 +3428,7 @@ class testcase extends control */ public function showXMindImport($productID,$branch) { + if(!commonModel::hasPriv("testcase", "importXmind")) $this->loadModel('common')->deny('testcase', 'importXmind'); $product = $this->product->getById($productID); $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); $config = $this->testcase->getXmindConfig();