From 26942d81feadc59fcc5bc56cc2162d91e7e5c661 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 3 Aug 2021 17:23:42 +0800 Subject: [PATCH 01/10] * Finish task#40809. --- module/doc/model.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 2027313a9c..53efeccef4 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1315,18 +1315,24 @@ class docModel extends model ->orWhere("(objectType = 'bug' and objectID in ($bugIdList))") ->orWhere("(objectType = 'testreport' and objectID in ($testReportIdList))") ->orWhere("(objectType = 'testcase' and objectID in ($caseIdList))") - ->beginIF($type == 'product')->orWhere("(objectType in ('story','requirement') and objectID in ($storyIdList))")->fi() - ->beginIF($type == 'product')->orWhere("(objectType = 'release' and objectID in ($releaseIdList))")->fi() - ->beginIF($type == 'project')->orWhere("(objectType = 'execution' and objectID in ('$executionIdList'))")->fi() - ->beginIF($type == 'project' or $type == 'execution')->orWhere("(objectType = 'task' and objectID in ($taskIdList))")->fi() - ->beginIF($type == 'project' or $type == 'execution')->orWhere("(objectType = 'build' and objectID in ($buildIdList))")->fi() + + ->beginIF($type == 'product') + ->orWhere("(objectType in ('story','requirement') and objectID in ($storyIdList))") + ->orWhere("(objectType = 'release' and objectID in ($releaseIdList))") + ->fi() ->beginIF($type == 'project') + ->orWhere("(objectType = 'execution' and objectID in ('$executionIdList'))") ->orWhere("(objectType = 'issue' and objectID in ($issueIdList))") ->orWhere("(objectType = 'meeting' and objectID in ($meetingIdList))") ->orWhere("(objectType = 'design' and objectID in ($designIdList))") ->fi() + ->beginIF($type == 'project' or $type == 'execution') + ->orWhere("(objectType = 'task' and objectID in ($taskIdList))") + ->orWhere("(objectType = 'build' and objectID in ($buildIdList))") + ->fi() + ->markRight(1) ->beginIF($searchTitle)->andWhere('title')->like("%{$searchTitle}%")->fi() ->orderBy($orderBy) @@ -1335,14 +1341,6 @@ class docModel extends model foreach($files as $fileID => $file) { - if($type == 'product' && $file->objectType == 'bug') $file->project = $bugPairs[$file->objectID]; - if($type == 'product' && $file->objectType == 'release') $file->project = $releasePairs[$file->objectID]; - if($type == 'product' && $file->objectType == 'testreport') $file->project = $testReportPairs[$file->objectID]; - if($type == 'product' && $file->objectType == 'testcase') $file->project = $casePairs[$file->objectID]; - - if($type == 'execution' && $file->objectType == 'task') $file->project = $taskPairs[$file->objectID]; - if($type == 'execution' && $file->objectType == 'build') $file->project = $buildPairs[$file->objectID]; - $pathName = $this->file->getRealPathName($file->pathname); $file->realPath = $this->file->savePath . $pathName; $file->webPath = $this->file->webPath . $pathName; From 18dfc22307bbb6a7f7270b72466833899021f292 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 3 Aug 2021 17:38:32 +0800 Subject: [PATCH 02/10] * Fix bug#14029. --- module/doc/model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/doc/model.php b/module/doc/model.php index 53efeccef4..e8082f2664 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1784,7 +1784,9 @@ class docModel extends model if($doc->type == 'project') $objectID = $doc->project; if($doc->type == 'execution') $objectID = $doc->execution; - $html .= '
  • ' . html::a(inlink('objectLibs', "type={$doc->type}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), " " . $doc->title, '', "data-app='{$this->app->openApp}' title='{$doc->title}'") . '
  • '; + $locateApp = $doc->type == 'execution' ? 'execution' : 'doc'; + + $html .= '
  • ' . html::a(inlink('objectLibs', "type={$doc->type}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), " " . $doc->title, '', "data-app='{$locateApp}' title='{$doc->title}'") . '
  • '; } $collectionCount = $this->dao->select('count(id) as count')->from(TABLE_DOC) From 752d33949a37dca3acaef5c01c43e97156da79ba Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 4 Aug 2021 08:11:46 +0800 Subject: [PATCH 03/10] * Fix an error. --- module/user/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/user/model.php b/module/user/model.php index 093581db2d..9a46f5c0e6 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1061,8 +1061,8 @@ class userModel extends model ->beginIF($status == 'done')->andWhere('status')->in('done,closed')->fi() ->beginIF($status == 'undone')->andWhere('status')->notin('done,closed')->fi() ->beginIF($status == 'openedbyme')->andWhere('openedBy')->eq($account)->fi() - ->beginIF($type == 'execution' and !$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->sprints)->fi() - ->beginIF($type == 'project' and !$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->projects)->fi() + ->beginIF($type == 'execution' and !$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi() + ->beginIF($type == 'project' and !$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi() ->andWhere('t1.account')->eq($account) ->andWhere('t2.deleted')->eq(0) ->orderBy("t2.$orderBy") From 28aec9b43d4d569f237c5493886148968b0f7618 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Aug 2021 08:15:12 +0800 Subject: [PATCH 04/10] * Refresh the page when unfavorite. --- module/doc/js/browse.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 module/doc/js/browse.js diff --git a/module/doc/js/browse.js b/module/doc/js/browse.js new file mode 100644 index 0000000000..0b95e564e5 --- /dev/null +++ b/module/doc/js/browse.js @@ -0,0 +1,4 @@ +$('.ajaxCollect').click(function() +{ + window.location.reload(); +}) From 6f70fd827c6fd37797d2cf6dbb01ce76f18ba894 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Aug 2021 08:30:33 +0800 Subject: [PATCH 05/10] * Fix bug #13974. --- module/doc/control.php | 3 ++- module/doc/model.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index c6def4f134..2b2c02239a 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -293,7 +293,8 @@ class doc extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $docID)); $objectID = zget($lib, $lib->type, ''); - $params = "type={$lib->type}&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id']; + $libType = ($lib->type == 'execution' and $this->app->openApp != 'execution') ? 'project' : $lib->type; + $params = "type={$libType}&objectID=$objectID&libID={$lib->id}&docID=" . $docResult['id']; $link = $this->createLink('doc', 'objectLibs', $params); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); } diff --git a/module/doc/model.php b/module/doc/model.php index e8082f2664..46243f828c 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1070,7 +1070,7 @@ class docModel extends model } else { - $objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->eq($objectID)->andWhere('type')->eq($type)->orderBy('`order`, id')->fetchAll('id'); + $objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->eq($objectID)->orderBy('`order`, id')->fetchAll('id'); } if($type == 'product') @@ -1784,9 +1784,9 @@ class docModel extends model if($doc->type == 'project') $objectID = $doc->project; if($doc->type == 'execution') $objectID = $doc->execution; - $locateApp = $doc->type == 'execution' ? 'execution' : 'doc'; + $docType = ($doc->type == 'execution' and $this->app->openApp != 'execution') ? 'project' : $doc->type; - $html .= '
  • ' . html::a(inlink('objectLibs', "type={$doc->type}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), " " . $doc->title, '', "data-app='{$locateApp}' title='{$doc->title}'") . '
  • '; + $html .= '
  • ' . html::a(inlink('objectLibs', "type={$docType}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), " " . $doc->title, '', "data-app='doc' title='{$doc->title}'") . '
  • '; } $collectionCount = $this->dao->select('count(id) as count')->from(TABLE_DOC) From 3a63925df38a6a6780f157536f97a1c6e3c9f80f Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Aug 2021 08:57:13 +0800 Subject: [PATCH 06/10] * Modify My Favorites Jump Link. --- module/doc/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/doc/model.php b/module/doc/model.php index 46243f828c..4242f6dfa4 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1784,7 +1784,7 @@ class docModel extends model if($doc->type == 'project') $objectID = $doc->project; if($doc->type == 'execution') $objectID = $doc->execution; - $docType = ($doc->type == 'execution' and $this->app->openApp != 'execution') ? 'project' : $doc->type; + $docType = ($doc->type == 'execution') ? 'project' : $doc->type; $html .= '
  • ' . html::a(inlink('objectLibs', "type={$docType}&objectID=$objectID&libID={$doc->lib}&docID={$doc->id}"), " " . $doc->title, '', "data-app='doc' title='{$doc->title}'") . '
  • '; } From beab1217de13356f14db1e5114fcc66b33558480 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 4 Aug 2021 09:02:23 +0800 Subject: [PATCH 07/10] * Modify the comment. --- module/build/model.php | 2 +- module/doc/model.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/module/build/model.php b/module/build/model.php index 87c9559f39..2d6513b355 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -229,7 +229,7 @@ class buildModel extends model * @param int $productID * @param int $branch * @param string $params noempty|notrunk, can be a set of them - * @param int $buildIDList + * @param string $buildIDList * @access public * @return array */ diff --git a/module/doc/model.php b/module/doc/model.php index e8082f2664..f8378fa288 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2301,8 +2301,6 @@ EOT; if(empty($object)) die(js::locate(helper::createLink($type, 'create'))); } - if(!$libID) $libID = key($libs); - $openApp = strpos('doc,product,project,execution', $this->app->openApp) !== false ? $this->app->openApp : 'doc'; if($openApp != 'doc') $this->loadModel($openApp)->setMenu($objectID); From 7a87eb31c220c469c9a27859c1e0e70d05caff36 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Aug 2021 09:15:27 +0800 Subject: [PATCH 08/10] * Fix the error when clicking on my favorite execution document. --- module/doc/model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 4242f6dfa4..2150a57cf8 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1780,9 +1780,8 @@ class docModel extends model foreach($docs as $doc) { $objectID = 0; - if($doc->type == 'product') $objectID = $doc->product; - if($doc->type == 'project') $objectID = $doc->project; - if($doc->type == 'execution') $objectID = $doc->execution; + if($doc->type == 'product') $objectID = $doc->product; + if($doc->type == 'project' or $doc->type == 'execution') $objectID = $doc->project; $docType = ($doc->type == 'execution') ? 'project' : $doc->type; From 428d861e1e1019236fc7c3cac42c796c0bc13f83 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Wed, 4 Aug 2021 09:27:11 +0800 Subject: [PATCH 09/10] * Leave the project field of the product document blank. --- module/upgrade/model.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 456e9eaca4..29bca48b1c 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -697,6 +697,7 @@ class upgradeModel extends model $this->saveLogs('Execute 15_3'); $this->execSQL($this->getUpgradeFile('15.3')); $this->processStoryFileType(); + $this->processProductDoc(); $this->appendExec('15_3'); } @@ -4511,7 +4512,6 @@ class upgradeModel extends model $this->dao->update(TABLE_TESTREPORT)->set('project')->eq($projectID)->where('product')->in($productIdList)->exec(); $this->dao->update(TABLE_TESTSUITE)->set('project')->eq($projectID)->where('product')->in($productIdList)->exec(); $this->dao->update(TABLE_BUILD)->set('project')->eq($projectID)->where('product')->in($productIdList)->exec(); - $this->dao->update(TABLE_DOC)->set('project')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'product' and product " . helper::dbIN($productIdList) . ')')->exec(); /* Project linked objects. */ $this->dao->update(TABLE_TASK)->set('project')->eq($projectID)->where('execution')->in($sprintIdList)->exec(); @@ -5160,7 +5160,7 @@ class upgradeModel extends model * Process story file type to requirement. * * @access public - * @return void + * @return bool */ public function processStoryFileType() { @@ -5173,4 +5173,20 @@ class upgradeModel extends model return true; } + + /** + * Leave the project field of the product document blank. + * + * @access public + * @return bool + */ + public function processProductDoc() + { + $this->dao->update(TABLE_DOC)->set('project')->eq(0) + ->where('product')->ne(0) + ->andWhere('project')->ne(0) + ->exec(); + + return true; + } } From 424b73acf2a957c4bad8b48e0495e42a0c22f795 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 4 Aug 2021 09:29:48 +0800 Subject: [PATCH 10/10] * Fix bug #14033. --- module/doc/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/doc/control.php b/module/doc/control.php index 2b2c02239a..08aa7fac51 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1010,6 +1010,8 @@ class doc extends control { list($libs, $libID, $object, $objectID) = $this->doc->setMenuByType($type, $objectID, $libID); + $libID = empty($libID) ? 0 : $libID; + $moduleTree = $type == 'book' ? $this->doc->getBookStructure($libID) : $this->doc->getTreeMenu($type, $objectID, $libID); $title = ($type == 'book' or $type == 'custom') ? $this->lang->doc->tableContents : $object->name . $this->lang->colon . $this->lang->doc->tableContents;