From dcdea462671f9ecd451adc7f2431972f26383940 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Thu, 19 Aug 2021 10:27:48 +0800 Subject: [PATCH 1/2] * Finish task #41611. --- module/project/js/team.js | 47 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/module/project/js/team.js b/module/project/js/team.js index 2bda1187a9..b52ac0e2c9 100644 --- a/module/project/js/team.js +++ b/module/project/js/team.js @@ -9,33 +9,42 @@ */ function deleteMemeber(projectID, account, userID) { - if(confirm(confirmUnlinkMember)) + bootbox.confirm(confirmUnlinkMember, function(result) { + if(!result) return true; + var removeConfirm = ''; var tipsLink = createLink('project', 'ajaxGetUnlinkTips', 'projectID=' + projectID + '&account=' + account); $.get(tipsLink, function(tips) { - if(!tips) + var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes'); + + if(!tips) unlinkMember(unlinkURL); + if(tips) { - var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=no'); - } - else - { - if(confirm(tips)) + bootbox.confirm(tips, function(result) { - var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=yes'); - } - else - { - var unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=no'); - } + if(result) unlinkURL = createLink('project', 'unlinkMember', 'projectID=' + projectID + '&userID=' + userID + '&confirm=yes&removeExecution=yes'); + unlinkMember(unlinkURL); + }) } - $.get(unlinkURL, function(data) - { - data = JSON.parse(data); - if(data.result == 'success') window.location.reload(); - }); }) - } + }) +} + +/** + * Unlink member from project. + * + * @param unlinkURL $unlinkURL + * @access public + * @return void + */ +function unlinkMember(unlinkURL) +{ + $.get(unlinkURL, function(data) + { + data = JSON.parse(data); + if(data.result == 'success') window.location.reload(); + }); } From 21386f9559ce7ce5354b8b7f62e45cd6ce539bd9 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 19 Aug 2021 10:31:52 +0800 Subject: [PATCH 2/2] * Finish task #41545. --- module/doc/model.php | 47 ++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index 28dd6ae17c..b9ce656054 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -255,21 +255,8 @@ class docModel extends model ->fetchAll('id'); } - $projects = $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1') - ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.project') - ->where('t2.id')->in(array_keys($docs)) - ->andWhere('t2.execution')->eq(0) - ->fetchPairs(); - - $executions = $this->dao->select('t1.id, t1.name')->from(TABLE_EXECUTION)->alias('t1') - ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.execution') - ->where('t2.id')->in(array_keys($docs)) - ->fetchPairs(); - - $products = $this->dao->select('t1.id, t1.name')->from(TABLE_PRODUCT)->alias('t1') - ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.product') - ->where('t2.id')->in(array_keys($docs)) - ->fetchPairs(); + /* Get projects, executions and products by docIdList. */ + list($projects, $executions, $products) = $this->getObjectsByDoc(array_keys($docs)); $docContents = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->in(array_keys($docs))->orderBy('version,doc')->fetchAll('doc'); @@ -322,6 +309,36 @@ class docModel extends model return $docs; } + /** + * Get projects, executions and products by docIdList. + * + * @param array $docIdList + * @access public + * @return array + */ + public function getObjectsByDoc($docIdList = array()) + { + if(empty($docIdList)) return array(); + + $projects = $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.project') + ->where('t2.id')->in($docIdList) + ->andWhere('t2.execution')->eq(0) + ->fetchPairs(); + + $executions = $this->dao->select('t1.id, t1.name')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.execution') + ->where('t2.id')->in($docIdList) + ->fetchPairs(); + + $products = $this->dao->select('t1.id, t1.name')->from(TABLE_PRODUCT)->alias('t1') + ->leftJoin(TABLE_DOC)->alias('t2')->on('t1.id=t2.product') + ->where('t2.id')->in($docIdList) + ->fetchPairs(); + + return array($projects, $executions, $products); + } + /** * Get docs. *