From 809ce930370f2a86f0e387c15ad9e405ca0f7b3a Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Sat, 7 May 2022 17:27:37 +0800 Subject: [PATCH 001/125] * Code for mail test. --- test/class/mail.class.php | 435 +++++++++++++++++++ test/model/mail/addqueue.php | 25 ++ test/model/mail/autodetect.php | 23 + test/model/mail/getconfigbydetectingsmtp.php | 25 ++ test/model/mail/getconfigbymxrr.php | 20 + test/model/mail/getconfigfromprovider.php | 20 + test/model/mail/getqueue.php | 24 + test/model/mail/getqueuebyid.php | 21 + test/model/mail/getsubject.php | 27 ++ test/model/mail/iserror.php | 17 + test/model/mail/mailexist.php | 17 + test/model/mail/mergemails.php | 18 + test/model/mail/send.php | 41 ++ test/model/mail/sendmail.php | 17 + test/model/mail/setbody.php | 17 + test/model/mail/setcc.php | 20 + test/model/mail/seterrorlang.php | 17 + test/model/mail/setgmail.php | 17 + test/model/mail/setmta.php | 18 + test/model/mail/setsendmail.php | 17 + test/model/mail/setsmtp.php | 17 + test/model/mail/setsubject.php | 17 + test/model/mail/setto.php | 17 + 23 files changed, 887 insertions(+) create mode 100644 test/class/mail.class.php create mode 100644 test/model/mail/addqueue.php create mode 100644 test/model/mail/autodetect.php create mode 100644 test/model/mail/getconfigbydetectingsmtp.php create mode 100644 test/model/mail/getconfigbymxrr.php create mode 100644 test/model/mail/getconfigfromprovider.php create mode 100644 test/model/mail/getqueue.php create mode 100644 test/model/mail/getqueuebyid.php create mode 100644 test/model/mail/getsubject.php create mode 100644 test/model/mail/iserror.php create mode 100644 test/model/mail/mailexist.php create mode 100644 test/model/mail/mergemails.php create mode 100644 test/model/mail/send.php create mode 100644 test/model/mail/sendmail.php create mode 100644 test/model/mail/setbody.php create mode 100644 test/model/mail/setcc.php create mode 100644 test/model/mail/seterrorlang.php create mode 100644 test/model/mail/setgmail.php create mode 100644 test/model/mail/setmta.php create mode 100644 test/model/mail/setsendmail.php create mode 100644 test/model/mail/setsmtp.php create mode 100644 test/model/mail/setsubject.php create mode 100644 test/model/mail/setto.php diff --git a/test/class/mail.class.php b/test/class/mail.class.php new file mode 100644 index 0000000000..bdbc9d71c0 --- /dev/null +++ b/test/class/mail.class.php @@ -0,0 +1,435 @@ +dao = $dao; + $this->tester = $tester; + $this->objectModel = $tester->loadModel('mail'); + } + + /** + * AutoDetect. + * + * @param int $email + * @access public + * @return void + */ + public function autoDetectTest($email) + { + $objects = $this->objectModel->autoDetect($email); + + if(dao::isError()) return dao::getError(); + if(!$objects->host) return '没有检测到相关信息'; + + return $objects; + } + + /** + * Get config from provider. + * + * @param int $domain + * @param int $username + * @access public + * @return void + */ + public function getConfigFromProviderTest($domain, $username) + { + $objects = $this->objectModel->getConfigFromProvider($domain, $username); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get config by MXRR. + * + * @param int $domain + * @param int $username + * @access public + * @return void + */ + public function getConfigByMXRRTest($domain, $username) + { + $objects = $this->objectModel->getConfigByMXRR($domain, $username); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get config by detecting SMTP. + * + * @param int $domain + * @param int $username + * @param int $port + * @access public + * @return void + */ + public function getConfigByDetectingSMTPTest($domain, $username, $port) + { + $objects = $this->objectModel->getConfigByDetectingSMTP($domain, $username, $port); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set MTA. + * + * @access public + * @return void + */ + public function setMTATest() + { + $objects = $this->objectModel->setMTA(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set SMTP. + * + * @access public + * @return void + */ + public function setSMTPTest() + { + $objects = $this->objectModel->setSMTP(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set PhpMail. + * + * @access public + * @return void + */ + public function setPhpMailTest() + { + $objects = $this->objectModel->setPhpMail(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set sendmail. + * + * @access public + * @return void + */ + public function setSendMailTest() + { + $objects = $this->objectModel->setSendMail(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set GMail. + * + * @access public + * @return void + */ + public function setGMailTest() + { + $this->objectModel->setGMail(); + + return $this->setMTATest(); + } + + /** + * Send. + * + * @param int $toList + * @param int $subject + * @param string $body + * @param string $ccList + * @param int $includeMe + * @param array $emails + * @access public + * @return void + */ + public function sendTest($toList, $subject, $body = '', $ccList = '', $includeMe = false, $emails = array()) + { + $objects = $this->objectModel->send($toList, $subject, $body, $ccList, $includeMe, $emails); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set TO. + * + * @param int $toList + * @param int $emails + * @access public + * @return void + */ + public function setTOTest($toList, $emails) + { + $objects = $this->objectModel->setTO($toList, $emails); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Set CC. + * + * @param int $ccList + * @param int $emails + * @access public + * @return void + */ + public function setCCTest($ccList, $emails) + { + $this->objectModel->setCC($ccList, $emails); + + return $this->setMTATest(); + } + + /** + * Set subject. + * + * @param int $subject + * @access public + * @return void + */ + public function setSubjectTest($subject) + { + $this->objectModel->setSubject($subject); + + return $this->setMTATest(); + } + + /** + * Set body. + * + * @param int $body + * @access public + * @return void + */ + public function setBodyTest($body) + { + $this->objectModel->setBody($body); + + return $this->setMTATest(); + } + + /** + * Set errorlang. + * + * @access public + * @return void + */ + public function setErrorLangTest() + { + $objects = $this->objectModel->setErrorLang(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * clear. + * + * @access public + * @return void + */ + public function clearTest() + { + $objects = $this->objectModel->clear(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Mail exist. + * + * @access public + * @return void + */ + public function mailExistTest() + { + $object = $this->objectModel->mailExist(); + + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Is error. + * + * @access public + * @return void + */ + public function isErrorTest() + { + $object = $this->objectModel->isError(); + + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Get error. + * + * @access public + * @return void + */ + public function getErrorTest() + { + $objects = $this->objectModel->getError(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Add queue. + * + * @param int $toList + * @param int $subject + * @param string $body + * @param string $ccList + * @param int $includeMe + * @access public + * @return void + */ + public function addQueueTest($toList, $subject, $body = '', $ccList = '', $includeMe = false) + { + $this->objectModel->addQueue($toList, $subject, $body, $ccList, $includeMe); + + if($toList and $subject) + { + $id = $this->dao->lastInsertID(); + $object = $this->dao->select('*')->from(TABLE_NOTIFY)->where('id')->eq($id)->fetch(); + } + + if(!$object) return '没有数据提交'; + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Get queue. + * + * @param string $status + * @param string $orderBy + * @param int $pager + * @access public + * @return void + */ + public function getQueueTest($status = '', $orderBy = 'id_desc', $pager = null) + { + $objects = $this->objectModel->getQueue($status = '', $orderBy = 'id_desc', $pager = null); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Get queue by id. + * + * @param int $queueID + * @access public + * @return void + */ + public function getQueueByIdTest($queueID) + { + $object = $this->objectModel->getQueueById($queueID); + + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Merge mails. + * + * @param int $user + * @access public + * @return void + */ + public function mergeMailsTest($user) + { + $mails = $this->dao->select('*')->from(TABLE_NOTIFY) + ->where('objectType')->eq('mail') + ->andWhere('toList')->eq($user) + ->fetchAll(); + + $object = $this->objectModel->mergeMails($mails); + + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Sendmail. + * + * @param int $objectID + * @param int $actionID + * @access public + * @return void + */ + public function sendmailTest($objectID, $actionID) + { + $object = $this->objectModel->sendmail($objectID, $actionID); + + if(dao::isError()) return dao::getError(); + + return $object; + } + + /** + * Get subject. + * + * @param int $objectType + * @param int $object + * @param int $title + * @param int $actionType + * @access public + * @return void + */ + public function getSubjectTest($objectType, $object, $title, $actionType) + { + $object = $this->tester->loadModel($objectType)->getByID($object); + $object = $this->objectModel->getSubject($objectType, $object, $title, $actionType); + + if(dao::isError()) return dao::getError(); + + return $object; + } +} diff --git a/test/model/mail/addqueue.php b/test/model/mail/addqueue.php new file mode 100644 index 0000000000..f374cf31cd --- /dev/null +++ b/test/model/mail/addqueue.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +addQueue(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +$result1 = $mail->addQueueTest('',''); +$result2 = $mail->addQueueTest('user3', '测试提交队列', '测试发信内容'); +$result3 = $mail->addQueueTest('user3,admin', '测试提交队列', '测试发信内容'); +$result4 = $mail->addQueueTest('user3,admin', '测试提交队列', '测试发信内容', '', true); + +r($result1) && p() && e('没有数据提交'); //提交数据为空时 +r($result2) && p('subject') && e('测试提交队列'); //获取添加的邮件主题 +r($result3) && p('toList') && e('user3'); //获取收件人列表不包含自己 +r($result4) && p('toList') && e('user3,admin'); //获取收件人列表包含自己 diff --git a/test/model/mail/autodetect.php b/test/model/mail/autodetect.php new file mode 100644 index 0000000000..df019977f5 --- /dev/null +++ b/test/model/mail/autodetect.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +autoDetect(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +$data = array('test@qq.com', 'test@163.com', 'test@sohu.com', 'test@vip.sohu.com', 'testm'); + +r($mail->autoDetectTest($data[0])) && p('host') && e('smtp.qq.com'); //检测qq邮箱信息 +r($mail->autoDetectTest($data[1])) && p('host') && e('smtp.163.com'); //检测163邮箱信息 +r($mail->autoDetectTest($data[2])) && p('host') && e('smtp.sohu.com'); //检测搜狐邮箱信息 +r($mail->autoDetectTest($data[3])) && p('host') && e('smtp.vip.sohu.com'); //检测搜狐vip邮箱信息 +r($mail->autoDetectTest($data[4])) && p() && e('没有检测到相关信息'); //检测不存在的邮箱服务商信息 diff --git a/test/model/mail/getconfigbydetectingsmtp.php b/test/model/mail/getconfigbydetectingsmtp.php new file mode 100644 index 0000000000..9240d80afa --- /dev/null +++ b/test/model/mail/getconfigbydetectingsmtp.php @@ -0,0 +1,25 @@ +#!/usr/bin/env php +getConfigByDetectingSMTP(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +$result1 = $mail->getConfigByDetectingSMTPTest('qq.com','122@qq.com',465); +$result2 = $mail->getConfigByDetectingSMTPTest('qq.com','122@qq.com',465); +$result3 = $mail->getConfigByDetectingSMTPTest('qq.com','122@qq.com',22); +$result4 = $mail->getConfigByDetectingSMTPTest('testqq.com','122@qq.com',22); + +r($result1) && p('host') && e('smtp.qq.com'); //根据域名获取smtp +r($result2) && p('secure') && e('ssl'); //根据域名获取secure +r($result3) && p('secure') && e('0'); //当端口号不为465时获取secure +r($result4) && p() && e('0'); //当域名不存在时 diff --git a/test/model/mail/getconfigbymxrr.php b/test/model/mail/getconfigbymxrr.php new file mode 100644 index 0000000000..5ad7411fd1 --- /dev/null +++ b/test/model/mail/getconfigbymxrr.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getConfigByMXRR(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); +$result1 = $mail->getConfigByMXRRTest('qq.com','test'); +$result2 = $mail->getConfigByMXRRTest('sohu.com','test'); + +r($result1) && p('host') && e('smtp.qq.com'); //获取qq相关信息 +r($result2) && p('host') && e('smtp.sohu.com'); //获取sohu相关信息 diff --git a/test/model/mail/getconfigfromprovider.php b/test/model/mail/getconfigfromprovider.php new file mode 100644 index 0000000000..ddd4c0153a --- /dev/null +++ b/test/model/mail/getconfigfromprovider.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +getConfigFromProvider(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); +$result1 = $mail->getConfigFromProviderTest('qq.com','123'); +$result2 = $mail->getConfigFromProviderTest('sohu.com','123'); + +r($result1) && p('host') && e('smtp.qq.com'); //获取qq相关信息 +r($result2) && p('host') && e('smtp.sohu.com'); //获取sohu相关信息 diff --git a/test/model/mail/getqueue.php b/test/model/mail/getqueue.php new file mode 100644 index 0000000000..cf8138f251 --- /dev/null +++ b/test/model/mail/getqueue.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getQueue(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); +$result1 = count($mail->getQueueTest()); +$result2 = count($mail->getQueueTest('fail')); +$result3 = count($mail->getQueueTest('wait')); +$result4 = $mail->getQueueTest('wait'); + +r($result1) && p() && e('7'); //按照收件人分组获取邮件列表个数 +r($result2) && p() && e('7'); //按照收件人分组获取发送失败的邮件数量 +r($result3) && p() && e('7'); //按照收件人分组获取待发送的邮件数量 +r($result4) && p('0:data') && e('测试发信内容'); //按照收件人分组获取第一条待发送的邮件内容 diff --git a/test/model/mail/getqueuebyid.php b/test/model/mail/getqueuebyid.php new file mode 100644 index 0000000000..cf6ef9ac90 --- /dev/null +++ b/test/model/mail/getqueuebyid.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getQueueById(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +$queueID = array(1,10,0); + +r($mail->getQueueByIdTest($queueID[0])) && p('subject') && e('主题1'); //获取id为1的邮件主题 +r($mail->getQueueByIdTest($queueID[1])) && p('toList') && e('top10'); //获取id为10的收件人 +r($mail->getQueueByIdTest($queueID[2])) && p() && e('0'); //获取id不存在的邮件信息 diff --git a/test/model/mail/getsubject.php b/test/model/mail/getsubject.php new file mode 100644 index 0000000000..b6279cdba7 --- /dev/null +++ b/test/model/mail/getsubject.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getSubject(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +$result1 = $mail->getSubjectTest('testtask', 1, '123', 'closed'); +$result2 = $mail->getSubjectTest('doc', 1, 'test', 'created'); +$result3 = $mail->getSubjectTest('story', 1, 'test', 'created'); +$result4 = $mail->getSubjectTest('task', 1, 'test', 'created'); +$result5 = $mail->getSubjectTest('bug', 1, 'test', 'created'); + +r($result1) && p() && e('admin关闭了测试单 #1:测试单1'); //获取关闭测试单时邮件主题 +r($result2) && p() && e('admin创建了文档 #1:文档标题901'); //获取创建文档时的邮件主题 +r($result3) && p() && e('STORY #1 test - 正常产品1'); //获取操作需求时的邮件主题 +r($result4) && p() && e('TASK #1 test - 迭代1'); //获取操作任务时的邮件主题 +r($result5) && p() && e('BUG #1 test - 正常产品1'); //获取操作BUG时的邮件主题 diff --git a/test/model/mail/iserror.php b/test/model/mail/iserror.php new file mode 100644 index 0000000000..0df44980fd --- /dev/null +++ b/test/model/mail/iserror.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +isError(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->isErrorTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/mailexist.php b/test/model/mail/mailexist.php new file mode 100644 index 0000000000..be683a444a --- /dev/null +++ b/test/model/mail/mailexist.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +mailExist(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->mailExistTest()) && p('email') && e('1000010000@qq.com'); //检查系统是否至少存在邮件 diff --git a/test/model/mail/mergemails.php b/test/model/mail/mergemails.php new file mode 100644 index 0000000000..d48ae69688 --- /dev/null +++ b/test/model/mail/mergemails.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +mergeMails(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->mergeMailsTest('admin')) && p('id') && e('6,1'); //获取邮件合并后的id +r($mail->mergeMailsTest('admin')) && p('subject') && e('主题6|主题1'); //获取邮件合并后的主题 diff --git a/test/model/mail/send.php b/test/model/mail/send.php new file mode 100644 index 0000000000..679584cc87 --- /dev/null +++ b/test/model/mail/send.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +send(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +/* If you don't set SMTP Please input you SMTP setting. */ +$mailConfig = new stdclass(); +$mailConfig->smtp = new stdclass(); + +$mailConfig->turnon = 1; +$mailConfig->mta = 'smtp'; +$mailConfig->async = 0; +$mailConfig->fromAddress = ''; +$mailConfig->fromName = ''; +$mailConfig->domain = ''; +$mailConfig->smtp->host = ''; +$mailConfig->smtp->port = ''; +$mailConfig->smtp->auth = '1'; +$mailConfig->smtp->username = ''; +$mailConfig->smtp->password = ''; +$mailConfig->smtp->secure = ''; +$mailConfig->smtp->debug = 1; +$mailConfig->smtp->charset = 'utf-8'; + +global $tester; +if(!isset($tester->config->mail->turnon)) $tester->loadModel('setting')->setItems('system.mail', $mailConfig); + +$result1 = $mail->sendTest('admin','test','test','',true); + +r($result1) && p() && e('0'); diff --git a/test/model/mail/sendmail.php b/test/model/mail/sendmail.php new file mode 100644 index 0000000000..fcc4fca854 --- /dev/null +++ b/test/model/mail/sendmail.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +sendmail(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->sendmailTest(48,48)) && p() && e('0'); //测试为dev4用户发送邮件通知 diff --git a/test/model/mail/setbody.php b/test/model/mail/setbody.php new file mode 100644 index 0000000000..6a7e73e688 --- /dev/null +++ b/test/model/mail/setbody.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setCC(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setBodyTest('test body')) && p('Body') && e('test body'); //测试设置内容 diff --git a/test/model/mail/setcc.php b/test/model/mail/setcc.php new file mode 100644 index 0000000000..9013cc4cf8 --- /dev/null +++ b/test/model/mail/setcc.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +setCC(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); +$mail->setMTATest(); +a($mail->setSubjectTest('123123')); +a($mail->setMTATest()); +die; +r($mail->setCCTest()) && p() && e(); diff --git a/test/model/mail/seterrorlang.php b/test/model/mail/seterrorlang.php new file mode 100644 index 0000000000..1a4c0edab5 --- /dev/null +++ b/test/model/mail/seterrorlang.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setErrorLang(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setErrorLangTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setgmail.php b/test/model/mail/setgmail.php new file mode 100644 index 0000000000..6e2d6652e4 --- /dev/null +++ b/test/model/mail/setgmail.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setGMail(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setGMailTest()) && p() && e(); diff --git a/test/model/mail/setmta.php b/test/model/mail/setmta.php new file mode 100644 index 0000000000..3fe819cb15 --- /dev/null +++ b/test/model/mail/setmta.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +setCC(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setMTATest()) && p('Host') && e('localhost'); //获取MTA主机 +r($mail->setMTATest()) && p('SMTPDebug') && e('0'); //获取MTAdebug设置 diff --git a/test/model/mail/setsendmail.php b/test/model/mail/setsendmail.php new file mode 100644 index 0000000000..225e848348 --- /dev/null +++ b/test/model/mail/setsendmail.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setSendMail(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setSendMailTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setsmtp.php b/test/model/mail/setsmtp.php new file mode 100644 index 0000000000..876925d380 --- /dev/null +++ b/test/model/mail/setsmtp.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setSMTP(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setSMTPTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setsubject.php b/test/model/mail/setsubject.php new file mode 100644 index 0000000000..41be42134c --- /dev/null +++ b/test/model/mail/setsubject.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setCC(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setSubjectTest('test subject')) && p('Subject') && e('test subject'); //测试设置主题 diff --git a/test/model/mail/setto.php b/test/model/mail/setto.php new file mode 100644 index 0000000000..c7aad8637a --- /dev/null +++ b/test/model/mail/setto.php @@ -0,0 +1,17 @@ +#!/usr/bin/env php +setTO(); +cid=1 +pid=1 + +*/ + +$mail = new mailTest(); + +r($mail->setTOTest()) && p() && e(); \ No newline at end of file From fee3c6e0df578faa318500ac44361fa381a8e7f7 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 9 May 2022 09:55:39 +0800 Subject: [PATCH 002/125] * Finish mail test. --- test/class/mail.class.php | 160 +++---------------------------- test/data/user.yaml | 4 +- test/model/mail/iserror.php | 17 ---- test/model/mail/mailexist.php | 2 +- test/model/mail/setcc.php | 20 ---- test/model/mail/seterrorlang.php | 17 ---- test/model/mail/setgmail.php | 17 ---- test/model/mail/setsendmail.php | 17 ---- test/model/mail/setsmtp.php | 17 ---- test/model/mail/setto.php | 17 ---- test/ztest | 3 + 11 files changed, 18 insertions(+), 273 deletions(-) delete mode 100644 test/model/mail/iserror.php delete mode 100644 test/model/mail/setcc.php delete mode 100644 test/model/mail/seterrorlang.php delete mode 100644 test/model/mail/setgmail.php delete mode 100644 test/model/mail/setsendmail.php delete mode 100644 test/model/mail/setsmtp.php delete mode 100644 test/model/mail/setto.php diff --git a/test/class/mail.class.php b/test/class/mail.class.php index bdbc9d71c0..ca6403ab63 100644 --- a/test/class/mail.class.php +++ b/test/class/mail.class.php @@ -43,11 +43,11 @@ class mailTest */ public function getConfigFromProviderTest($domain, $username) { - $objects = $this->objectModel->getConfigFromProvider($domain, $username); + $object = $this->objectModel->getConfigFromProvider($domain, $username); if(dao::isError()) return dao::getError(); - return $objects; + return $object; } /** @@ -60,11 +60,11 @@ class mailTest */ public function getConfigByMXRRTest($domain, $username) { - $objects = $this->objectModel->getConfigByMXRR($domain, $username); + $object = $this->objectModel->getConfigByMXRR($domain, $username); if(dao::isError()) return dao::getError(); - return $objects; + return $object; } /** @@ -78,11 +78,11 @@ class mailTest */ public function getConfigByDetectingSMTPTest($domain, $username, $port) { - $objects = $this->objectModel->getConfigByDetectingSMTP($domain, $username, $port); + $object = $this->objectModel->getConfigByDetectingSMTP($domain, $username, $port); if(dao::isError()) return dao::getError(); - return $objects; + return $object; } /** @@ -93,41 +93,11 @@ class mailTest */ public function setMTATest() { - $objects = $this->objectModel->setMTA(); + $object = $this->objectModel->setMTA(); if(dao::isError()) return dao::getError(); - return $objects; - } - - /** - * Set SMTP. - * - * @access public - * @return void - */ - public function setSMTPTest() - { - $objects = $this->objectModel->setSMTP(); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - /** - * Set PhpMail. - * - * @access public - * @return void - */ - public function setPhpMailTest() - { - $objects = $this->objectModel->setPhpMail(); - - if(dao::isError()) return dao::getError(); - - return $objects; + return $object; } /** @@ -138,25 +108,13 @@ class mailTest */ public function setSendMailTest() { - $objects = $this->objectModel->setSendMail(); + $object = $this->objectModel->setSendMail(); if(dao::isError()) return dao::getError(); - return $objects; + return $object; } - /** - * Set GMail. - * - * @access public - * @return void - */ - public function setGMailTest() - { - $this->objectModel->setGMail(); - - return $this->setMTATest(); - } /** * Send. @@ -172,28 +130,11 @@ class mailTest */ public function sendTest($toList, $subject, $body = '', $ccList = '', $includeMe = false, $emails = array()) { - $objects = $this->objectModel->send($toList, $subject, $body, $ccList, $includeMe, $emails); + $object = $this->objectModel->send($toList, $subject, $body, $ccList, $includeMe, $emails); if(dao::isError()) return dao::getError(); - return $objects; - } - - /** - * Set TO. - * - * @param int $toList - * @param int $emails - * @access public - * @return void - */ - public function setTOTest($toList, $emails) - { - $objects = $this->objectModel->setTO($toList, $emails); - - if(dao::isError()) return dao::getError(); - - return $objects; + return $object; } /** @@ -239,36 +180,6 @@ class mailTest return $this->setMTATest(); } - /** - * Set errorlang. - * - * @access public - * @return void - */ - public function setErrorLangTest() - { - $objects = $this->objectModel->setErrorLang(); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - /** - * clear. - * - * @access public - * @return void - */ - public function clearTest() - { - $objects = $this->objectModel->clear(); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - /** * Mail exist. * @@ -284,36 +195,6 @@ class mailTest return $object; } - /** - * Is error. - * - * @access public - * @return void - */ - public function isErrorTest() - { - $object = $this->objectModel->isError(); - - if(dao::isError()) return dao::getError(); - - return $object; - } - - /** - * Get error. - * - * @access public - * @return void - */ - public function getErrorTest() - { - $objects = $this->objectModel->getError(); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - /** * Add queue. * @@ -396,23 +277,6 @@ class mailTest return $object; } - /** - * Sendmail. - * - * @param int $objectID - * @param int $actionID - * @access public - * @return void - */ - public function sendmailTest($objectID, $actionID) - { - $object = $this->objectModel->sendmail($objectID, $actionID); - - if(dao::isError()) return dao::getError(); - - return $object; - } - /** * Get subject. * diff --git a/test/data/user.yaml b/test/data/user.yaml index 16e537f0bd..f1f96e460b 100644 --- a/test/data/user.yaml +++ b/test/data/user.yaml @@ -80,9 +80,9 @@ fields: note: "邮箱" fields: - field: email1 - range: 100-999:R + range: 1000-9999:2 - field: email2 - range: 100-999:R + range: 1000-9999:2 - field: email3 range: [@qq.com,@163.com,@gmail.com] - field: skype diff --git a/test/model/mail/iserror.php b/test/model/mail/iserror.php deleted file mode 100644 index 0df44980fd..0000000000 --- a/test/model/mail/iserror.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -isError(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->isErrorTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/mailexist.php b/test/model/mail/mailexist.php index be683a444a..58b0075cd8 100644 --- a/test/model/mail/mailexist.php +++ b/test/model/mail/mailexist.php @@ -14,4 +14,4 @@ pid=1 $mail = new mailTest(); -r($mail->mailExistTest()) && p('email') && e('1000010000@qq.com'); //检查系统是否至少存在邮件 +r($mail->mailExistTest()) && p('email') && e('10001000@qq.com'); //检查系统是否至少存在邮件 diff --git a/test/model/mail/setcc.php b/test/model/mail/setcc.php deleted file mode 100644 index 9013cc4cf8..0000000000 --- a/test/model/mail/setcc.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env php -setCC(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); -$mail->setMTATest(); -a($mail->setSubjectTest('123123')); -a($mail->setMTATest()); -die; -r($mail->setCCTest()) && p() && e(); diff --git a/test/model/mail/seterrorlang.php b/test/model/mail/seterrorlang.php deleted file mode 100644 index 1a4c0edab5..0000000000 --- a/test/model/mail/seterrorlang.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setErrorLang(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->setErrorLangTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setgmail.php b/test/model/mail/setgmail.php deleted file mode 100644 index 6e2d6652e4..0000000000 --- a/test/model/mail/setgmail.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setGMail(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->setGMailTest()) && p() && e(); diff --git a/test/model/mail/setsendmail.php b/test/model/mail/setsendmail.php deleted file mode 100644 index 225e848348..0000000000 --- a/test/model/mail/setsendmail.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setSendMail(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->setSendMailTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setsmtp.php b/test/model/mail/setsmtp.php deleted file mode 100644 index 876925d380..0000000000 --- a/test/model/mail/setsmtp.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setSMTP(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->setSMTPTest()) && p() && e(); \ No newline at end of file diff --git a/test/model/mail/setto.php b/test/model/mail/setto.php deleted file mode 100644 index c7aad8637a..0000000000 --- a/test/model/mail/setto.php +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env php -setTO(); -cid=1 -pid=1 - -*/ - -$mail = new mailTest(); - -r($mail->setTOTest()) && p() && e(); \ No newline at end of file diff --git a/test/ztest b/test/ztest index fbd97fb5fb..124abf6e12 100755 --- a/test/ztest +++ b/test/ztest @@ -142,6 +142,9 @@ switch($argv[1]) case 'message': ztfRun('model/message'); break; + case 'mail': + ztfRun('model/mail'); + break; case 'tree': ztfRun('model/tree'); break; From 49d4cbfa0e77d16995b5e3e34af22a20453bc85b Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 9 May 2022 10:01:51 +0800 Subject: [PATCH 003/125] * Fix code format. --- test/class/mail.class.php | 8 ++++---- test/model/mail/getconfigbymxrr.php | 1 + test/model/mail/getconfigfromprovider.php | 1 + test/model/mail/getqueue.php | 7 ++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/class/mail.class.php b/test/class/mail.class.php index ca6403ab63..2df85f2299 100644 --- a/test/class/mail.class.php +++ b/test/class/mail.class.php @@ -11,8 +11,8 @@ class mailTest { global $tester; global $dao; - $this->dao = $dao; - $this->tester = $tester; + $this->dao = $dao; + $this->tester = $tester; $this->objectModel = $tester->loadModel('mail'); } @@ -212,11 +212,11 @@ class mailTest if($toList and $subject) { - $id = $this->dao->lastInsertID(); + $id = $this->dao->lastInsertID(); $object = $this->dao->select('*')->from(TABLE_NOTIFY)->where('id')->eq($id)->fetch(); } - if(!$object) return '没有数据提交'; + if(!$object) return '没有数据提交'; if(dao::isError()) return dao::getError(); return $object; diff --git a/test/model/mail/getconfigbymxrr.php b/test/model/mail/getconfigbymxrr.php index 5ad7411fd1..4954701b39 100644 --- a/test/model/mail/getconfigbymxrr.php +++ b/test/model/mail/getconfigbymxrr.php @@ -13,6 +13,7 @@ pid=1 */ $mail = new mailTest(); + $result1 = $mail->getConfigByMXRRTest('qq.com','test'); $result2 = $mail->getConfigByMXRRTest('sohu.com','test'); diff --git a/test/model/mail/getconfigfromprovider.php b/test/model/mail/getconfigfromprovider.php index ddd4c0153a..bf51755547 100644 --- a/test/model/mail/getconfigfromprovider.php +++ b/test/model/mail/getconfigfromprovider.php @@ -13,6 +13,7 @@ pid=1 */ $mail = new mailTest(); + $result1 = $mail->getConfigFromProviderTest('qq.com','123'); $result2 = $mail->getConfigFromProviderTest('sohu.com','123'); diff --git a/test/model/mail/getqueue.php b/test/model/mail/getqueue.php index cf8138f251..e8dde37f52 100644 --- a/test/model/mail/getqueue.php +++ b/test/model/mail/getqueue.php @@ -13,12 +13,13 @@ pid=1 */ $mail = new mailTest(); + $result1 = count($mail->getQueueTest()); $result2 = count($mail->getQueueTest('fail')); $result3 = count($mail->getQueueTest('wait')); $result4 = $mail->getQueueTest('wait'); -r($result1) && p() && e('7'); //按照收件人分组获取邮件列表个数 -r($result2) && p() && e('7'); //按照收件人分组获取发送失败的邮件数量 -r($result3) && p() && e('7'); //按照收件人分组获取待发送的邮件数量 +r($result1) && p() && e('7'); //按照收件人分组获取邮件列表个数 +r($result2) && p() && e('7'); //按照收件人分组获取发送失败的邮件数量 +r($result3) && p() && e('7'); //按照收件人分组获取待发送的邮件数量 r($result4) && p('0:data') && e('测试发信内容'); //按照收件人分组获取第一条待发送的邮件内容 From 96e460c47dbb7dcb67a3880fecf061c24634b053 Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 9 May 2022 06:41:35 +0000 Subject: [PATCH 004/125] * Finish task #53549. --- framework/model.class.php | 15 --------------- module/bug/model.php | 16 +++++++++------- module/build/model.php | 2 ++ module/caselib/model.php | 2 ++ module/execution/model.php | 15 ++++++++------- module/product/model.php | 6 ++++-- module/productplan/model.php | 6 +++--- module/program/model.php | 2 ++ module/project/model.php | 10 ++++++++-- module/story/model.php | 26 ++++++++++++++------------ module/task/model.php | 22 +++++++++++----------- module/testcase/model.php | 12 +++++------- module/testsuite/model.php | 2 ++ module/testtask/model.php | 6 ++++++ 14 files changed, 76 insertions(+), 66 deletions(-) diff --git a/framework/model.class.php b/framework/model.class.php index db11f1d62e..267fbc1edf 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -249,21 +249,6 @@ class model extends baseModel return $this->loadModel('workflowfield')->getExportFields($this->app->getModuleName()); } - /** - * Check flow rule. - * - * @param object $field - * @param string $value - * @access public - * @return bool|string - */ - public function checkFlowRule($field, $value) - { - if(!isset($this->config->bizVersion)) return false; - - return $this->loadModel('flow')->checkRule($field, $value); - } - /** * Execute Hooks * diff --git a/module/bug/model.php b/module/bug/model.php index 139ce507bf..dabf7a5e65 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -94,6 +94,7 @@ class bugModel extends model ->autoCheck() ->checkIF($bug->notifyEmail, 'notifyEmail', 'email') ->batchCheck($this->config->bug->create->requiredFields, 'notempty') + ->checkFlow() ->exec(); if(!dao::isError()) @@ -225,8 +226,6 @@ class bugModel extends model if(is_array($bug->{$extendField->field})) $bug->{$extendField->field} = join(',', $bug->{$extendField->field}); $bug->{$extendField->field} = htmlSpecialString($bug->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $bug->{$extendField->field}); - if($message) return print(js::alert($message)); } /* Required field check. */ @@ -282,6 +281,7 @@ class bugModel extends model $this->dao->insert(TABLE_BUG)->data($bug) ->autoCheck() ->batchCheck($this->config->bug->create->requiredFields, 'notempty') + ->checkFlow() ->exec(); if(dao::isError()) return false; @@ -717,6 +717,7 @@ class bugModel extends model ->checkIF($bug->notifyEmail, 'notifyEmail', 'email') ->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty') ->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty') + ->checkFlow() ->where('id')->eq((int)$bugID) ->exec(); @@ -827,8 +828,6 @@ class bugModel extends model if(is_array($bug->{$extendField->field})) $bug->{$extendField->field} = join(',', $bug->{$extendField->field}); $bug->{$extendField->field} = htmlSpecialString($bug->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $bug->{$extendField->field}); - if($message) return print(js::alert($message)); } $bugs[$bugID] = $bug; @@ -845,6 +844,7 @@ class bugModel extends model ->batchCheck($this->config->bug->edit->requiredFields, 'notempty') ->checkIF($bug->resolvedBy, 'resolution', 'notempty') ->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty') + ->checkFlow() ->where('id')->eq((int)$bugID) ->exec(); @@ -940,6 +940,7 @@ class bugModel extends model $this->dao->update(TABLE_BUG) ->data($bug) ->autoCheck() + ->checkFlow() ->where('id')->eq($bugID)->exec(); if(!dao::isError()) return common::createChanges($oldBug, $bug); @@ -970,7 +971,7 @@ class bugModel extends model ->join('mailto', ',') ->get(); - $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq($bugID)->exec(); if(!dao::isError()) { @@ -1100,6 +1101,7 @@ class bugModel extends model ->batchCheck($this->config->bug->resolve->requiredFields, 'notempty') ->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty') ->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty') + ->checkFlow() ->where('id')->eq((int)$bugID) ->exec(); @@ -1324,7 +1326,7 @@ class bugModel extends model ->remove('comment,files,labels') ->get(); - $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec(); $this->dao->update(TABLE_BUG)->set('activatedCount = activatedCount + 1')->where('id')->eq((int)$bugID)->exec(); if($solveBuild) @@ -1372,7 +1374,7 @@ class bugModel extends model ->remove('comment') ->get(); - $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec(); if($oldBug->execution) { $this->loadModel('kanban'); diff --git a/module/build/model.php b/module/build/model.php index 323ae85c58..389e00e42a 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -300,6 +300,7 @@ class buildModel extends model ->autoCheck() ->batchCheck($this->config->build->create->requiredFields, 'notempty') ->check('name', 'unique', "product = {$build->product} AND branch = {$build->branch} AND deleted = '0'") + ->checkFlow() ->exec(); if(!dao::isError()) @@ -336,6 +337,7 @@ class buildModel extends model ->batchCheck($this->config->build->edit->requiredFields, 'notempty') ->where('id')->eq($buildID) ->check('name', 'unique', "id != $buildID AND product = {$build->product} AND branch = {$build->branch} AND deleted = '0'") + ->checkFlow() ->exec(); if(isset($build->branch) and $oldBuild->branch != $build->branch) $this->dao->update(TABLE_RELEASE)->set('branch')->eq($build->branch)->where('build')->eq($buildID)->exec(); if(!dao::isError()) diff --git a/module/caselib/model.php b/module/caselib/model.php index 25bc2b146c..aab29936bf 100644 --- a/module/caselib/model.php +++ b/module/caselib/model.php @@ -102,6 +102,7 @@ class caselibModel extends model $this->dao->update(TABLE_TESTSUITE)->data($lib) ->autoCheck() ->batchcheck($this->config->caselib->edit->requiredFields, 'notempty') + ->checkFlow() ->where('id')->eq($libID) ->exec(); if(!dao::isError()) @@ -186,6 +187,7 @@ class caselibModel extends model $this->dao->insert(TABLE_TESTSUITE)->data($lib) ->batchcheck($this->config->caselib->create->requiredFields, 'notempty') ->check('name', 'unique', "deleted = '0'") + ->checkFlow() ->exec(); if(!dao::isError()) { diff --git a/module/execution/model.php b/module/execution/model.php index 6a1901eba2..228e171349 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -378,6 +378,7 @@ class executionModel extends model ->checkIF($sprint->begin != '', 'begin', 'date') ->checkIF($sprint->end != '', 'end', 'date') ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) + ->checkFlow() ->exec(); /* Add the creater to the team. */ @@ -514,6 +515,7 @@ class executionModel extends model ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $executionProject") ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") + ->checkFlow() ->where('id')->eq($executionID) ->limit(1) ->exec(); @@ -669,13 +671,6 @@ class executionModel extends model if(is_array($executions[$executionID]->{$extendField->field})) $executions[$executionID]->{$extendField->field} = join(',', $executions[$executionID]->{$extendField->field}); $executions[$executionID]->{$extendField->field} = htmlSpecialString($executions[$executionID]->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $executions[$executionID]->{$extendField->field}); - - if($message) - { - dao::$errors['message'][] = $message; - return false; - } } } @@ -705,6 +700,7 @@ class executionModel extends model ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID") ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") + ->checkFlow() ->where('id')->eq($executionID) ->limit(1) ->exec(); @@ -767,6 +763,7 @@ class executionModel extends model ->autoCheck() ->check($this->config->execution->start->requiredFields, 'notempty') ->checkIF($execution->realBegan != '', 'realBegan', 'le', helper::today()) + ->checkFlow() ->where('id')->eq((int)$executionID) ->exec(); @@ -799,6 +796,7 @@ class executionModel extends model $this->dao->update(TABLE_EXECUTION)->data($execution) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$executionID) ->exec(); @@ -825,6 +823,7 @@ class executionModel extends model $this->dao->update(TABLE_EXECUTION)->data($execution) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$executionID) ->exec(); @@ -859,6 +858,7 @@ class executionModel extends model $this->dao->update(TABLE_EXECUTION)->data($execution) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$executionID) ->exec(); @@ -928,6 +928,7 @@ class executionModel extends model ->check($this->config->execution->close->requiredFields,'notempty') ->checkIF($execution->realEnd != '', 'realEnd', 'le', helper::today()) ->checkIF($execution->realEnd != '', 'realEnd', 'ge', $oldExecution->realBegan) + ->checkFlow() ->where('id')->eq((int)$executionID) ->exec(); diff --git a/module/product/model.php b/module/product/model.php index 21eee5e278..4080a98d00 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -609,6 +609,7 @@ class productModel extends model ->batchCheck($this->config->product->create->requiredFields, 'notempty') ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`program` = $programID") ->checkIF(!empty($product->code), 'code', 'unique') + ->checkFlow() ->exec(); if(!dao::isError()) @@ -717,6 +718,7 @@ class productModel extends model ->batchCheck($this->config->product->edit->requiredFields, 'notempty') ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID") ->checkIF(!empty($product->code), 'code', 'unique', "id != $productID") + ->checkFlow() ->where('id')->eq($productID) ->exec(); @@ -771,8 +773,6 @@ class productModel extends model if(is_array($products[$productID]->{$extendField->field})) $products[$productID]->{$extendField->field} = join(',', $products[$productID]->{$extendField->field}); $products[$productID]->{$extendField->field} = htmlSpecialString($products[$productID]->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $products[$productID]->{$extendField->field}); - if($message) return print(js::alert($message)); } } if(dao::isError()) return print(js::error(dao::getError())); @@ -789,6 +789,7 @@ class productModel extends model ->autoCheck() ->batchCheck($this->config->product->edit->requiredFields , 'notempty') ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID") + ->checkFlow() ->where('id')->eq($productID) ->exec(); if(dao::isError()) return print(js::error('product#' . $productID . dao::getError(true))); @@ -825,6 +826,7 @@ class productModel extends model $this->dao->update(TABLE_PRODUCT)->data($product) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$productID) ->exec(); diff --git a/module/productplan/model.php b/module/productplan/model.php index b389bc6c81..92c920cbc9 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -432,6 +432,7 @@ class productplanModel extends model ->autoCheck() ->batchCheck($this->config->productplan->create->requiredFields, 'notempty') ->checkIF(!$this->post->future && !empty($_POST['begin']) && !empty($_POST['end']), 'end', 'ge', $plan->begin) + ->checkFlow() ->exec(); if(!dao::isError()) { @@ -512,6 +513,7 @@ class productplanModel extends model ->autoCheck() ->batchCheck($this->config->productplan->edit->requiredFields, 'notempty') ->checkIF(!$this->post->future && !empty($_POST['begin']) && !empty($_POST['end']), 'end', 'ge', $plan->begin) + ->checkFlow() ->where('id')->eq((int)$planID) ->exec(); if(dao::isError()) return false; @@ -651,8 +653,6 @@ class productplanModel extends model if(is_array($plan->{$extendField->field})) $plan->{$extendField->field} = join(',', $plan->{$extendField->field}); $plan->{$extendField->field} = htmlSpecialString($plan->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $plan->{$extendField->field}); - if($message) return print(js::alert($message)); } $plans[$planID] = $plan; @@ -695,7 +695,7 @@ class productplanModel extends model if($change) { if($parentID > 0 and !isset($parents[$parentID])) $parents[$parentID] = $parentID; - $this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->where('id')->eq($planID)->exec(); + $this->dao->update(TABLE_PRODUCTPLAN)->data($plan)->autoCheck()->checkFlow()->where('id')->eq($planID)->exec(); if(dao::isError()) return print(js::error(dao::getError())); $changes[$planID] = $change; } diff --git a/module/program/model.php b/module/program/model.php index baff7f83d0..b1932bf963 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -657,6 +657,7 @@ class programModel extends model ->checkIF($program->end != '', 'end', 'date') ->checkIF($program->end != '', 'end', 'gt', $program->begin) ->checkIF(!empty($program->name), 'name', 'unique', "`type`='program' and `parent` = $program->parent") + ->checkFlow() ->exec(); if(!dao::isError()) @@ -755,6 +756,7 @@ class programModel extends model ->checkIF($program->end != '', 'end', 'date') ->checkIF($program->end != '', 'end', 'gt', $program->begin) ->checkIF(!empty($program->name), 'name', 'unique', "id!=$programID and `type`='program' and `parent` = $program->parent") + ->checkFlow() ->where('id')->eq($programID) ->limit(1) ->exec(); diff --git a/module/project/model.php b/module/project/model.php index ab4804577c..86ef1e72d8 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -913,6 +913,7 @@ class projectModel extends model ->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = $project->parent and `model` = '{$project->model}'") ->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `model` = '{$project->model}'") ->checkIF($project->end != '', 'end', 'gt', $project->begin) + ->checkFlow() ->exec(); /* Add the creater to the team. */ @@ -1145,6 +1146,7 @@ class projectModel extends model ->checkIF($project->end != '', 'end', 'gt', $project->begin) ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = $project->parent and `model` = '{$project->model}'") ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project' and `model` = '{$project->model}'") + ->checkFlow() ->where('id')->eq($projectID) ->exec(); @@ -1267,8 +1269,6 @@ class projectModel extends model if(is_array($projects[$projectID]->{$extendField->field})) $projects[$projectID]->{$extendField->field} = join(',', $projects[$projectID]->{$extendField->field}); $projects[$projectID]->{$extendField->field} = htmlSpecialString($projects[$projectID]->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $projects[$projectID]->{$extendField->field}); - if($message) hepler::end(js::alert($message)); } } if(dao::isError()) return print(js::error(dao::getError())); @@ -1286,6 +1286,7 @@ class projectModel extends model ->checkIF($project->end != '', 'end', 'gt', $project->begin) ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID and `model` = '{$project->model}'") ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project' and `model` = '{$project->model}'") + ->checkFlow() ->where('id')->eq($projectID) ->exec(); @@ -1328,6 +1329,7 @@ class projectModel extends model ->autoCheck() ->check($this->config->project->start->requiredFields, 'notempty') ->checkIF($project->realBegan != '', 'realBegan', 'le', helper::today()) + ->checkFlow() ->where('id')->eq((int)$projectID) ->exec(); @@ -1357,6 +1359,7 @@ class projectModel extends model $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$projectID) ->exec(); @@ -1382,6 +1385,7 @@ class projectModel extends model $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$projectID) ->exec(); @@ -1417,6 +1421,7 @@ class projectModel extends model $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$projectID) ->exec(); @@ -1486,6 +1491,7 @@ class projectModel extends model ->check($this->config->project->close->requiredFields, 'notempty') ->checkIF($project->realEnd != '', 'realEnd', 'le', helper::today()) ->checkIF($project->realEnd != '', 'realEnd', 'ge', $oldProject->realBegan) + ->checkFlow() ->where('id')->eq((int)$projectID) ->exec(); diff --git a/module/story/model.php b/module/story/model.php index 1877c18449..4d5e1f58e9 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -247,6 +247,7 @@ class storyModel extends model ->autoCheck() ->checkIF($story->notifyEmail, 'notifyEmail', 'email') ->batchCheck($requiredFields, 'notempty') + ->checkFlow() ->exec(); if(!dao::isError()) @@ -514,8 +515,6 @@ class storyModel extends model if(is_array($story->{$extendField->field})) $story->{$extendField->field} = join(',', $story->{$extendField->field}); $story->{$extendField->field} = htmlSpecialString($story->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $story->{$extendField->field}); - if($message) return print(js::alert($message)); } foreach(explode(',', $this->config->story->create->requiredFields) as $field) @@ -538,7 +537,7 @@ class storyModel extends model foreach($data as $i => $story) { - $this->dao->insert(TABLE_STORY)->data($story)->autoCheck()->exec(); + $this->dao->insert(TABLE_STORY)->data($story)->autoCheck()->checkFlow()->exec(); if(dao::isError()) { echo js::error(dao::getError()); @@ -693,6 +692,7 @@ class storyModel extends model $this->dao->update(TABLE_STORY)->data($story, 'spec,verify') ->autoCheck() ->batchCheck($this->config->story->change->requiredFields, 'notempty') + ->checkFlow() ->where('id')->eq((int)$storyID)->exec(); if(!dao::isError()) @@ -864,6 +864,7 @@ class storyModel extends model ->checkIF(isset($story->closedReason) and $story->closedReason == 'done', 'stage', 'notempty') ->checkIF(isset($story->closedReason) and $story->closedReason == 'duplicate', 'duplicateStory', 'notempty') ->checkIF($story->notifyEmail, 'notifyEmail', 'email') + ->checkFlow() ->where('id')->eq((int)$storyID)->exec(); if(!dao::isError()) @@ -1245,8 +1246,6 @@ class storyModel extends model if(is_array($story->{$extendField->field})) $story->{$extendField->field} = join(',', $story->{$extendField->field}); $story->{$extendField->field} = htmlSpecialString($story->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $story->{$extendField->field}); - if($message) return print(js::alert($message)); } $stories[$storyID] = $story; @@ -1261,6 +1260,7 @@ class storyModel extends model ->checkIF($story->closedBy, 'closedReason', 'notempty') ->checkIF($story->closedReason == 'done', 'stage', 'notempty') ->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty') + ->checkFlow() ->where('id')->eq((int)$storyID) ->exec(); if($story->title != $oldStory->title) @@ -1353,6 +1353,7 @@ class storyModel extends model ->batchCheck($this->config->story->review->requiredFields, 'notempty') ->checkIF($this->post->result == 'reject', 'closedReason', 'notempty') ->checkIF($this->post->result == 'reject' and $this->post->closedReason == 'duplicate', 'duplicateStory', 'notempty') + ->checkFlow() ->where('id')->eq($storyID)->exec(); if($this->post->result == 'revert') { @@ -1576,6 +1577,7 @@ class storyModel extends model ->autoCheck() ->batchCheck($this->config->story->close->requiredFields, 'notempty') ->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty') + ->checkFlow() ->where('id')->eq($storyID)->exec(); /* Update parent story status and stage. */ @@ -1975,13 +1977,13 @@ class storyModel extends model $assignedTo = $this->post->assignedTo; if($assignedTo == $oldStory->assignedTo) return array(); - $story = new stdclass(); - $story->lastEditedBy = $this->app->user->account; - $story->lastEditedDate = $now; - $story->assignedTo = $assignedTo; - $story->assignedDate = $now; + $story = fixer::input('post') + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->add('assignedDate', $now) + ->get(); - $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec(); + $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->checkFlow()->where('id')->eq((int)$storyID)->exec(); if(!dao::isError()) return common::createChanges($oldStory, $story); return false; } @@ -2042,7 +2044,7 @@ class storyModel extends model ->setDefault('activatedDate', $now) ->remove('comment') ->get(); - $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec(); + $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->checkFlow()->where('id')->eq($storyID)->exec(); if($this->post->status == 'active') $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->exec(); diff --git a/module/task/model.php b/module/task/model.php index bf0961a34f..c25ac00dd2 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -138,6 +138,7 @@ class taskModel extends model ->batchCheck($requiredFields, 'notempty') ->checkIF($task->estimate != '', 'estimate', 'float') ->checkIF(!helper::isZeroDate($task->deadline), 'deadline', 'ge', $task->estStarted) + ->checkFlow() ->exec(); if(dao::isError()) return false; @@ -363,12 +364,6 @@ class taskModel extends model if(is_array($data[$i]->{$extendField->field})) $data[$i]->{$extendField->field} = join(',', $data[$i]->{$extendField->field}); $data[$i]->{$extendField->field} = htmlSpecialString($data[$i]->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $data[$i]->{$extendField->field}); - if($message) - { - dao::$errors['message'][] = sprintf($message); - return false; - } } } @@ -423,6 +418,7 @@ class taskModel extends model $this->dao->insert(TABLE_TASK)->data($task) ->autoCheck() ->checkIF($task->estimate != '', 'estimate', 'float') + ->checkFlow() ->exec(); if(dao::isError()) return false; @@ -1048,6 +1044,7 @@ class taskModel extends model ->batchCheckIF($task->status == 'done', 'canceledBy, canceledDate', 'empty') ->batchCheckIF($task->closedReason == 'cancel', 'finishedBy, finishedDate', 'empty') + ->checkFlow() ->where('id')->eq((int)$taskID)->exec(); if(!dao::isError()) @@ -1217,8 +1214,6 @@ class taskModel extends model if(is_array($task->{$extendField->field})) $task->{$extendField->field} = join(',', $task->{$extendField->field}); $task->{$extendField->field} = htmlSpecialString($task->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $task->{$extendField->field}); - if($message) return print(js::alert($message)); } if(isset($data->consumeds[$taskID])) @@ -1353,6 +1348,7 @@ class taskModel extends model ->batchCheckIF($task->status == 'done', 'canceledBy, canceledDate', 'empty') ->batchCheckIF($task->closedReason == 'cancel', 'finishedBy, finishedDate', 'empty') + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); if(dao::isError()) @@ -1469,6 +1465,7 @@ class taskModel extends model ->data($task) ->autoCheck() ->check('left', 'float') + ->checkFlow() ->where('id')->eq($taskID) ->exec(); @@ -1555,6 +1552,7 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() ->check('consumed,left', 'float') + ->checkFlow() ->where('id')->eq((int)$taskID)->exec(); if($oldTask->parent > 0) @@ -1825,6 +1823,7 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); @@ -1863,7 +1862,7 @@ class taskModel extends model ->remove('comment') ->get(); - $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec(); + $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec(); if($oldTask->parent > 0) $this->updateParentStatus($taskID); @@ -1901,7 +1900,7 @@ class taskModel extends model ->remove('comment') ->get(); - $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec(); + $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec(); if(!dao::isError()) { @@ -1945,7 +1944,7 @@ class taskModel extends model ->remove('comment') ->get(); - $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec(); + $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->checkFlow()->where('id')->eq((int)$taskID)->exec(); if($oldTask->fromBug) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($oldTask->fromBug)->exec(); if($oldTask->parent > 0) $this->updateParentStatus($taskID); if($oldTask->parent == '-1') @@ -2027,6 +2026,7 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() ->batchCheck($this->config->task->activate->requiredFields, 'notempty') + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); diff --git a/module/testcase/model.php b/module/testcase/model.php index 0b316b941f..94a36ec02d 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -64,7 +64,7 @@ class testcaseModel extends model /* Value of story may be showmore. */ $case->story = (int)$case->story; - $this->dao->insert(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->exec(); + $this->dao->insert(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->create->requiredFields, 'notempty')->checkFlow()->exec(); if(!$this->dao->isError()) { $caseID = $this->dao->lastInsertID(); @@ -174,8 +174,6 @@ class testcaseModel extends model if(is_array($data[$i]->{$extendField->field})) $data[$i]->{$extendField->field} = join(',', $data[$i]->{$extendField->field}); $data[$i]->{$extendField->field} = htmlSpecialString($data[$i]->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $data[$i]->{$extendField->field}); - if($message) return print(js::alert($message)); } foreach(explode(',', $this->config->testcase->create->requiredFields) as $field) @@ -191,6 +189,7 @@ class testcaseModel extends model $this->dao->insert(TABLE_CASE)->data($case) ->autoCheck() ->batchCheck($this->config->testcase->create->requiredFields, 'notempty') + ->checkFlow() ->exec(); if(dao::isError()) @@ -737,7 +736,7 @@ class testcaseModel extends model array_splice($requiredFieldsArr, $fieldIndex, 1); $requiredFields = implode(',', $requiredFieldsArr); } - $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec(); + $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($requiredFields, 'notempty')->checkFlow()->where('id')->eq((int)$caseID)->exec(); if(!$this->dao->isError()) { $isLibCase = ($oldCase->lib and empty($oldCase->product)); @@ -843,7 +842,7 @@ class testcaseModel extends model ->join('reviewedBy', ',') ->get(); - $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->where('id')->eq($caseID)->exec(); + $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->checkFlow()->where('id')->eq($caseID)->exec(); if(dao::isError()) return false; @@ -967,8 +966,6 @@ class testcaseModel extends model if(is_array($case->{$extendField->field})) $case->{$extendField->field} = join(',', $case->{$extendField->field}); $case->{$extendField->field} = htmlSpecialString($case->{$extendField->field}); - $message = $this->checkFlowRule($extendField, $case->{$extendField->field}); - if($message) return print(js::alert($message)); } $cases[$caseID] = $case; @@ -983,6 +980,7 @@ class testcaseModel extends model $this->dao->update(TABLE_CASE)->data($case) ->autoCheck() ->batchCheck($this->config->testcase->edit->requiredFields, 'notempty') + ->checkFlow() ->where('id')->eq($caseID) ->exec(); diff --git a/module/testsuite/model.php b/module/testsuite/model.php index a0d52b572f..0e636d720a 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -71,6 +71,7 @@ class testsuiteModel extends model $suite = $this->loadModel('file')->processImgURL($suite, $this->config->testsuite->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_TESTSUITE)->data($suite) ->batchcheck($this->config->testsuite->create->requiredFields, 'notempty') + ->checkFlow() ->exec(); if(!dao::isError()) { @@ -157,6 +158,7 @@ class testsuiteModel extends model $this->dao->update(TABLE_TESTSUITE)->data($suite) ->autoCheck() ->batchcheck($this->config->testsuite->edit->requiredFields, 'notempty') + ->checkFlow() ->where('id')->eq($suiteID) ->exec(); if(!dao::isError()) diff --git a/module/testtask/model.php b/module/testtask/model.php index 6e8562b065..079992d200 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -44,6 +44,7 @@ class testtaskModel extends model ->checkIF($task->begin != '', 'begin', 'date') ->checkIF($task->end != '', 'end', 'date') ->checkIF($task->end != '', 'end', 'ge', $task->begin) + ->checkFlow() ->exec(); if(!dao::isError()) @@ -739,6 +740,7 @@ class testtaskModel extends model ->autoCheck() ->batchcheck($this->config->testtask->edit->requiredFields, 'notempty') ->checkIF($task->end != '', 'end', 'ge', $task->begin) + ->checkFlow() ->where('id')->eq($taskID) ->exec(); if(!dao::isError()) @@ -765,6 +767,7 @@ class testtaskModel extends model $this->dao->update(TABLE_TESTTASK)->data($testtask) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); @@ -801,6 +804,7 @@ class testtaskModel extends model $testtask = $this->loadModel('file')->processImgURL($testtask, $this->config->testtask->editor->close['id'], $this->post->uid); $this->dao->update(TABLE_TESTTASK)->data($testtask) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); @@ -827,6 +831,7 @@ class testtaskModel extends model $this->dao->update(TABLE_TESTTASK)->data($testtask) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); @@ -849,6 +854,7 @@ class testtaskModel extends model $this->dao->update(TABLE_TESTTASK)->data($testtask) ->autoCheck() + ->checkFlow() ->where('id')->eq((int)$taskID) ->exec(); From e30acad1f2cba5f5ac24b405360f09bf61e1e8fa Mon Sep 17 00:00:00 2001 From: daitingting Date: Mon, 9 May 2022 07:56:17 +0000 Subject: [PATCH 005/125] * Add id for checking unique field. --- framework/control.class.php | 2 -- lib/dao/dao.class.php | 6 +++--- module/bug/model.php | 7 +++++++ module/build/model.php | 1 + module/caselib/model.php | 1 + module/execution/model.php | 7 +++++++ module/product/model.php | 3 +++ module/productplan/model.php | 2 ++ module/program/model.php | 1 + module/project/model.php | 7 +++++++ module/release/model.php | 3 +++ module/story/model.php | 7 +++++++ module/task/model.php | 9 +++++++++ module/testcase/model.php | 3 +++ module/testsuite/model.php | 1 + module/testtask/model.php | 13 ++++++++++++- 16 files changed, 67 insertions(+), 6 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index a545295b65..021fc7fa28 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -42,8 +42,6 @@ class control extends baseControl /* Code for task #9224. Set requiredFields for workflow. */ if($this->dbh and (defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api'))) { - $this->checkRequireFlowField(); - if(isset($this->config->{$this->moduleName}) and strpos($this->methodName, 'export') !== false) { if(isset($this->config->{$this->moduleName}->exportFields) or isset($this->config->{$this->moduleName}->list->exportFields)) diff --git a/lib/dao/dao.class.php b/lib/dao/dao.class.php index 7718671118..7b99d5f16b 100644 --- a/lib/dao/dao.class.php +++ b/lib/dao/dao.class.php @@ -47,14 +47,14 @@ class dao extends baseDAO $module = $app->getmodulename(); $method = $app->getmethodname(); - $flowaction = $this->dbh->query("select * from " . table_workflowaction . " where `module` = '{$module}' and `action` = '{$method}' and `buildin` = '1' and `extensiontype` = 'extend'")->fetch(pdo::fetch_obj); + $flowaction = $this->dbh->query("select * from " . TABLE_WORKFLOWACTION . " where `module` = '{$module}' and `action` = '{$method}' and `buildin` = '1' and `extensiontype` = 'extend'")->fetch(PDO::FETCH_OBJ); if(!$flowaction) return $this; - $flowfields = $this->dbh->query("select t2.name,t2.rules,t2.control,t2.field,t1.layoutrules from " . table_workflowlayout . " as t1 left join " . table_workflowfield . " as t2 on t1.module = t2.module and t1.field = t2.field where t1.module = '{$module}' and t1.action = '{$method}' and t1.readonly = '0'")->fetchall(); + $flowfields = $this->dbh->query("select t2.name,t2.rules,t2.control,t2.field,t1.layoutrules from " . TABLE_WORKFLOWLAYOUT . " as t1 left join " . TABLE_WORKFLOWFIELD . " as t2 on t1.module = t2.module and t1.field = t2.field where t1.module = '{$module}' and t1.action = '{$method}' and t1.readonly = '0'")->fetchall(); if(!$flowfields) return $this; $rules = array(); - $rawrules = $this->dbh->query("select * from " . table_workflowrule)->fetchall(); + $rawrules = $this->dbh->query("select * from " . TABLE_WORKFLOWRULE)->fetchall(); foreach($rawrules as $rule) $rules[$rule->id] = $rule; foreach($flowfields as $key => $field) diff --git a/module/bug/model.php b/module/bug/model.php index dabf7a5e65..5df7ce7a40 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -675,6 +675,7 @@ class bugModel extends model } $now = helper::now(); $bug = fixer::input('post') + ->add('id', $bugID) ->cleanInt('product,module,severity,project,execution,story,task,branch') ->stripTags($this->config->bug->editor->edit['id'], $this->config->allowedTags) ->setDefault('product,module,execution,story,task,duplicateBug,branch', 0) @@ -789,6 +790,7 @@ class bugModel extends model $oldBug = $oldBugs[$bugID]; $bug = new stdclass(); + $bug->id = $bugID; $bug->lastEditedBy = $this->app->user->account; $bug->lastEditedDate = $now; $bug->type = $data->types[$bugID]; @@ -930,6 +932,7 @@ class bugModel extends model $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') + ->add('id', $bugID) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('assignedDate', $now) @@ -963,6 +966,7 @@ class bugModel extends model $oldBug = $this->getById($bugID); $bug = fixer::input('post') + ->add('id', $bugID) ->setDefault('confirmed', 1) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) @@ -1028,6 +1032,7 @@ class bugModel extends model $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') + ->add('id', $bugID) ->add('status', 'resolved') ->add('confirmed', 1) ->setDefault('lastEditedBy', $this->app->user->account) @@ -1312,6 +1317,7 @@ class bugModel extends model ->setDefault('lastEditedDate', $now) ->setDefault('activatedDate', $now) ->setDefault('activatedCount', (int)$oldBug->activatedCount) + ->add('id', $bugID) ->add('resolution', '') ->add('status', 'active') ->add('resolvedDate', '0000-00-00') @@ -1363,6 +1369,7 @@ class bugModel extends model $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') + ->add('id', $bugID) ->add('assignedTo', 'closed') ->add('status', 'closed') ->add('confirmed', 1) diff --git a/module/build/model.php b/module/build/model.php index 389e00e42a..b72d747ec6 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -325,6 +325,7 @@ class buildModel extends model $buildID = (int)$buildID; $oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch(); $build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags) + ->add('id', $buildID) ->setIF(!isset($_POST['branch']), 'branch', $oldBuild->branch) ->setDefault('product', $oldBuild->product) ->cleanInt('product,branch,execution') diff --git a/module/caselib/model.php b/module/caselib/model.php index aab29936bf..d4adfab1ea 100644 --- a/module/caselib/model.php +++ b/module/caselib/model.php @@ -94,6 +94,7 @@ class caselibModel extends model $oldLib = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$libID)->fetch(); $lib = fixer::input('post') ->stripTags($this->config->caselib->editor->edit['id'], $this->config->allowedTags) + ->add('id', $libID) ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', helper::now()) ->remove('uid') diff --git a/module/execution/model.php b/module/execution/model.php index 228e171349..7439711471 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -469,6 +469,7 @@ class executionModel extends model /* Get the data from the post. */ $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', helper::now()) ->setIF(helper::isZeroDate($this->post->begin), 'begin', '') @@ -621,6 +622,7 @@ class executionModel extends model $executionID = (int)$executionID; $executions[$executionID] = new stdClass(); + $executions[$executionID]->id = $executionID; $executions[$executionID]->name = $executionName; $executions[$executionID]->code = $executionCode; $executions[$executionID]->PM = $data->PMs[$executionID]; @@ -753,6 +755,7 @@ class executionModel extends model $now = helper::now(); $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('status', 'doing') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) @@ -786,6 +789,7 @@ class executionModel extends model $now = helper::now(); $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->remove('comment') @@ -816,6 +820,7 @@ class executionModel extends model $now = helper::now(); $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('status', 'suspended') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) @@ -843,6 +848,7 @@ class executionModel extends model $now = helper::now(); $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('realEnd', '') ->setDefault('status', 'doing') ->setDefault('lastEditedBy', $this->app->user->account) @@ -913,6 +919,7 @@ class executionModel extends model $now = helper::now(); $execution = fixer::input('post') + ->add('id', $executionID) ->setDefault('status', 'closed') ->setDefault('closedBy', $this->app->user->account) ->setDefault('closedDate', $now) diff --git a/module/product/model.php b/module/product/model.php index 4080a98d00..2f1239d04d 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -684,6 +684,7 @@ class productModel extends model if($oldProduct->bind) $this->config->product->edit->requiredFields = 'name'; $product = fixer::input('post') + ->add('id', $productID) ->callFunc('name', 'trim') ->setDefault('line', 0) ->setIF(!isset($_POST['whitelist']), 'whitelist', '') @@ -766,6 +767,7 @@ class productModel extends model $products[$productID]->status = $data->statuses[$productID]; $products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags); $products[$productID]->acl = $data->acls[$productID]; + $products[$productID]->id = $productID; foreach($extendFields as $extendField) { @@ -821,6 +823,7 @@ class productModel extends model $oldProduct = $this->getById($productID); $now = helper::now(); $product= fixer::input('post') + ->add('id', $productID) ->setDefault('status', 'closed') ->remove('comment')->get(); diff --git a/module/productplan/model.php b/module/productplan/model.php index 92c920cbc9..ad2d763bec 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -476,6 +476,7 @@ class productplanModel extends model $plan = fixer::input('post')->stripTags($this->config->productplan->editor->edit['id'], $this->config->allowedTags) ->setIF($this->post->future or empty($_POST['begin']), 'begin', $this->config->productplan->future) ->setIF($this->post->future or empty($_POST['end']), 'end', $this->config->productplan->future) + ->add('id', $planID) ->remove('delta,uid,future') ->get(); @@ -640,6 +641,7 @@ class productplanModel extends model $plan->end = isset($data->end[$planID]) ? $data->end[$planID] : ''; $plan->status = isset($data->status[$planID]) ? $data->status[$planID] : $oldPlans[$planID]->status; $plan->parent = $oldPlans[$planID]->parent; + $plan->id = $planID; if(empty($plan->title)) return print(js::alter(sprintf($this->lang->productplan->errorNoTitle, $planID))); if($plan->begin > $plan->end and !empty($plan->end)) return print(js::alert(sprintf($this->lang->productplan->beginGeEnd, $planID))); diff --git a/module/program/model.php b/module/program/model.php index b1932bf963..f5bd3cdb18 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -690,6 +690,7 @@ class programModel extends model $oldProgram = $this->dao->findById($programID)->from(TABLE_PROGRAM)->fetch(); $program = fixer::input('post') + ->add('id', $programID) ->setDefault('team', $this->post->name) ->setDefault('end', '') ->setIF($this->post->begin == '0000-00-00', 'begin', '') diff --git a/module/project/model.php b/module/project/model.php index 86ef1e72d8..04a76c89f2 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1067,6 +1067,7 @@ class projectModel extends model $_POST['products'] = isset($_POST['products']) ? array_filter($_POST['products']) : $linkedProducts; $project = fixer::input('post') + ->add('id', $projectID) ->callFunc('name', 'trim') ->setDefault('team', substr($this->post->name, 0, 30)) ->setDefault('lastEditedBy', $this->app->user->account) @@ -1239,6 +1240,7 @@ class projectModel extends model $projects[$projectID] = new stdClass(); if(isset($data->parents[$projectID])) $projects[$projectID]->parent = $data->parents[$projectID]; + $projects[$projectID]->id = $projectID; $projects[$projectID]->name = $projectName; $projects[$projectID]->PM = $data->PMs[$projectID]; $projects[$projectID]->begin = $data->begins[$projectID]; @@ -1320,6 +1322,7 @@ class projectModel extends model $now = helper::now(); $project = fixer::input('post') + ->add('id', $projectID) ->setDefault('status', 'doing') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) @@ -1352,6 +1355,7 @@ class projectModel extends model $now = helper::now(); $project = fixer::input('post') + ->add('id', $projectID) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->remove('comment') @@ -1377,6 +1381,7 @@ class projectModel extends model { $oldProject = $this->getById($projectID); $project = fixer::input('post') + ->add('id', $projectID) ->setDefault('status', 'suspended') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', helper::now()) @@ -1405,6 +1410,7 @@ class projectModel extends model $now = helper::now(); $project = fixer::input('post') + ->add('id', $projectID) ->setDefault('realEnd','') ->setDefault('status', 'doing') ->setDefault('lastEditedBy', $this->app->user->account) @@ -1476,6 +1482,7 @@ class projectModel extends model $now = helper::now(); $project = fixer::input('post') + ->add('id', $projectID) ->setDefault('status', 'closed') ->setDefault('closedBy', $this->app->user->account) ->setDefault('closedDate', $now) diff --git a/module/release/model.php b/module/release/model.php index 128917fcf9..b0965abe8c 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -192,6 +192,7 @@ class releaseModel extends model ->autoCheck() ->batchCheck($this->config->release->create->requiredFields, 'notempty') ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'"); + ->checkFlow() if(dao::isError()) { @@ -248,6 +249,7 @@ class releaseModel extends model $branch = $this->dao->select('branch')->from(TABLE_BUILD)->where('id')->eq((int)$this->post->build)->fetch('branch'); $release = fixer::input('post')->stripTags($this->config->release->editor->edit['id'], $this->config->allowedTags) + ->add('id', $releaseID) ->add('branch', (int)$branch) ->join('mailto', ',') ->setIF(!$this->post->marker, 'marker', 0) @@ -269,6 +271,7 @@ class releaseModel extends model ->autoCheck() ->batchCheck($this->config->release->edit->requiredFields, 'notempty') ->check('name', 'unique', "id != '$releaseID' AND product = '{$release->product}' AND branch = '$branch' AND deleted = '0'") + ->checkFlow() ->where('id')->eq((int)$releaseID) ->exec(); if(!dao::isError()) diff --git a/module/story/model.php b/module/story/model.php index 4d5e1f58e9..eb728e444e 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -675,6 +675,7 @@ class storyModel extends model $story = fixer::input('post') ->callFunc('title', 'trim') ->setDefault('lastEditedBy', $this->app->user->account) + ->add('id', $storyID) ->add('lastEditedDate', $now) ->setIF($specChanged, 'version', $oldStory->version + 1) ->setIF($specChanged and $oldStory->status == 'active' and $this->post->needNotReview == false, 'status', 'changed') @@ -772,6 +773,7 @@ class storyModel extends model ->cleanFloat('estimate') ->setDefault('assignedDate', $oldStory->assignedDate) ->setDefault('lastEditedBy', $this->app->user->account) + ->add('id', $storyID) ->add('lastEditedDate', $now) ->setDefault('plan,notifyEmail', '') ->setDefault('status', $oldStory->status) @@ -1210,6 +1212,7 @@ class storyModel extends model $oldStory = $oldStories[$storyID]; $story = new stdclass(); + $story->id = $storyID; $story->lastEditedBy = $this->app->user->account; $story->lastEditedDate = $now; $story->status = $oldStory->status; @@ -1330,6 +1333,7 @@ class storyModel extends model ->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'duplicate', 'duplicateStory') ->removeIF($this->post->result == 'reject' and $this->post->closedReason != 'subdivided', 'childStories') ->add('reviewedBy', $oldStory->reviewedBy . ',' . $this->app->user->account) + ->add('id', $storyID) ->remove('result,preVersion,comment') ->get(); @@ -1550,6 +1554,7 @@ class storyModel extends model $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $story = fixer::input('post') + ->add('id', $storyID) ->add('assignedTo', 'closed') ->add('status', 'closed') ->add('stage', 'closed') @@ -1978,6 +1983,7 @@ class storyModel extends model if($assignedTo == $oldStory->assignedTo) return array(); $story = fixer::input('post') + ->add('id', $storyID) ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', $now) ->add('assignedDate', $now) @@ -2031,6 +2037,7 @@ class storyModel extends model $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $story = fixer::input('post') + ->add('id', $storyID) ->add('closedBy', '') ->add('closedReason', '') ->add('closedDate', '0000-00-00') diff --git a/module/task/model.php b/module/task/model.php index c25ac00dd2..fca1b01bf0 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -904,6 +904,7 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') + ->add('id', $taskID) ->setDefault('story, estimate, left, consumed', 0) ->setDefault('realStarted', '0000-00-00 00:00:00') ->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate) @@ -1167,6 +1168,7 @@ class taskModel extends model $oldTask = $oldTasks[$taskID]; $task = new stdclass(); + $task->id = $taskID; $task->color = $data->colors[$taskID]; $task->name = $data->names[$taskID]; $task->module = isset($data->modules[$taskID]) ? $data->modules[$taskID] : 0; @@ -1433,6 +1435,7 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') + ->add('id', $taskID) ->cleanFloat('left') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) @@ -1499,6 +1502,7 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') + ->add('id', $taskID) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('status', 'doing') @@ -1725,6 +1729,7 @@ class taskModel extends model } $task = fixer::input('post') + ->add('id', $taskID) ->setIF(is_numeric($this->post->consumed), 'consumed', (float)$this->post->consumed) ->setIF(!$this->post->realStarted and helper::isZeroDate($oldTask->realStarted), 'realStarted', $now) ->setDefault('left', 0) @@ -1856,6 +1861,7 @@ class taskModel extends model $oldTask = $this->getById($taskID); $task = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'pause') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', helper::now()) @@ -1889,6 +1895,7 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'closed') ->setDefault('assignedTo', 'closed') ->setDefault('assignedDate', $now) @@ -1934,6 +1941,7 @@ class taskModel extends model $now = helper::now(); $task = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'cancel') ->setDefault('assignedTo', $oldTask->openedBy) ->setDefault('assignedDate', $now) @@ -1994,6 +2002,7 @@ class taskModel extends model $oldTask = $this->getById($taskID); if($oldTask->parent == '-1') $this->config->task->activate->requiredFields = ''; $task = fixer::input('post') + ->add('id', $taskID) ->setIF(is_numeric($this->post->left), 'left', (float)$this->post->left) ->setDefault('left', 0) ->setDefault('status', 'doing') diff --git a/module/testcase/model.php b/module/testcase/model.php index 94a36ec02d..b8bc0a7575 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -714,6 +714,7 @@ class testcaseModel extends model $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version; $case = fixer::input('post') + ->add('id', $caseID) ->add('version', $version) ->setIF($this->post->story != false and $this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setIF(!$this->post->linkCase, 'linkCase', '') @@ -834,6 +835,7 @@ class testcaseModel extends model $now = helper::now(); $status = $this->getStatus('review', $oldCase); $case = fixer::input('post') + ->add('id', $caseID) ->remove('result,comment') ->setDefault('reviewedDate', substr($now, 0, 10)) ->setDefault('lastEditedBy', $this->app->user->account) @@ -946,6 +948,7 @@ class testcaseModel extends model foreach($caseIDList as $caseID) { $case = new stdclass(); + $case->id = $caseID; $case->lastEditedBy = $this->app->user->account; $case->lastEditedDate = $now; $case->pri = $data->pris[$caseID]; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 0e636d720a..b0a9708dca 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -150,6 +150,7 @@ class testsuiteModel extends model $oldSuite = $this->dao->select("*")->from(TABLE_TESTSUITE)->where('id')->eq((int)$suiteID)->fetch(); $suite = fixer::input('post') ->stripTags($this->config->testsuite->editor->edit['id'], $this->config->allowedTags) + ->add('id', $suiteID) ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', helper::now()) ->remove('uid') diff --git a/module/testtask/model.php b/module/testtask/model.php index 079992d200..b573fc2f85 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -734,8 +734,15 @@ class testtaskModel extends model public function update($taskID) { $oldTask = $this->dao->select("*")->from(TABLE_TESTTASK)->where('id')->eq((int)$taskID)->fetch(); - $task = fixer::input('post')->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags)->join('mailto', ',')->join('type', ',')->remove('files,labels,uid,comment,contactListMenu')->get(); + $task = fixer::input('post') + ->add('id') + ->stripTags($this->config->testtask->editor->edit['id'], $this->config->allowedTags) + ->join('mailto', ',') + ->join('type', ',') + ->remove('files,labels,uid,comment,contactListMenu') + ->get(); $task = $this->loadModel('file')->processImgURL($task, $this->config->testtask->editor->edit['id'], $this->post->uid); + $this->dao->update(TABLE_TESTTASK)->data($task) ->autoCheck() ->batchcheck($this->config->testtask->edit->requiredFields, 'notempty') @@ -743,6 +750,7 @@ class testtaskModel extends model ->checkFlow() ->where('id')->eq($taskID) ->exec(); + if(!dao::isError()) { $this->file->updateObjectID($this->post->uid, $taskID, 'testtask'); @@ -762,6 +770,7 @@ class testtaskModel extends model { $oldTesttask = $this->getById($taskID); $testtask = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'doing') ->remove('comment')->get(); @@ -784,6 +793,7 @@ class testtaskModel extends model { $oldTesttask = $this->getById($taskID); $testtask = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'done') ->stripTags($this->config->testtask->editor->close['id'], $this->config->allowedTags) ->join('mailto', ',') @@ -826,6 +836,7 @@ class testtaskModel extends model { $oldTesttask = $this->getById($taskID); $testtask = fixer::input('post') + ->add('id', $taskID) ->setDefault('status', 'blocked') ->remove('comment')->get(); From 5abbb45b15c3303ddf803c03ffded06637589640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E8=83=A1=E6=88=90?= Date: Mon, 9 May 2022 09:08:30 +0000 Subject: [PATCH 006/125] Update mail.class.php --- test/class/mail.class.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/class/mail.class.php b/test/class/mail.class.php index 2df85f2299..8b31b2cd3b 100644 --- a/test/class/mail.class.php +++ b/test/class/mail.class.php @@ -21,7 +21,7 @@ class mailTest * * @param int $email * @access public - * @return void + * @return object */ public function autoDetectTest($email) { @@ -39,7 +39,7 @@ class mailTest * @param int $domain * @param int $username * @access public - * @return void + * @return object */ public function getConfigFromProviderTest($domain, $username) { @@ -56,7 +56,7 @@ class mailTest * @param int $domain * @param int $username * @access public - * @return void + * @return object */ public function getConfigByMXRRTest($domain, $username) { @@ -74,7 +74,7 @@ class mailTest * @param int $username * @param int $port * @access public - * @return void + * @return object */ public function getConfigByDetectingSMTPTest($domain, $username, $port) { @@ -89,7 +89,7 @@ class mailTest * Set MTA. * * @access public - * @return void + * @return object */ public function setMTATest() { @@ -104,7 +104,7 @@ class mailTest * Set sendmail. * * @access public - * @return void + * @return object */ public function setSendMailTest() { @@ -126,7 +126,7 @@ class mailTest * @param int $includeMe * @param array $emails * @access public - * @return void + * @return object */ public function sendTest($toList, $subject, $body = '', $ccList = '', $includeMe = false, $emails = array()) { @@ -143,7 +143,7 @@ class mailTest * @param int $ccList * @param int $emails * @access public - * @return void + * @return object */ public function setCCTest($ccList, $emails) { @@ -157,7 +157,7 @@ class mailTest * * @param int $subject * @access public - * @return void + * @return object */ public function setSubjectTest($subject) { @@ -171,7 +171,7 @@ class mailTest * * @param int $body * @access public - * @return void + * @return object */ public function setBodyTest($body) { @@ -184,7 +184,7 @@ class mailTest * Mail exist. * * @access public - * @return void + * @return object */ public function mailExistTest() { @@ -204,7 +204,7 @@ class mailTest * @param string $ccList * @param int $includeMe * @access public - * @return void + * @return object */ public function addQueueTest($toList, $subject, $body = '', $ccList = '', $includeMe = false) { @@ -229,7 +229,7 @@ class mailTest * @param string $orderBy * @param int $pager * @access public - * @return void + * @return object */ public function getQueueTest($status = '', $orderBy = 'id_desc', $pager = null) { @@ -245,7 +245,7 @@ class mailTest * * @param int $queueID * @access public - * @return void + * @return object */ public function getQueueByIdTest($queueID) { @@ -261,7 +261,7 @@ class mailTest * * @param int $user * @access public - * @return void + * @return object */ public function mergeMailsTest($user) { @@ -285,7 +285,7 @@ class mailTest * @param int $title * @param int $actionType * @access public - * @return void + * @return object */ public function getSubjectTest($objectType, $object, $title, $actionType) { From 4bb2ff186278be5ffa65be69fd988588361ca088 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Tue, 10 May 2022 01:34:01 +0000 Subject: [PATCH 007/125] * Finish task #53670. --- module/custom/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/custom/config.php b/module/custom/config.php index ff9462b546..9b42284642 100644 --- a/module/custom/config.php +++ b/module/custom/config.php @@ -48,8 +48,8 @@ $config->custom->fieldList['release']['create'] = 'desc'; $config->custom->fieldList['release']['edit'] = 'desc'; $config->custom->fieldList['execution']['create'] = 'days,desc,PO,PM,QD,RD'; $config->custom->fieldList['execution']['edit'] = 'days,desc,PO,PM,QD,RD'; -$config->custom->fieldList['task']['create'] = 'story,pri,estimate,desc,estStarted,deadline'; -$config->custom->fieldList['task']['edit'] = 'pri,estimate,estStarted,deadline'; +$config->custom->fieldList['task']['create'] = 'module,story,pri,estimate,desc,estStarted,deadline'; +$config->custom->fieldList['task']['edit'] = 'module,pri,estimate,estStarted,deadline'; $config->custom->fieldList['task']['finish'] = 'comment'; $config->custom->fieldList['task']['activate'] = 'assignedTo,comment'; $config->custom->fieldList['build'] = 'scmPath,filePath,desc'; From 84ad06f3eca28ee82dac4f4eb0117641b75c4f7c Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 01:37:07 +0000 Subject: [PATCH 008/125] *task_sunjun_53672 --- module/release/view/create.html.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/module/release/view/create.html.php b/module/release/view/create.html.php index 8767c42c7a..70466f980c 100644 --- a/module/release/view/create.html.php +++ b/module/release/view/create.html.php @@ -75,10 +75,4 @@ - From f6f174df49abf420e08363d91e36b7d14f3d42e4 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 10 May 2022 09:42:00 +0800 Subject: [PATCH 009/125] * Add getprojectteamparams. --- test/class/block.class.php | 22 +++++++++++++++++++++- test/model/block/getprojectteamparams.php | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/test/class/block.class.php b/test/class/block.class.php index 361ec9ed9f..4e60bab388 100644 --- a/test/class/block.class.php +++ b/test/class/block.class.php @@ -254,7 +254,27 @@ class blockTest if(dao::isError()) return dao::getError(); - return $objects; + + $objects = json_decode($objects); + $return = ''; + foreach($objects as $type => $params) + { + $return .= "$type:{"; + foreach($params as $param => $paramValue) + { + if(is_object($paramValue)) + { + foreach($paramValue as $key => $value) $return .= "$key=>$value,"; + } + else + { + $return .= "$param:$paramValue,"; + } + } + $return = trim($return, ','); + $return .= '};'; + } + return $return; } /** diff --git a/test/model/block/getprojectteamparams.php b/test/model/block/getprojectteamparams.php index 056ec1c387..ef5c0e3349 100755 --- a/test/model/block/getprojectteamparams.php +++ b/test/model/block/getprojectteamparams.php @@ -10,10 +10,10 @@ title=测试 blockModel->getProjectTeamParams(); cid=1 pid=1 - +测试获取项目团队 >> type:{name:类型,all=>所有,doing=>进行中,wait=>未开始,suspended=>已挂起,closed=>已关闭,control:select};orderBy:{name:排序,id_asc=>ID 递增,id_desc=>ID 递减,status_asc=>状态正序,status_desc=>状态倒序,control:select};count:{name:数量,default:20,control:input}; */ $block = new blockTest(); -r($block->getProjectTeamParamsTest()) && p() && e(); \ No newline at end of file +r($block->getProjectTeamParamsTest()) && p() && e('type:{name:类型,all=>所有,doing=>进行中,wait=>未开始,suspended=>已挂起,closed=>已关闭,control:select};orderBy:{name:排序,id_asc=>ID 递增,id_desc=>ID 递减,status_asc=>状态正序,status_desc=>状态倒序,control:select};count:{name:数量,default:20,control:input};'); // 测试获取项目团队 From c3fdb74a24a8f66421bdec0c4d11d5082db841ea Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 10 May 2022 10:12:48 +0800 Subject: [PATCH 010/125] * Finish task #53668. --- module/execution/js/kanban.js | 45 ++++++++++++++++++----------------- module/kanban/control.php | 7 ++++++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index ff3a64f56c..8f9eed2557 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -328,6 +328,10 @@ if(!window.kanbanDropRules) { backlog: ['ready', 'backlog'], ready: ['backlog', 'ready'], + tested: ['verified'], + verified: ['tested', 'released'], + released: ['verified', 'closed'], + closed: ['released'], }, bug: { @@ -957,30 +961,27 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car /* Story lane. */ if(cardType == 'story') { - if(toColType == 'ready' || toColType == 'backlog') + if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') { - if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') - { - bootbox.alert(executionLang.storyDragError); - return false; - } - - var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy ); - $.ajax( - { - method: 'post', - dataType: 'json', - url: link, - success: function(data) - { - updateRegion(regionID, data[regionID]); - }, - error: function(xhr, status, error) - { - showErrorMessager(error || lang.timeout); - } - }); + bootbox.alert(executionLang.storyDragError); + return false; } + + var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy + '®ionID=' + regionID+ '&orderBy=' + orderBy ); + $.ajax( + { + method: 'post', + dataType: 'json', + url: link, + success: function(data) + { + updateRegion(regionID, data[regionID]); + }, + error: function(xhr, status, error) + { + showErrorMessager(error || lang.timeout); + } + }); } if(showIframe) diff --git a/module/kanban/control.php b/module/kanban/control.php index eeb922a87d..68b480869f 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1663,6 +1663,13 @@ class kanban extends control ->andWhere('`column`')->eq($toColID) ->exec(); + $toColumn = $this->kanban->getColumnByID($toColID); + if($toColumn->laneType == 'story' and in_array($toColumn->type, array('tested', 'verified', 'released', 'closed'))) + { + $stage = $toColumn->type; + $this->dao->update(TABLE_STORY)->set('stage')->eq($stage)->where('id')->eq($cardID)->exec(); + } + $kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $regionID, $groupBy); echo json_encode($kanbanGroup); } From 896e36c90c1d0bdf0e5b049057bc1876b72a985c Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 10 May 2022 10:50:02 +0800 Subject: [PATCH 011/125] * Finish task #53667. --- module/execution/js/taskkanban.js | 49 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 8df8beb996..6faa290fb2 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -480,6 +480,10 @@ if(!window.kanbanDropRules) { backlog: ['ready'], ready: ['backlog'], + tested: ['verified'], + verified: ['tested', 'released'], + released: ['verified', 'closed'], + closed: ['released'], }, bug: { @@ -495,7 +499,7 @@ if(!window.kanbanDropRules) { 'wait': ['developing', 'developed', 'canceled', 'closed'], 'developing': ['developed', 'pause', 'canceled'], - 'developed': ['closed'], + 'developed': ['developing', 'closed'], 'pause': ['developing'], 'canceled': ['developing'], 'closed': ['developing'], @@ -683,31 +687,28 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car /* Story lane. */ if(cardType == 'story') { - if(toColType == 'ready' || toColType == 'backlog') + if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') { - if(toColType == 'ready' && typeof(reviewStoryParis[objectID]) != 'undefined') - { - bootbox.alert(executionLang.storyDragError); - return false; - } - - var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy); - $.get(link, function(data) - { - if(data) - { - kanbanGroup = $.parseJSON(data); - if(groupBy == 'default') - { - updateKanban('story', kanbanGroup.story); - } - else - { - updateKanban(browseType, kanbanGroup[groupBy]); - } - } - }) + bootbox.alert(executionLang.storyDragError); + return false; } + + var link = createLink('kanban', 'ajaxMoveCard', 'cardID=' + objectID + '&fromColID=' + fromColID + '&toColID=' + toColID + '&fromLaneID=' + fromLaneID + '&toLaneID=' + toLaneID + '&execitionID=' + executionID + '&browseType=' + browseType + '&groupBy=' + groupBy); + $.get(link, function(data) + { + if(data) + { + kanbanGroup = $.parseJSON(data); + if(groupBy == 'default') + { + updateKanban('story', kanbanGroup.story); + } + else + { + updateKanban(browseType, kanbanGroup[groupBy]); + } + } + }); } if(showIframe) From 5c00aa823c43ef454b2b37c0f10c0ef70ba968fd Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 10 May 2022 11:24:17 +0800 Subject: [PATCH 012/125] * Modify language item error. --- module/execution/view/burn.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index 71da19f850..2d0bd26ae7 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -22,7 +22,7 @@
' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}{$lang->execution->burn}' class='btn btn-primary' id='computeBurn'"); + common::printLink('execution', 'computeBurn', 'reload=yes', ' ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'"); echo '
'; echo html::a($this->createLink('execution', 'burn', "executionID=$executionID&type=$weekend&interval=$interval"), $lang->execution->$weekend, '', "class='btn btn-link'"); if(common::canModify('execution', $execution)) common::printLink('execution', 'fixFirst', "execution=$execution->id", $lang->execution->fixFirst, '', "class='btn btn-link iframe' data-width='700'"); From 528fa4535787bcf20e3b7b8d372fe64feb2febc8 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 10 May 2022 05:13:35 +0000 Subject: [PATCH 013/125] * Fix bug. --- module/custom/model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/custom/model.php b/module/custom/model.php index aa725021d4..a8ffc88a32 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -251,7 +251,9 @@ class customModel extends model foreach($item['subMenu'] as $subMenu) { if(!isset($subMenu['link']) or strpos($subMenu['link'], '|') === false) continue; - list($subLabel, $module, $method, $vars) = explode('|', $subMenu['link']); + list($subLabel, $module, $method) = explode('|', $subMenu['link']); + if(count(explode('|', $subMenu['link'])) > 3) list($subLabel, $module, $method, $vars) = explode('|', $subMenu['link']); + $hasPriv = commonModel::hasPriv($module, $method); if($hasPriv) break; } From 39b77f36b6b2dadf5987e23c00e014d597ba3b14 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 10 May 2022 13:24:06 +0800 Subject: [PATCH 014/125] * Add codes for saas extension. --- framework/base/control.class.php | 8 +++++++- framework/base/model.class.php | 1 + framework/base/router.class.php | 26 ++++++++++++++++++++++++-- framework/control.class.php | 16 +++++++++++----- framework/router.class.php | 1 + 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/framework/base/control.class.php b/framework/base/control.class.php index c4d051fadb..1576843b29 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -416,7 +416,7 @@ class baseControl $moduleName = basename(dirname(dirname(realpath($viewFile)))); $extPath = $this->app->getModuleExtPath('', $moduleName, 'view'); - $checkedOrder = array('site', 'custom', 'vision', 'xuan', 'common'); + $checkedOrder = array('site', 'saas', 'custom', 'vision', 'xuan', 'common'); $fileName = basename($viewFile); foreach($checkedOrder as $checkedType) { @@ -805,6 +805,12 @@ class baseControl $commonActionExtFile = $actionExtPath['custom'] . strtolower($methodName) . '.php'; if(file_exists($commonActionExtFile)) $file2Included = $commonActionExtFile; + if(!empty($actionExtPath['saas'])) + { + $commonActionExtFile = $actionExtPath['saas'] . strtolower($methodName) . '.php'; + if(file_exists($commonActionExtFile)) $file2Included = $commonActionExtFile; + } + if(!empty($actionExtPath['site'])) { /** diff --git a/framework/base/model.class.php b/framework/base/model.class.php index 0dbb3372be..519def4741 100644 --- a/framework/base/model.class.php +++ b/framework/base/model.class.php @@ -260,6 +260,7 @@ class baseModel $moduleExtPath = $this->app->getModuleExtPath($this->appName, $moduleName, 'model'); if(!empty($moduleExtPath['site'])) $extensionFile = $moduleExtPath['site'] . 'class/' . $extensionName . '.class.php'; if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['custom'] . 'class/' . $extensionName . '.class.php'; + if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['saas'] . 'class/' . $extensionName . '.class.php'; if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['vision'] . 'class/' . $extensionName . '.class.php'; if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['xuan'] . 'class/' . $extensionName . '.class.php'; if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['common'] . 'class/' . $extensionName . '.class.php'; diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 1216e2f4a6..1a44b0585d 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -1390,6 +1390,9 @@ class baseRouter if($this->checkModuleName($moduleName)) { + $modulePath = $this->getExtensionRoot() . 'saas' . DS . $moduleName . DS; + if(is_dir($modulePath) and (file_exists($modulePath . 'control.php') or file_exists($modulePath . 'model.php'))) return $modulePath; + /* 1. 最后尝试在定制开发中寻找。 Finally, try to find the module in the custom dir. */ $modulePath = $this->getExtensionRoot() . 'custom' . DS . $moduleName . DS; if(is_dir($modulePath) and (file_exists($modulePath . 'control.php') or file_exists($modulePath . 'model.php'))) return $modulePath; @@ -1432,8 +1435,10 @@ class baseRouter */ public function getModuleExtPath($appName, $moduleName, $ext) { + $saasExtPath = $this->getExtensionRoot() . 'saas' . DS . $moduleName . DS . 'ext' . DS . $ext . DS; + /* 检查失败或者extensionLevel为0,直接返回空。If check failed or extensionLevel == 0, return empty array. */ - if(!$this->checkModuleName($moduleName) or $this->config->framework->extensionLevel == 0) return array(); + if(!$this->checkModuleName($moduleName) or $this->config->framework->extensionLevel == 0) return array('saas' => $saasExtPath); $paths = array(); @@ -1442,10 +1447,16 @@ class baseRouter $paths['xuan'] = $this->getExtensionRoot() . 'xuan' . DS . $moduleName . DS . 'ext' . DS . $ext . DS; $paths['vision'] = $this->config->vision == 'rnd' ? '' : $this->basePath . 'extension' . DS . $this->config->vision . DS . $moduleName . DS . 'ext' . DS . $ext . DS; $paths['custom'] = $this->getExtensionRoot() . 'custom' . DS . $moduleName . DS . 'ext' . DS . $ext . DS; - if($this->config->framework->extensionLevel == 1) return $paths; + if($this->config->framework->extensionLevel == 1) + { + $paths['saas'] = $saasExtPath; + return $paths; + } /* When extensionLevel == 2. */ $paths['site'] = empty($this->siteCode) ? '' : $this->getExtensionRoot() . $this->config->edition . DS . $moduleName . DS . 'ext' . DS . '_' . $this->siteCode . DS . $ext . DS; + $paths['saas'] = $saasExtPath; + return $paths; } @@ -1494,6 +1505,12 @@ class baseRouter /* 如果扩展目录为空,不包含任何扩展文件。If there's no ext paths return false.*/ if(empty($moduleExtPaths)) return false; + if(!empty( $moduleExtPaths['saas'])) + { + $this->extActionFile = $moduleExtPaths['saas'] . $this->methodName . '.php'; + if(file_exists($this->extActionFile)) return true; + } + /* 1. 如果extensionLevel == 2,且扩展文件存在,返回该站点扩展文件。 If extensionLevel == 2 and site extensionFile exists, return it. */ if($this->config->framework->extensionLevel == 2 and !empty( $moduleExtPaths['site'])) { @@ -2322,6 +2339,7 @@ class baseRouter if(!empty($extConfigPath['common'])) $commonExtConfigFiles = helper::ls($extConfigPath['common'], '.php'); if(!empty($extConfigPath['xuan'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['xuan'], '.php')); if(!empty($extConfigPath['vision'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['vision'], '.php')); + if(!empty($extConfigPath['saas'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['saas'], '.php')); if(!empty($extConfigPath['custom'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['custom'], '.php')); } if($config->framework->extensionLevel == 2 and !empty($extConfigPath['site'])) $siteExtConfigFiles = helper::ls($extConfigPath['site'], '.php'); @@ -2427,6 +2445,9 @@ class baseRouter { $path = $moduleName . DS . 'lang' . DS . $this->clientLang . '.php'; + $modulePath = $this->getExtensionRoot() . 'saas' . DS; + if(file_exists($modulePath . $path)) return $modulePath . $path; + /* 1. 如果通用版本里有此模块,优先使用。 If module is in the open edition, use it. */ $modulePath = $this->getModuleRoot($appName); if(file_exists($modulePath . $path)) return $modulePath . $path; @@ -2489,6 +2510,7 @@ class baseRouter if(!empty($extLangPath['xuan'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['xuan'] . $this->clientLang, '.php')); if(!empty($extLangPath['vision'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['vision'] . $this->clientLang, '.php')); if(!empty($extLangPath['custom'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['custom'] . $this->clientLang, '.php')); + if(!empty($extLangPath['saas'])) $commonExtLangFiles = array_merge($commonExtLangFiles, helper::ls($extLangPath['saas'] . $this->clientLang, '.php')); } if($this->config->framework->extensionLevel == 2 and !empty($extLangPath['site'])) $siteExtLangFiles = helper::ls($extLangPath['site'] . $this->clientLang, '.php'); $extLangFiles = array_merge($commonExtLangFiles, $siteExtLangFiles); diff --git a/framework/control.class.php b/framework/control.class.php index c7666ca0db..f10b4fe31d 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -86,7 +86,7 @@ class control extends baseControl /** * Det default priv by workflow. - * + * * @access public * @return bool */ @@ -197,6 +197,7 @@ class control extends baseControl $commonExtViewFile = $viewExtPath['common'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; $xuanExtViewFile = $viewExtPath['xuan'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; $visionExtViewFile = $viewExtPath['vision'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; + $saasExtViewFile = $viewExtPath['saas'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; $customExtViewFile = $viewExtPath['custom'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; $siteExtViewFile = empty($viewExtPath['site']) ? '' : $viewExtPath['site'] . $this->devicePrefix . $methodName . ".{$viewType}.php"; @@ -217,6 +218,10 @@ class control extends baseControl { $viewFile = $xuanExtViewFile; } + else if(file_exists($saasExtViewFile)) + { + $viewFile = $saasExtViewFile; + } else if(file_exists($commonExtViewFile)) { $viewFile = $commonExtViewFile; @@ -235,10 +240,11 @@ class control extends baseControl $commonExtHookFiles = glob($viewExtPath['vision'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); } $xuanExtHookFiles = glob($viewExtPath['xuan'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); + $saasExtHookFiles = glob($viewExtPath['saas'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); $customExtHookFiles = glob($viewExtPath['custom'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); $siteExtHookFiles = empty($viewExtPath['site']) ? '' : glob($viewExtPath['site'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); - $extHookFiles = array_merge((array)$commonExtHookFiles, (array)$xuanExtHookFiles, (array)$customExtHookFiles, (array)$siteExtHookFiles); + $extHookFiles = array_merge((array)$commonExtHookFiles, (array)$xuanExtHookFiles, (array)$saasExtHookFiles, (array)$customExtHookFiles, (array)$siteExtHookFiles); } if(!empty($extHookFiles)) return array('viewFile' => $viewFile, 'hookFiles' => $extHookFiles); @@ -342,9 +348,9 @@ class control extends baseControl } /** - * Set workflow export fields - * - * @param array $fields + * Set workflow export fields + * + * @param array $fields * @access public * @return array */ diff --git a/framework/router.class.php b/framework/router.class.php index 500761517b..3fb5136cfa 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -327,6 +327,7 @@ class router extends baseRouter if(!empty($extConfigPath['common'])) $commonExtConfigFiles = helper::ls($extConfigPath['common'], '.php'); if(!empty($extConfigPath['xuan'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['xuan'], '.php')); if(!empty($extConfigPath['vision'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['vision'], '.php')); + if(!empty($extConfigPath['saas'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['saas'], '.php')); if(!empty($extConfigPath['custom'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['custom'], '.php')); } if($config->framework->extensionLevel == 2 and !empty($extConfigPath['site'])) $siteExtConfigFiles = helper::ls($extConfigPath['site'], '.php'); From deb8d170a7426048873700475bf2c3224fa56431 Mon Sep 17 00:00:00 2001 From: daitingting Date: Tue, 10 May 2022 05:44:25 +0000 Subject: [PATCH 015/125] * Build operate menu for product. --- framework/control.class.php | 2 +- module/product/model.php | 31 +++++++++++++++++++++++++++++++ module/product/view/all.html.php | 12 ++---------- module/product/view/view.html.php | 16 +--------------- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index c7666ca0db..b61e4c580c 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -320,7 +320,7 @@ class control extends baseControl if(!isset($this->config->bizVersion)) return false; $moduleName = $this->moduleName; - if($moduleName == 'bug' || $moduleName == 'feedback') return $this->$moduleName->buildOperateMenu($object, $type); + if(strpos(',bug,feedback,product,', ",{$moduleName},") !== false) return $this->$moduleName->buildOperateMenu($object, $type); $flow = $this->loadModel('workflow')->getByModule($moduleName); return $this->loadModel('flow')->buildOperateMenu($flow, $object, $type); diff --git a/module/product/model.php b/module/product/model.php index 2f1239d04d..aa01af3093 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -2022,6 +2022,37 @@ class productModel extends model return true; } + /** + * Build operate menu. + * + * @param object $product + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($product, $type = 'view') + { + $menu = ''; + $params = "product=$product->id"; + + if($type == 'view') + { + $menu .= "
"; + $menu .= $this->buildFlowMenu('product', $product, $type, 'direct'); + $menu .= "
"; + + $menu .= $this->buildMenu('product', 'close', $params, $product, $type, '', '', '', '', "data-app='product'"); + $menu .= "
"; + } + + $menu .= $this->buildMenu('product', 'edit', $params, $product, $type); + + if($type == 'view') $menu .= $this->buildMenu('product', 'delete', $params, $product, $type, 'trash', 'hiddenwin'); + if($type == 'browse' && common::hasPriv('product', 'updateOrder')) $menu .= ""; + + return $menu; + } + /** * Create the link from module,method,extra,branch. * diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index 1365dd5449..25b5453e0b 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -32,10 +32,7 @@
' data-preserve-nested='false' data-expand-nest-child='true'> - + @@ -215,12 +212,7 @@ " . $this->loadModel('flow')->getFieldValue($extendField, $product) . "";?> - + diff --git a/module/product/view/view.html.php b/module/product/view/view.html.php index e05d64fdba..9dff1daa07 100644 --- a/module/product/view/view.html.php +++ b/module/product/view/view.html.php @@ -158,24 +158,10 @@
id"; $browseLink = $this->session->productList ? $this->session->productList : inlink('browse', "productID=$product->id"); common::printBack($browseLink); - if(!$product->deleted) - { - echo $this->buildOperateMenu($product, 'view'); - echo "
"; - - if($product->status != 'closed') - { - common::printIcon('product', 'close', $params, $product, 'button', '', '', 'iframe', true); - echo "
"; - } - - common::printIcon('product', 'edit', $params, $product); - common::printIcon('product', 'delete', $params, $product, 'button', 'trash', 'hiddenwin'); - } + if(!$product->deleted) echo $this->buildOperateMenu($product, 'view'); ?>
From c9bc2ba86fd6d31836cef1ed46b62177950a9474 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 10 May 2022 13:48:16 +0800 Subject: [PATCH 016/125] * code for task #53592. --- db/update16.5.sql | 166 +++++++++++++++++++++++++++++++++++++ module/execution/model.php | 3 +- 2 files changed, 168 insertions(+), 1 deletion(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index bb437efddd..aea256e55c 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -89,3 +89,169 @@ REPLACE INTO `zt_zoutput` (`id`, `activity`, `name`, `content`, `optional`, `sta DELETE FROM `zt_config` WHERE `section` = 'customMenu'; UPDATE `zt_story` SET `plan` = '' WHERE `plan` = 0; + +DELETE FROM `zt_workflowfield` WHERE `module`='execution' AND `field`='stage'; +DELETE FROM `zt_workflowfield` WHERE `module`='program' AND `field`='stage'; +DELETE FROM `zt_workflowfield` WHERE `module`='project' AND `field`='stage'; +DELETE FROM `zt_workflowfield` WHERE `module`='bug' AND `field`='feedback'; +DELETE FROM `zt_workflowfield` WHERE `module`='task' AND `field`='feedback'; +INSERT INTO `zt_workflowdatasource` (`type`, `name`, `code`, `buildin`, `datasource`, `view`, `keyField`, `valueField`) VALUES('lang', '项目模型', 'projectModel', '1', 'projectModel', '', '', ''); +REPLACE INTO `zt_workflowfield` (`module`, `field`, `type`, `length`, `name`, `control`, `expression`, `options`, `default`, `rules`, `placeholder`, `order`, `searchOrder`, `exportOrder`, `canExport`, `canSearch`, `isValue`, `readonly`, `buildin`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES +('execution', 'type', 'char', '30', '迭代类型', 'select', '', '16', 'sprint', '', '', 3, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'begin', 'date', '', '计划开始', 'date', '', '', '', '', '', 14, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'end', 'date', '', '计划完成', 'date', '', '', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'days', 'smallint', '5', '可用工作日', 'integer', '', '', '', '', '', 18, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'pri', 'enum', '', '优先级', 'select', '', '[1,2,3,4]', '1', '', '', 20, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'desc', 'text', '', '迭代描述', 'richtext', '', '', '', '', '', 21, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'openedDate', 'datetime', '', '创建日期', 'datetime', '', '', '', '', '', 27, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'closedDate', 'datetime', '', '关闭日期', 'datetime', '', '', '', '', '', 32, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'canceledDate', 'datetime', '', '取消日期', 'datetime', '', '', '', '', '', 34, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'acl', 'char', '30', '访问控制', 'select', '', '18', 'open', '', '', 41, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'whitelist', 'text', '', '白名单', 'multi-select', '', 'user', '', '', '', 42, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'deleted', 'enum', '', '已删除', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 47, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'type', 'char', '30', '类型', 'select', '', '16', 'sprint', '', '', 2, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'begin', 'date', '', '计划开始', 'date', '', '', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'end', 'date', '', '计划完成', 'date', '', '', '', '', '', 16, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'days', 'smallint', '5', '可用工作日', 'integer', '', '', '', '', '', 19, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'pri', 'enum', '', '优先级', 'select', '', '[1,2,3,4]', '1', '', '', 21, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'desc', 'text', '', '项目集描述', 'richtext', '', '', '', '', '', 22, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'openedDate', 'datetime', '', '创建日期', 'datetime', '', '', '', '', '', 28, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'closedDate', 'datetime', '', '关闭日期', 'datetime', '', '', '', '', '', 33, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'canceledDate', 'datetime', '', '取消日期', 'datetime', '', '', '', '', '', 35, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'whitelist', 'text', '', '白名单', 'multi-select', '', 'user', '', '', '', 43, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'deleted', 'enum', '', '已删除', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 48, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'type', 'char', '30', '项目类型', 'select', '', '16', 'sprint', '', '', 3, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'model', 'char', '30', '项目管理方式', 'input', '', '45', '', '', '', 2, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'name', 'varchar', '90', '项目名称', 'input', '', '', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'begin', 'date', '', '计划开始', 'date', '', '', '', '', '', 16, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'end', 'date', '', '计划完成', 'date', '', '', '', '', '', 17, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'days', 'smallint', '5', '可用工作日', 'integer', '', '', '', '', '', 20, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'pri', 'enum', '', '优先级', 'select', '', '[1,2,3,4]', '1', '', '', 22, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'desc', 'text', '', '项目描述', 'richtext', '', '', '', '', '', 23, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'openedDate', 'datetime', '', '创建日期', 'datetime', '', '', '', '', '', 29, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'closedDate', 'datetime', '', '关闭日期', 'datetime', '', '', '', '', '', 34, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'canceledDate', 'datetime', '', '取消日期', 'datetime', '', '', '', '', '', 36, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'acl', 'char', '30', '访问控制', 'select', '', '18', 'open', '', '', 43, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'whitelist', 'text', '', '项目白名单', 'multi-select', '', 'user', '', '', '', 44, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'deleted', 'enum', '', '已删除', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 49, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('build', 'project', 'mediumint', '8', '所属项目', 'select', '', '2', '0', '', '', 4, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('build', 'date', 'date', '', '打包日期', 'date', '', '', '', '', '', 9, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('build', 'desc', 'text', '', '描述', 'richtext', '', '', '', '', '', 13, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('build', 'deleted', 'enum', '', '已删除', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 14, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'project', 'mediumint', '8', '所属项目', 'select', '', '2', '0', '', '', 2, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'storyVersion', 'smallint', '6', '研发需求版本', 'integer', '', '', '1', '', '', 9, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'toTask', 'mediumint', '8', '转任务', 'select', '', '5', '0', '', '', 11, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'toStory', 'mediumint', '8', '转研发需求', 'select', '', '4', '0', '', '', 12, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'steps', 'mediumtext', '', '重现步骤', 'richtext', '', '', '', '', '', 22, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'activatedDate', 'datetime', '', '激活日期', 'datetime', '', '', '', '', '', 27, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'openedDate', 'datetime', '', '创建日期', 'datetime', '', '', '', '', '', 32, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'openedBuild', 'varchar', '255', '影响版本', 'multi-select', '', '10', '', '', '', 33, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'assignedDate', 'datetime', '', '指派日期', 'datetime', '', '', '', '', '', 35, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'deadline', 'date', '', '截止日期', 'date', '', '', '', '', '', 36, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'resolvedDate', 'datetime', '30', '解决日期', 'datetime', '', '', '', '', '', 40, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'closedDate', 'datetime', '', '关闭日期', 'datetime', '', '', '', '', '', 42, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'case', 'mediumint', '8', '相关用例', 'select', '', '41', '', '', '', 45, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'caseVersion', 'smallint', '6', '用例版本', 'integer', '', '', '', '', '', 46, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'lastEditedDate', 'datetime', '30', '修改日期', 'datetime', '', '', '', '', '', 58, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'deleted', 'enum', '', '已删除', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 59, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'project', 'mediumint', '8', '所属项目', 'select', '', '2', '0', '', '', 2, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'storyVersion', 'smallint', '6', '研发需求版本', 'integer', '', '', '1', '', '', 7, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'estimate', 'float ', '', '最初预计', 'decimal', '', '', '', '', '', 13, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'consumed', 'float ', '', '总计消耗', 'decimal', '', '', '', '', '', 14, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'left', 'float ', '', '预计剩余', 'decimal', '', '', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'deadline', 'date', '', '截止日期', 'date', '', '', '', '', '', 16, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'desc', 'text', '', '任务描述', 'richtext', '', '', '', '', '', 20, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'openedDate', 'datetime', '', '创建日期', 'datetime', '', '', '', '', '', 23, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'assignedDate', 'datetime', '30', '指派日期', 'datetime', '', '', '', '', '', 25, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'estStarted', 'date', '', '预计开始', 'date', '', '', '', '', '', 26, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'realStarted', 'date', '', '实际开始', 'date', '', '', '', '', '', 27, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'finishedDate', 'datetime', '', '实际完成', 'datetime', '', '', '', '', '', 29, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'canceledDate', 'datetime', '', '取消时间', 'datetime', '', '', '', '', '', 32, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'closedDate', 'datetime', '', '关闭时间', 'datetime', '', '', '', '', '', 34, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'lastEditedDate', 'datetime', '', '最后修改日期', 'datetime', '', '', '', '', '', 39, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'deleted', 'enum', '', '已删除', 'select', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 48, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'lifetime', 'char', '30', 'lifetime', 'input', '', '', '', '', '', 4, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'lifetime', 'char', '30', 'lifetime', 'input', '', '', '', '', '', 3, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'designVersion', 'smallint', '6', '设计版本', 'integer', '', '', '', '', '', 8, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'attribute', 'varchar', '30', 'attribute', 'input', '', '', '0', '', '', 5, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'percent', 'float', '', 'percent', 'input', '', '', '0', '', '', 6, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'milestone', 'enum', '', 'milestone', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 7, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'output', 'text', '', 'output', 'textarea', '', '', '', '', '', 8, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'auth', 'char', '30', 'auth', 'input', '', '', '', '', '', 9, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'path', 'varchar', '255', 'path', 'input', '', '', '0', '', '', 10, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'grade', 'tinyint', '3', 'grade', 'integer', '', '', '0', '', '', 11, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'realBegan', 'date', '', '实际开始日期', 'date', '', '', '', '', '', 16, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'realEnd', 'date', '', '实际完成日期', 'date', '', '', '', '', '', 17, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'version', 'smallint', '6', 'version', 'integer', '', '', '', '', '', 22, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'parentVersion', 'smallint', '6', 'parentVersion', 'integer', '', '', '', '', '', 23, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'planDuration', 'int', '11', 'planDuration', 'integer', '', '', '', '', '', 24, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'realDuration', 'int', '11', 'realDuration', 'integer', '', '', '', '', '', 25, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'openedVersion', 'varchar', '20', 'openedVersion', 'input', '', '', '', '', '', 28, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'lastEditedBy', 'varchar', '30', 'lastEditedBy', 'select', '', 'user', '', '', '', 29, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'lastEditedDate', 'datetime', '', 'lastEditedDate', 'datetime', '', '', '', '', '', 30, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'suspendedDate', 'date', '', 'suspendedDate', 'date', '', '', '', '', '', 35, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'vision', 'varchar', '10', 'vision', 'input', '', '', 'rnd', '', '', 44, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'displayCards', 'enum', '', 'displayCards', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 45, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('execution', 'fluidBoard', 'enum', '', 'fluidBoard', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 46, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'output', 'text', '', 'output', 'textarea', '', '', '', '', '', 9, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'auth', 'char', '30', 'auth', 'input', '', '', '', '', '', 10, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'path', 'varchar', '255', 'path', 'input', '', '', '0', '', '', 12, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'grade', 'tinyint', '3', 'grade', 'integer', '', '', '0', '', '', 13, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'realBegan', 'date', '', 'realBegan', 'date', '', '', '', '', '', 17, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'realEnd', 'date', '', 'realEnd', 'date', '', '', '', '', '', 18, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'version', 'smallint', '6', 'version', 'integer', '', '', '', '', '', 23, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'parentVersion', 'smallint', '6', 'parentVersion', 'integer', '', '', '', '', '', 24, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'planDuration', 'int', '11', 'planDuration', 'integer', '', '', '', '', '', 25, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'realDuration', 'int', '11', 'realDuration', 'integer', '', '', '', '', '', 26, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'openedVersion', 'varchar', '20', 'openedVersion', 'input', '', '', '', '', '', 29, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'lastEditedBy', 'varchar', '30', 'lastEditedBy', 'select', '', 'user', '', '', '', 30, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'lastEditedDate', 'datetime', '', 'lastEditedDate', 'datetime', '', '', '', '', '', 31, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'suspendedDate', 'date', '', 'suspendedDate', 'date', '', '', '', '', '', 36, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'vision', 'varchar', '10', 'vision', 'input', '', '', 'rnd', '', '', 45, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'displayCards', 'enum', '', 'displayCards', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 46, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('program', 'fluidBoard', 'enum', '', 'fluidBoard', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 47, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'lifetime', 'char', '30', '项目周期', 'input', '', '', '', '', '', 4, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'attribute', 'varchar', '30', '阶段类型', 'input', '', '', '0', '', '', 7, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'percent', 'float', '', '工作量占比', 'input', '', '', '0', '', '', 8, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'milestone', 'enum', '', '里程碑', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 9, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'output', 'text', '', '输出', 'textarea', '', '', '', '', '', 10, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'auth', 'char', '30', '权限控制', 'input', '', '', '', '', '', 11, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'path', 'varchar', '255', '路径', 'input', '', '', '0', '', '', 13, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'grade', 'tinyint', '3', '层级', 'integer', '', '', '0', '', '', 14, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'realBegan', 'date', '', '实际开始日期', 'date', '', '', '', '', '', 18, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'realEnd', 'date', '', '实际完成日期', 'date', '', '', '', '', '', 19, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'version', 'smallint', '6', '版本', 'integer', '', '', '', '', '', 24, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'parentVersion', 'smallint', '6', '父版本', 'integer', '', '', '', '', '', 25, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'planDuration', 'int', '11', '计划周期天数', 'integer', '', '', '', '', '', 26, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'realDuration', 'int', '11', '实际周期天数', 'integer', '', '', '', '', '', 27, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'openedVersion', 'varchar', '20', '创建版本', 'input', '', '', '', '', '', 30, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'lastEditedBy', 'varchar', '30', '最后编辑人', 'select', '', 'user', '', '', '', 31, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'lastEditedDate', 'datetime', '', '最后编辑日期', 'datetime', '', '', '', '', '', 32, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'suspendedDate', 'date', '', 'suspendedDate', 'date', '', '', '', '', '', 37, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'vision', 'varchar', '10', 'vision', 'input', '', '', 'rnd', '', '', 46, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'displayCards', 'enum', '', 'displayCards', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 47, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('project', 'fluidBoard', 'enum', '', 'fluidBoard', 'radio', '', '[\"\\u672a\\u5220\\u9664\",\"\\u5df2\\u5220\\u9664\"]', '0', '', '', 48, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'hardware', 'varchar', '30', '硬件', 'input', '', '', '', '', '', 20, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'feedbackBy', 'varchar', '100', '反馈者', 'input', '', '', '', '', '', 28, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'notifyEmail', 'varchar', '100', '通知邮箱', 'input', '', '', '', '', '', 29, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'result', 'mediumint', '8', '结果', 'input', '', '', '', '', '', 47, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'repo', 'mediumint', '8', '所属版本库', 'input', '', '', '', '', '', 48, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'mr', 'mediumint', '8', 'mr', 'input', '', '', '', '', '', 49, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'entry', 'text', '', 'entry', 'input', '', '', '', '', '', 50, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'lines', 'varchar', '10', '代码行', 'input', '', '', '', '', '', 51, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'v1', 'varchar', '40', '版本1', 'input', '', '', '', '', '', 52, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'v2', 'varchar', '40', '版本2', 'input', '', '', '', '', '', 53, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'repoType', 'varchar', '30', '版本库类型', 'input', '', '', '', '', '', 54, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('bug', 'issueKey', 'varchar', '50', 'issueKey', 'input', '', '', '', '', '', 55, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'version', 'smallint', '6', '版本', 'integer', '', '', '', '', '', 21, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'planDuration', 'int', '11', '计划持续天数', 'integer', '', '', '', '', '', 35, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'realDuration', 'int', '11', '实际持续天数', 'integer', '', '', '', '', '', 36, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'activatedDate', 'datetime', '', '激活日期', 'datetime', '', '', '', '', '', 40, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'repo', 'mediumint', '8', 'repo', 'input', '', '', '', '', '', 41, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'mr', 'mediumint', '8', 'mr', 'input', '', '', '', '', '', 42, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'entry', 'text', '', 'entry', 'input', '', '', '', '', '', 43, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'lines', 'varchar', '10', 'lines', 'input', '', '', '', '', '', 44, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'v1', 'varchar', '40', 'v1', 'input', '', '', '', '', '', 45, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'v2', 'varchar', '40', 'v2', 'input', '', '', '', '', '', 46, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'), +('task', 'vision', 'varchar', '10', 'vision', 'input', '', '', 'rnd', '', '', 47, 0, 0, '0', '0', '0', '1', 1, '', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00'); +UPDATE `zt_workflowfield` SET `options`=(SELECT id FROM `zt_workflowdatasource` WHERE `code`='projectModel' LIMIT 1) WHERE `module`='project' AND `field`='model'; diff --git a/module/execution/model.php b/module/execution/model.php index 4d2e28feba..507ddfe98a 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2819,8 +2819,9 @@ class executionModel extends model ->where('execution')->in(array_keys($executions)) ->andWhere('deleted')->eq('0') ->andWhere('parent')->ge('0') - ->andWhere('status')->eq('done') + ->andWhere('status', true)->eq('done') ->orWhere('status')->eq('closed') + ->markRight(1) ->groupBy('execution') ->fetchAll('execution'); $storyPoints = $this->dao->select('t1.project, sum(t2.estimate) AS `storyPoint`')->from(TABLE_PROJECTSTORY)->alias('t1') From 4e2de99018e7a692cc599967d930041c00d656c3 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 10 May 2022 14:25:01 +0800 Subject: [PATCH 017/125] * Stages of updating trunk stories. --- module/kanban/control.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/kanban/control.php b/module/kanban/control.php index 68b480869f..dc2091238f 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1668,6 +1668,7 @@ class kanban extends control { $stage = $toColumn->type; $this->dao->update(TABLE_STORY)->set('stage')->eq($stage)->where('id')->eq($cardID)->exec(); + $this->dao->update(TABLE_STORYSTAGE)->set('stage')->eq($stage)->where('story')->eq($cardID)->exec(); } $kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $regionID, $groupBy); From fe927b1e5ec673f70850b809bedfd64f4a18fce2 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 10 May 2022 06:27:22 +0000 Subject: [PATCH 018/125] * Finish task #53593. --- db/update16.5.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/db/update16.5.sql b/db/update16.5.sql index bb437efddd..47c6e3031c 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -89,3 +89,17 @@ REPLACE INTO `zt_zoutput` (`id`, `activity`, `name`, `content`, `optional`, `sta DELETE FROM `zt_config` WHERE `section` = 'customMenu'; UPDATE `zt_story` SET `plan` = '' WHERE `plan` = 0; + +UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` = 'testcase' and `field` IN ('openedDate','reviewedDate','lastEditedDate','lastRunDate'); +UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'testcase' and `field` = 'lib'; + +UPDATE `zt_workflowfield` set `control` = 'date' WHERE `module` = 'testtask' and `field` IN ('begin','end'); +UPDATE `zt_workflowfield` set `control` = 'richtext' WHERE `module` = 'testtask' and `field` = 'desc'; + +UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` IN ('testsuite','caselib') and `field` IN ('addedDate','lastEditedDate'); +UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'testsuite' and `field` = 'type'; +UPDATE `zt_workflowfield` set `control` = 'richtext' WHERE `module` = 'testsuite' and `field` = 'desc'; + +UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` = 'feedback' and `field` IN ('openedDate','reviewedDate','processedDate','closedDate','editedDate','assignedDate'); +UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'feedback' and `field` IN ('public','notify'); + From 631601a39bbbddcd5f2c0b7ed794699b62f8f88b Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 06:42:34 +0000 Subject: [PATCH 019/125] sprint_sunjun_53665 --- module/execution/control.php | 12 +++++++++++- module/execution/view/ajaxgetdropmenu.html.php | 17 +++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 25f8e63cb8..be01e4169e 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3148,7 +3148,16 @@ class execution extends control } $projectExecutions = array(); - foreach($orderedExecutions as $execution) $projectExecutions[$execution->project][] = $execution; + $parentIdList = array(); + foreach($orderedExecutions as $execution) + { + $projectExecutions[$execution->project][] = $execution; + if($execution->type != 'stage') continue; + if($execution->grade == 2 and $execution->project != $execution->parent) $parentIdList[$execution->parent] = $execution->parent; + } + + $parents = array(); + if($parentIdList) $parents = $this->execution->getByIdList($parentIdList); $this->view->link = $this->execution->getLink($module, $method, $extra); $this->view->module = $module; @@ -3157,6 +3166,7 @@ class execution extends control $this->view->extra = $extra; $this->view->projects = $projectPairs; $this->view->executions = $projectExecutions; + $this->view->parents = $parents; $this->display(); } diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php index 5d014e6ce1..f5c2d77aa6 100644 --- a/module/execution/view/ajaxgetdropmenu.html.php +++ b/module/execution/view/ajaxgetdropmenu.html.php @@ -46,7 +46,12 @@ foreach($executions as $projectID => $projectExecutions) if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) $executionCounts[$projectID]['myExecution'] ++; if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account])) $executionCounts[$projectID]['others'] ++; if($execution->status == 'done' or $execution->status == 'closed') $executionCounts[$projectID]['closed'] ++; - $executionNames[] = $execution->name; + $onlyChildStage = $execution->grade == 2 and $execution->project != $execution->parent; + $executionNames[$execution->id] = $execution->name; + if($onlyChildStage and isset($parents[$execution->parent])) + { + $executionNames[$execution->id] = $parents[$execution->parent]->name . '/' . $execution->name; + } } } $executionsPinYin = common::convert2Pinyin($executionNames); @@ -77,7 +82,7 @@ foreach($executions as $projectID => $projectExecutions) $selected = $execution->id == $executionID ? 'selected' : ''; if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) { - $myExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $execution->name, '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; + $myExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; if($selected == 'selected') $tabActive = 'myExecution'; @@ -85,7 +90,7 @@ foreach($executions as $projectID => $projectExecutions) } else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account])) { - $normalExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $execution->name, '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; + $normalExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; if($selected == 'selected') $tabActive = 'other'; @@ -93,7 +98,7 @@ foreach($executions as $projectID => $projectExecutions) } else if($execution->status == 'done' or $execution->status == 'closed') { - $closedExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $execution->name, '', "class='$selected clickable' title='$execution->name' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; + $closedExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='$execution->name' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; if($selected == 'selected') $tabActive = 'closed'; } @@ -171,7 +176,7 @@ $(function() $('li.has-list div.hide-in-search').removeClass('hidden'); $('.nav-tabs li.active').find('span').show(); } - + if($('.form-control.search-input').val().length > 0) { $('#closed').attr("hidden", false); @@ -191,7 +196,7 @@ $(function() $('#closed').attr("hidden", true); $('#gray-line').attr("hidden", true); } - + var listItem = $(this).find('.has-list'); listItem.each(function () { From bd25917679a80ee691d2ce9cd823d93371534134 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2022 15:17:21 +0800 Subject: [PATCH 020/125] Add gitlab-ci and sonar properties files for ci --- .gitlab-ci.yml | 13 +++++++++++++ sonar-project.properties | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 sonar-project.properties diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..319fd640ef --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,13 @@ +sonarqube: + variables: + SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache + GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task + cache: + key: "${CI_JOB_NAME}" + paths: + - .sonar/cache + script: + - sonar-scanner -Dsonar.inclusions=$(git diff --name-only HEAD~1|tr '\n' ',') + allow_failure: true + only: + - master # or the name of your main branch diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..53903424ea --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,3 @@ +sonar.projectKey=zentaopms +sonar.qualitygate.wait=true +sonar.coverage.exclusions=**/*.* From 1b5b443174be469f682053478e26d5f3a3ee411d Mon Sep 17 00:00:00 2001 From: lanzongjun Date: Tue, 10 May 2022 15:28:18 +0800 Subject: [PATCH 021/125] * fix task #53591 --- db/update16.5.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/db/update16.5.sql b/db/update16.5.sql index bb437efddd..541c049f9d 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -89,3 +89,17 @@ REPLACE INTO `zt_zoutput` (`id`, `activity`, `name`, `content`, `optional`, `sta DELETE FROM `zt_config` WHERE `section` = 'customMenu'; UPDATE `zt_story` SET `plan` = '' WHERE `plan` = 0; + +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'product' and `field` = 'createdDate'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'productplan' and `field` = 'begin'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'productplan' and `field` = 'end'; +UPDATE `zt_workflowfield` SET `control` = 'radio' WHERE `module` = 'productplan' and `field` = 'deleted'; +UPDATE `zt_workflowfield` SET `control` = 'select', `options` = 12 WHERE `module` = 'productplan' and `field` = 'parent'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'release' and `field` = 'date'; +UPDATE `zt_workflowfield` SET `control` = 'richtext' WHERE `module` = 'release' and `field` = 'desc'; +UPDATE `zt_workflowfield` SET `control` = 'radio' WHERE `module` = 'release' and `field` = 'deleted'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'story' and `field` = 'assignedDate'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'story' and `field` = 'lastEditedDate'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'story' and `field` = 'reviewedDate'; +UPDATE `zt_workflowfield` SET `control` = 'date' WHERE `module` = 'story' and `field` = 'closedDate'; +UPDATE `zt_workflowfield` SET `control` = 'radio' WHERE `module` = 'story' and `field` = 'deleted'; From c5ee9d98735288a1ac0b4c854ff587ab5444fb44 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 10 May 2022 15:35:32 +0800 Subject: [PATCH 022/125] * Finish task #53663. --- module/kanban/control.php | 8 +- module/kanban/css/view.css | 4 +- module/kanban/js/view.js | 158 ++++++++++--------- module/kanban/model.php | 7 +- module/kanban/view/viewarchivedcard.html.php | 42 +++++ 5 files changed, 143 insertions(+), 76 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index eeb922a87d..a18e14e40d 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1320,8 +1320,14 @@ class kanban extends control { $region = $this->kanban->getRegionByID($regionID); + $cards = $this->kanban->getCardsByObject('region', $regionID, 1); + foreach($this->config->kanban->fromType as $fromType) + { + $cards = $this->kanban->getImportedCards($region->kanban, $cards, $fromType, 1); + } + $this->view->kanban = $this->kanban->getByID($region->kanban); - $this->view->cards = $this->kanban->getCardsByObject('region', $regionID, 1); + $this->view->cards = $cards; $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $this->view->userIdPairs = $this->user->getPairs('noletter|nodeleted|showid'); $this->view->usersAvatar = $this->user->getAvatarPairs(); diff --git a/module/kanban/css/view.css b/module/kanban/css/view.css index 52ff8d0e5b..313bd267e2 100644 --- a/module/kanban/css/view.css +++ b/module/kanban/css/view.css @@ -121,13 +121,13 @@ .label-closed, .label-terminate {background: #e5e5e5 !important; color: #b8b8b8;} .label-deleted {background: #ff5d5d !important; color: #fff;} .label-normal {background: #e1e8d9 !important; color: #9abe76;} -.kanban-item > .kanban-card > .execInfo > .user, .kanban-item > .kanban-card > .releaseInfo > .user, .kanban-item > .kanban-card > .productplanInfo > .user {position: absolute; right: 13px; bottom: 1px} +.kanban-item > .kanban-card > .execInfo > .user, .kanban-item > .kanban-card > .releaseInfo > .user, .kanban-item > .kanban-card > .productplanInfo > .user {float:right} .kanban-item > .kanban-card > .execInfo > .user > .avatar, .kanban-item > .kanban-card > .releaseInfo > .user > .avatar, .kanban-item > .kanban-card > .productplanInfo > .user > .avatar {display: inline-block; width: 24px; height: 24px; line-height: 24px; margin-right: 0px; margin-left: 2px} .kanban-card .releaseTitle .icon, .kanban-card .title .icon, .kanban-card .productplanTitle .icon, .kanban-card .title .icon, .kanban-card .buildTitle .icon{padding-right: 5px;} .kanban-card .label-finish {margin-right: 7px; margin-top: -1px; padding: 3px 5px; float: left; background-color:#2a5f29;} .kanban-card .releaseTitle, .kanban-card .productplanTitle {width: 100%; float: left;} -.progress-box {display: flex; flex-direction: row; margin-top: 10px;} +.progress-box {width:100%; display: flex; flex-direction: row; margin-top: 10px;} .progress {flex: auto; margin: 5px auto 5px;} .progress-number {padding-left: 5px;} diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index 0d0b723b39..a7e66e4e40 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -278,6 +278,22 @@ function renderKanbanItem(item, $item) var whiteStyle = null; if(item.color == '#2a5f29' || item.color == '#b10b0b' || item.color == '#cfa227') whiteStyle = 'style="color:#FFFFFF"'; + var privs = item.actions; + var printMoreBtn = (privs.includes('editCard') || privs.includes('archiveCard') || privs.includes('copyCard') || privs.includes('deleteCard') || privs.includes('moveCard') || privs.includes('setCardColor')); + var $actions = $item.children('.actions'); + var $title = $item.children('.title'); + if(printMoreBtn && !$actions.length) + { + $( + [ + '
    ', + '', + '', + '', + '
    ' + ].join('')).appendTo($item); + } + if(item.fromType == 'execution') { renderExecutionItem(item, $item); @@ -296,53 +312,13 @@ function renderKanbanItem(item, $item) } else { - var $title = $item.children('.title'); - var privs = item.actions; - var printMoreBtn = (privs.includes('editCard') || privs.includes('archiveCard') || privs.includes('copyCard') || privs.includes('deleteCard') || privs.includes('moveCard') || privs.includes('setCardColor')); - - if(privs.includes('sortCard')) $item.parent().addClass('sort'); if(!$title.length) { - $('
    ' + kanbanLang.finished + '
    ').appendTo($item); if(privs.includes('viewCard')) $title = $('').appendTo($item).attr('href', createLink('kanban', 'viewCard', 'cardID=' + item.id, '', true)); if(!privs.includes('viewCard')) $title = $('

    ').appendTo($item); } $title.text(item.name).attr('title', item.name); - if(kanban.performable == 1 && item.status == 'done' ) - { - var finishColor = '#2a5f29'; - if(item.color == '#2a5f29') finishColor = '#FFFFFF'; - $title.text(item.name).css('color', finishColor); - $item.children('.label-finish').show(); - if(item.color == '#2a5f29') - { - $item.children('.label-finish').css({'background-color':'#FFFFFF','color':'#2a5f29'}); - } - else - { - $item.children('.label-finish').css({'background-color':'','color':'#FFFFFF'}); - } - } - else - { - $title.text(item.name).css('color', ''); - $item.children('.label-finish').hide(); - } - - var $actions = $item.children('.actions'); - if(printMoreBtn && !$actions.length) - { - $( - [ - '
    ', - '', - '', - '', - '
    ' - ].join('')).appendTo($item); - } - var $info = $item.children('.info'); if(!$info.length) $info = $( [ @@ -353,11 +329,6 @@ function renderKanbanItem(item, $item) '
    ', '' ].join('')).appendTo($item); - if(kanban.performable == 1) - { - var $progress = $item.children('.progress-box'); - if(!$progress.length) $progress = $('
    ' + item.progress + '%
    ').appendTo($item); - } $item.data('card', item); @@ -367,15 +338,6 @@ function renderKanbanItem(item, $item) $info.children('.pri') .attr('class', 'pri label-pri label-pri-' + item.pri) .text(item.pri); - if(kanban.performable == 1) - { - $progress.find('.progress-bar').css('width', item.progress + '%'); - $progress.find('.progress-number').html(item.progress + '%'); - } - - $item.css('background-color', item.color); - $item.toggleClass('has-color', item.color != '#fff' && item.color != ''); - $item.find('.info > .label-light').css('background-color', item.color); var $time = $info.children('.time'); if(item.end == '0000-00-00' && item.begin == '0000-00-00') @@ -413,6 +375,41 @@ function renderKanbanItem(item, $item) for(i = 0; i < assignedTo.length; i++) title.push(users[assignedTo[i]]); $user.html(renderUsersAvatar(assignedTo, item.id)).attr('title', title); } + + if(kanban.performable == 1) + { + var $progress = $item.children('.progress-box'); + if(!$progress.length) $progress = $('
    ' + item.progress + '%
    ').appendTo($item); + $progress.find('.progress-bar').css('width', item.progress + '%'); + $progress.find('.progress-number').html(item.progress + '%'); + } + $item.css('background-color', item.color); + $item.toggleClass('has-color', item.color != '#fff' && item.color != ''); + $item.find('.info > .label-light').css('background-color', item.color); + + $title = item.fromType == 'execution' ? $item.children('.header').children('.executionName').children('.title') : $item.children('.title'); + if(!$title.children('.label-finish').length) $title.prepend('
    ' + kanbanLang.finished + '
    '); + var name = item.title ? item.title : item.name; + if(kanban.performable == 1 && item.status == 'done' ) + { + var finishColor = '#2a5f29'; + if(item.color == '#2a5f29') finishColor = '#FFFFFF'; + $title.css('color', finishColor); + $title.children('.label-finish').show(); + if(item.color == '#2a5f29') + { + $item.children('.label-finish').css({'background-color':'#FFFFFF','color':'#2a5f29'}); + } + else + { + $item.children('.label-finish').css({'background-color':'','color':'#FFFFFF'}); + } + } + else + { + $title.css('color', ''); + $title.children('.label-finish').hide(); + } } /** @@ -445,14 +442,19 @@ function renderExecutionItem(item, $item) /* Print execution name. */ var $title = $titleBox.children('.title'); + var name = item.title ? item.title : item.name; if(!$title.length) { var icon = mode == 'new' ? 'run' : 'project'; var viewMethod = item.execType == 'kanban' ? 'kanban' : 'view'; - if(privs.includes('viewExecution') && item.deleted == '0') $title = $('' + item.name + '').appendTo($titleBox).attr('href', createLink('execution', viewMethod, 'executionID=' + item.fromID)); - if(!privs.includes('viewExecution') || item.deleted == '1') $title = $('
    ' + item.name + '
    ').appendTo($titleBox); + if(privs.includes('viewExecution') && item.deleted == '0') $title = $('' + name + '').appendTo($titleBox).attr('href', createLink('execution', viewMethod, 'executionID=' + item.fromID)); + if(!privs.includes('viewExecution') || item.deleted == '1') $title = $('
    ' + name + '
    ').appendTo($titleBox); } - $title.attr('title', item.name); + if(!$title.children('i').length) + { + $title.append('' + item.title); + } + $title.attr('title', name); if(item.delay) { @@ -477,7 +479,7 @@ function renderExecutionItem(item, $item) { if(item.deleted == '0') { - $statusBox = $('' + executionLang.statusList[item.status] + '').appendTo($info); + $statusBox = $('' + executionLang.statusList[item.objectStatus] + '').appendTo($info); } else { @@ -519,12 +521,17 @@ function renderReleaseItem(item, $item) /* Print name. */ var $title = $item.children('.releaseTitle'); + var name = item.title ? item.title : item.name; if(!$title.length) { - if(privs.includes('viewRelease') && item.deleted == '0') $title = $('' + item.name + '').appendTo($item).attr('href', createLink('release', 'view', 'releaseID=' + item.fromID)); - if(!privs.includes('viewRelease') || item.deleted == '1') $title = $('
    ' + item.name + '
    ').appendTo($item); + if(privs.includes('viewRelease') && item.deleted == '0') $title = $('' + name + '').appendTo($item).attr('href', createLink('release', 'view', 'releaseID=' + item.fromID)); + if(!privs.includes('viewRelease') || item.deleted == '1') $title = $('
    ' + name + '
    ').appendTo($item); } - $title.attr('title', item.name); + if(!$title.children('i').length) + { + $title.prepend(''); + } + $title.attr('title', name); var $info = $item.children('.releaseInfo'); if(!$info.length) $info = $( @@ -538,7 +545,7 @@ function renderReleaseItem(item, $item) { if(item.deleted == '0') { - $statusBox = $('' + releaseLang.statusList[item.status] + '').appendTo($info); + $statusBox = $('' + releaseLang.statusList[item.objectStatus] + '').appendTo($info); } else { @@ -578,10 +585,15 @@ function renderProductplanItem(item, $item) /* Print name. */ var $title = $item.children('.productplanTitle'); + var name = item.title ? item.title : item.name; if(!$title.length) { - if(privs.includes('viewPlan') && item.deleted == '0') $title = $('' + item.title + '').appendTo($item).attr('href', createLink('productplan', 'view', 'productplanID=' + item.fromID)); - if(!privs.includes('viewPlan') || item.deleted == '1') $title = $('
    ' + item.title + '
    ').appendTo($item); + if(privs.includes('viewPlan') && item.deleted == '0') $title = $('' + name + '').appendTo($item).attr('href', createLink('productplan', 'view', 'productplanID=' + item.fromID)); + if(!privs.includes('viewPlan') || item.deleted == '1') $title = $('
    ' + name + '
    ').appendTo($item); + } + if(!$title.children('i').length) + { + $title.append('' + name); } $title.attr('title', item.title); @@ -597,7 +609,7 @@ function renderProductplanItem(item, $item) { if(item.deleted == '0') { - $statusBox = $('' + productplanLang.statusList[item.status] + '').appendTo($info); + $statusBox = $('' + productplanLang.statusList[item.objectStatus] + '').appendTo($info); } else { @@ -646,12 +658,17 @@ function renderBuildItem(item, $item) /* Print name. */ var $title = $item.children('.buildTitle'); + var name = item.title ? item.title : item.name; if(!$title.length) { - if(privs.includes('viewBuild') && item.deleted == '0') $title = $('' + item.name + '').appendTo($item).attr('href', createLink('build', 'view', 'buildID=' + item.fromID)); - if(!privs.includes('viewBuild') || item.deleted == '1') $title = $('
    ' + item.name + '
    ').appendTo($item); + if(privs.includes('viewBuild') && item.deleted == '0') $title = $('' + name + '').appendTo($item).attr('href', createLink('build', 'view', 'buildID=' + item.fromID)); + if(!privs.includes('viewBuild') || item.deleted == '1') $title = $('
    ' + name + '
    ').appendTo($item); } - $title.attr('title', item.name); + if(!$title.children('i').length) + { + $title.append('' + item.title); + } + $title.attr('title', name); var $info = $item.children('.info'); if(!$info.length) $info = $( @@ -1081,9 +1098,6 @@ function createCardMenu(options) items.push({label: kanbanLang.finishCard, icon: 'checked', onClick: function(){finishCard(card.id, card.kanban, card.region);}}); } } - if(privs.includes('archiveCard') && kanban.archived == '1') items.push({label: kanbanLang.archiveCard, icon: 'card-archive', url: createLink('kanban', 'archiveCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); - if(privs.includes('copyCard')) items.push({label: kanbanLang.copyCard, icon: 'copy', url: createLink('kanban', 'copyCard', 'cardID=' + card.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal'}}); - if(privs.includes('deleteCard')) items.push({label: kanbanLang.deleteCard, icon: 'trash', url: createLink('kanban', 'deleteCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); if(privs.includes('moveCard')) { var moveCardItems = []; @@ -1107,6 +1121,7 @@ function createCardMenu(options) moveCardItems = moveCardItems.reverse(); items.push({label: kanbanLang.moveCard, icon: 'move', items: moveCardItems}); } + if(privs.includes('archiveCard') && kanban.archived == '1') items.push({label: kanbanLang.archiveCard, icon: 'card-archive', url: createLink('kanban', 'archiveCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); if(privs.includes('setCardColor')) { var cardColoritems = []; @@ -1120,6 +1135,7 @@ function createCardMenu(options) }; items.push({label: kanbanLang.cardColor, icon: 'color', items: cardColoritems}); } + if(privs.includes('deleteCard')) items.push({label: kanbanLang.deleteCard, icon: 'trash', url: createLink('kanban', 'deleteCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); items.$options = {x: bounds.right, y: bounds.top}; diff --git a/module/kanban/model.php b/module/kanban/model.php index 78ad667080..b3f439b886 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1113,16 +1113,17 @@ class kanbanModel extends model * @param int $kanbanID * @param object $cards * @param string $fromType + * @param int $archived * @access public * @return array */ - public function getImportedCards($kanbanID, $cards, $fromType) + public function getImportedCards($kanbanID, $cards, $fromType, $archived = 0) { /* Get imported cards based on imported object type. */ $objectCards = $this->dao->select('*')->from(TABLE_KANBANCARD) ->where('deleted')->eq(0) ->andWhere('kanban')->eq($kanbanID) - ->andWhere('archived')->eq(0) + ->andWhere('archived')->eq($archived) ->andWhere('fromType')->eq($fromType) ->fetchGroup('fromID', 'id'); @@ -1168,6 +1169,8 @@ class kanbanModel extends model $objectCard->execType = $object->type; } + $objectCard->objectStatus = $objectCard->status; + $objectCard->status = $objectCard->progress == 100 ? 'done' : 'doing'; $cards[$cardID] = $objectCard; } } diff --git a/module/kanban/view/viewarchivedcard.html.php b/module/kanban/view/viewarchivedcard.html.php index 551ca80854..107abd4988 100644 --- a/module/kanban/view/viewarchivedcard.html.php +++ b/module/kanban/view/viewarchivedcard.html.php @@ -31,6 +31,7 @@ #archivedCards .info > .users > span:after {right: -4px; content: ''; display: block; position: absolute; width: 2px; height: 2px; background-color: #8990a2; top: 0px; border-radius: 50%;} #archivedCards .info > .users .avatar {display: inline-block; position: relative; border-radius: 50%; top: -5px; margin: 5px; right: -7px; margin-left: -4px;} #archivedCards .cardName {word-wrap: break-word;} +#archivedCards .card-item .icon {margin-right:2px;} #archivedCards .card-item .red {background-color: #b10b0b;} #archivedCards .card-item .yellow {background-color: #cfa227;} #archivedCards .card-item .green {background-color: #2a5f29;} @@ -44,6 +45,12 @@ #archivedCards .progress-box {width: 97%;} #performable {padding: 25px 10px !important;} +loadLang('execution'); +$app->loadLang('release'); +$app->loadLang('build'); +$app->loadLang('productplan'); +?>
    kanban->archivedCard;?> @@ -76,10 +83,33 @@ status == 'done'):?>
    kanban->finished;?>
    + fromType)):?> createLink('kanban', 'viewCard', "cardID=$card->id", '', true), $card->name, '', "class='cardName iframe' data-toggle='modal' data-width='80%' title='$card->name'");?>
    pri;?> estimate and $card->estimate != 0) echo "{$card->estimate}h";?> + fromType == 'productplan'):?> + createLink('productplan', 'view', "id=$card->fromID"), $card->title, '', "class='cardName' title='$card->title'");?> +
    + {$card->fromType}->statusList[$card->objectStatus];?> + fromType == 'release'):?> + createLink('release', 'view', "id=$card->fromID"), $card->name, '', "class='cardName' title='$card->name'");?> +
    + {$card->fromType}->statusList[$card->objectStatus];?> + date)):?> + date));?> + + fromType == 'execution'):?> + createLink('execution', 'view', "id=$card->fromID"), $card->name, '', "class='cardName' title='$card->name'");?> +
    + {$card->fromType}->statusList[$card->objectStatus];?> + fromType == 'build'):?> + createLink('build', 'view', "id=$card->fromID"), $card->name, '', "class='cardName' title='$card->name'");?> +
    + date)):?> + date));?> + + end) and !helper::isZeroDate($card->begin)):?> begin)) . $lang->kanbancard->beginAB;?> @@ -152,5 +182,17 @@ $(function() { $('#archivedCards').animate({right: -400}, 500); }); + $('.card-item').each(function() + { + var $item = $(this).children('.col-xs-10').children('.kanban-item'); + var icon = ''; + + if($item.children('.build').length) icon = ''; + if($item.children('.execution').length) icon = ''; + if($item.children('.productplan').length) icon = ''; + if($item.children('.release').length) icon = ''; + + $item.children('a').prepend(icon); + }); }) From d88c1310b6a1bdad3636e8cccd28a14ae3d14682 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 07:37:12 +0000 Subject: [PATCH 023/125] sprint_sunjun_53654 --- module/release/control.php | 7 +++++-- module/release/view/browse.html.php | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/module/release/control.php b/module/release/control.php index 2c76a1f05a..4f167c7fa7 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -41,15 +41,18 @@ class release extends control * @access public * @return void */ - public function browse($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc') + public function browse($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); $this->commonAction($productID, $branch); $this->session->set('releaseList', $this->app->getURI(true), 'product'); $this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse; $this->view->position[] = $this->lang->release->browse; - $this->view->releases = $this->release->getList($productID, $branch, $type, $orderBy); + $this->view->releases = $this->release->getList($productID, $branch, $type, $orderBy, $pager); $this->view->type = $type; + $this->view->pager = $pager; $this->display(); } diff --git a/module/release/view/browse.html.php b/module/release/view/browse.html.php index f980074b89..d81a13eb59 100644 --- a/module/release/view/browse.html.php +++ b/module/release/view/browse.html.php @@ -105,5 +105,8 @@
    plans;?> releases;?> - id", $product, 'list', 'edit');?> - - - - buildOperateMenu($product, 'browse');?>
    +
    From 14b9350a1cd3fbc29c4fb4fa918c0cc66fceb141 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 07:40:57 +0000 Subject: [PATCH 024/125] sprint_sunjun_53654 --- module/release/view/browse.html.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/release/view/browse.html.php b/module/release/view/browse.html.php index d81a13eb59..3eea2f090a 100644 --- a/module/release/view/browse.html.php +++ b/module/release/view/browse.html.php @@ -105,8 +105,8 @@ - +
    From 57b5a8a1c525255a7d81f48e6503003fee81f4f0 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 08:13:05 +0000 Subject: [PATCH 025/125] task_sunjun_53672 --- module/release/model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/release/model.php b/module/release/model.php index b0965abe8c..6241f8baac 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -191,9 +191,8 @@ class releaseModel extends model $this->dao->insert(TABLE_RELEASE)->data($release) ->autoCheck() ->batchCheck($this->config->release->create->requiredFields, 'notempty') - ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'"); - ->checkFlow() - + ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'") + ->checkFlow(); if(dao::isError()) { if(!empty($buildID)) $this->dao->delete()->from(TABLE_BUILD)->where('id')->eq($buildID)->exec(); From bf1f9172ff01be0a1c8145ddc499c67e5e140f36 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 08:15:50 +0000 Subject: [PATCH 026/125] tasj_sunjun_53665 --- module/release/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/release/model.php b/module/release/model.php index b0965abe8c..89c64ab08c 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -191,8 +191,8 @@ class releaseModel extends model $this->dao->insert(TABLE_RELEASE)->data($release) ->autoCheck() ->batchCheck($this->config->release->create->requiredFields, 'notempty') - ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'"); - ->checkFlow() + ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'") + ->checkFlow(); if(dao::isError()) { From 0a23be8a5b8b05932c6f8b13cbbf8e9ff8533bd2 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 08:22:25 +0000 Subject: [PATCH 027/125] task_sunjun_53672 --- module/release/model.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/release/model.php b/module/release/model.php index 6241f8baac..63a8bb5f32 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -121,9 +121,6 @@ class releaseModel extends model /* Check build if build is required. */ if(strpos($this->config->release->create->requiredFields, 'build') !== false and $this->post->build == false) return dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->release->build); - /* Check date must be not more than today. */ - if($this->post->date > date('Y-m-d')) return dao::$errors[] = $this->lang->release->errorDate; - $release = fixer::input('post') ->add('product', (int)$productID) ->add('branch', (int)$branch) From 6abe1812a0ddf13a14196c01a9b895b89de3efd1 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 08:23:33 +0000 Subject: [PATCH 028/125] task_sunjun_53672 --- module/release/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/release/model.php b/module/release/model.php index 63a8bb5f32..28cc033b6f 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -190,6 +190,7 @@ class releaseModel extends model ->batchCheck($this->config->release->create->requiredFields, 'notempty') ->check('name', 'unique', "product = '{$release->product}' AND branch = '{$release->branch}' AND deleted = '0'") ->checkFlow(); + if(dao::isError()) { if(!empty($buildID)) $this->dao->delete()->from(TABLE_BUILD)->where('id')->eq($buildID)->exec(); From 987edcc3cf0e5aadcb217e861d694063f658a16e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 10 May 2022 16:29:56 +0800 Subject: [PATCH 029/125] * Finish task #53663. --- module/kanban/control.php | 11 +++++++++-- module/kanban/js/view.js | 6 +++--- module/kanban/lang/en.php | 2 ++ module/kanban/lang/zh-cn.php | 2 ++ module/kanban/view/viewarchivedcard.html.php | 4 ++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index a18e14e40d..158625aa88 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1380,13 +1380,20 @@ class kanban extends control */ public function deleteCard($cardID, $confirm = 'no') { + $card = $this->kanban->getCardByID($cardID); if($confirm == 'no') { - return print(js::confirm($this->lang->kanbancard->confirmDelete, $this->createLink('kanban', 'deleteCard', "cardID=$cardID&confirm=yes"))); + $confirmTip = $card->fromType == '' ? $this->lang->kanbancard->confirmDelete : $this->lang->kanbancard->confirmRemove; + return print(js::confirm($confirmTip, $this->createLink('kanban', 'deleteCard', "cardID=$cardID&confirm=yes"))); } else { - $this->kanban->delete(TABLE_KANBANCARD, $cardID); + if($card->fromType == '') $this->kanban->delete(TABLE_KANBANCARD, $cardID); + if($card->fromType != '') + { + $this->dao->delete()->from(TABLE_KANBANCARD)->where('id')->eq($cardID)->exec(); + $this->loadModel('action')->create('kanbancard', $cardID, 'Deleted', '', $cardID); + } if(isonlybody()) return print(js::reload('parent.parent')); return print(js::reload('parent')); diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index a7e66e4e40..1ba790454f 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -1086,7 +1086,7 @@ function createCardMenu(options) if(!privs.length) return []; var items = []; - if(privs.includes('editCard')) items.push({label: kanbanLang.editCard, icon: 'edit', url: createLink('kanban', 'editCard', 'cardID=' + card.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(privs.includes('editCard') && card.fromType == '') items.push({label: kanbanLang.editCard, icon: 'edit', url: createLink('kanban', 'editCard', 'cardID=' + card.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(privs.includes('performable') && kanban.performable == 1) { if(card.status == 'done') @@ -1125,7 +1125,7 @@ function createCardMenu(options) if(privs.includes('setCardColor')) { var cardColoritems = []; - if(!card.color) color = "#fff"; + if(!card.color) card.color = "#fff"; for(let i = 0 ; i < colorList.length ; i ++ ) { var attr = card.color == colorList[i] ? '' : ''; @@ -1135,7 +1135,7 @@ function createCardMenu(options) }; items.push({label: kanbanLang.cardColor, icon: 'color', items: cardColoritems}); } - if(privs.includes('deleteCard')) items.push({label: kanbanLang.deleteCard, icon: 'trash', url: createLink('kanban', 'deleteCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); + if(privs.includes('deleteCard')) items.push({label: card.fromType == '' ? kanbanLang.deleteCard : kanbanLang.removeCard, icon: card.fromType == '' ? 'trash' : 'unlink', url: createLink('kanban', 'deleteCard', 'cardID=' + card.id), attrs: {'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); items.$options = {x: bounds.right, y: bounds.top}; diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php index b6d8efb4a2..cce018447c 100644 --- a/module/kanban/lang/en.php +++ b/module/kanban/lang/en.php @@ -40,6 +40,7 @@ $lang->kanban->moveCard = 'Move Card'; $lang->kanban->cardColor = 'Card Color'; $lang->kanban->setCardColor = 'Set Card Color'; $lang->kanban->deleteCard = 'Delete Card'; +$lang->kanban->removeCard = 'Remove Card'; $lang->kanban->assigntoCard = 'Assign'; $lang->kanban->setting = 'Setting'; $lang->kanban->enableArchived = 'Enable Archived'; @@ -365,6 +366,7 @@ $lang->kanbancard->confirmArchive = 'Are you sure to archive this card? After $lang->kanbancard->confirmDelete = 'Are you sure to delete this card? After deleting the card, it will be deleted from the Kanban. You can only view it in the system recycle bin.'; $lang->kanbancard->confirmRestore = "Are you sure you want to restore this card? After the card is restored, the card will be restored to the '%s' Kanban column."; $lang->kanbancard->confirmRestoreTip = "The card's column has been archived or deleted, please restore '%s' column first."; +$lang->kanbancard->confirmRemove = 'Are you sure to remove this card? After removing the card, the original data would not be affected.The card would be removed from the Kanban and counld not be restored.'; $lang->kanbancard->priList[1] = 1; $lang->kanbancard->priList[2] = 2; diff --git a/module/kanban/lang/zh-cn.php b/module/kanban/lang/zh-cn.php index 3b30ccdcdf..00a8305975 100644 --- a/module/kanban/lang/zh-cn.php +++ b/module/kanban/lang/zh-cn.php @@ -40,6 +40,7 @@ $lang->kanban->moveCard = '移动卡片'; $lang->kanban->cardColor = '卡片颜色'; $lang->kanban->setCardColor = '设置卡片颜色'; $lang->kanban->deleteCard = '删除卡片'; +$lang->kanban->removeCard = '移除卡片'; $lang->kanban->assigntoCard = '指派'; $lang->kanban->setting = '设置'; $lang->kanban->enableArchived = '设置归档功能'; @@ -365,6 +366,7 @@ $lang->kanbancard->confirmArchive = '您确认归档该卡片吗?归档卡 $lang->kanbancard->confirmDelete = '您确认删除该卡片吗?删除卡片后,该卡片将从看板中删除,您只能通过系统回收站查看。'; $lang->kanbancard->confirmRestore = '您确定要还原该卡片吗?还原卡片后,该卡片将还原到“%s”看板列中。'; $lang->kanbancard->confirmRestoreTip = '该卡片所属的看板列已被归档或删除,请先还原“%s”看板列。'; +$lang->kanbancard->confirmRemove = '您确认移除该卡片吗?移除卡片后,源数据不会受到影响,卡片将从看板中移除且无法恢复。'; $lang->kanbancard->priList[1] = 1; $lang->kanbancard->priList[2] = 2; diff --git a/module/kanban/view/viewarchivedcard.html.php b/module/kanban/view/viewarchivedcard.html.php index 107abd4988..e5fd50c1f5 100644 --- a/module/kanban/view/viewarchivedcard.html.php +++ b/module/kanban/view/viewarchivedcard.html.php @@ -104,7 +104,7 @@ $app->loadLang('productplan');
    {$card->fromType}->statusList[$card->objectStatus];?> fromType == 'build'):?> - createLink('build', 'view', "id=$card->fromID"), $card->name, '', "class='cardName' title='$card->name'");?> + createLink('build', 'view', "id=$card->fromID"), $card->name, '', "class='cardName' title='$card->name' data-app='project'");?>
    date)):?> date));?> @@ -167,7 +167,7 @@ $app->loadLang('productplan'); if($canRestore) echo html::a(inlink('restoreCard', "cardID={$card->id}"), $lang->kanban->restore, '', "class='btn btn-xs btn-primary' target='hiddenwin'"); - if($canDelete) echo html::a($this->createLink('kanban', 'deleteCard', "cardID=$card->id"), $lang->delete, '', "class='btn btn-xs delete-card' target='hiddenwin'"); + if($canDelete) echo html::a($this->createLink('kanban', 'deleteCard', "cardID=$card->id"), $card->fromType == '' ? $lang->delete : $lang->unlink, '', "class='btn btn-xs delete-card' target='hiddenwin'"); ?>
    From fe3c882c5e7268e5b82e2df845c5b105bfb6f93a Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Tue, 10 May 2022 16:32:04 +0800 Subject: [PATCH 030/125] * Adjust buildin workflow menu. --- framework/control.class.php | 5 +- framework/model.class.php | 15 ++- module/caselib/model.php | 61 ++++++++++++ module/caselib/view/browse.html.php | 10 +- module/caselib/view/view.html.php | 12 +-- module/testcase/model.php | 130 ++++++++++++++++++++++---- module/testcase/view/view.html.php | 36 +------ module/testsuite/model.php | 23 +++++ module/testsuite/view/browse.html.php | 6 +- module/testsuite/view/view.html.php | 4 - module/testtask/model.php | 72 ++++++++++++++ module/testtask/view/browse.html.php | 15 +-- module/testtask/view/view.html.php | 17 ---- 13 files changed, 296 insertions(+), 110 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index c7666ca0db..381e637cb8 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -320,7 +320,10 @@ class control extends baseControl if(!isset($this->config->bizVersion)) return false; $moduleName = $this->moduleName; - if($moduleName == 'bug' || $moduleName == 'feedback') return $this->$moduleName->buildOperateMenu($object, $type); + if($moduleName == 'bug' || $moduleName == 'feedback' || $moduleName == 'caselib' || $moduleName == 'testsuite' || $moduleName == 'testtask' || $moduleName == 'testcase') + { + return $this->$moduleName->buildOperateMenu($object, $type); + } $flow = $this->loadModel('workflow')->getByModule($moduleName); return $this->loadModel('flow')->buildOperateMenu($flow, $object, $type); diff --git a/framework/model.class.php b/framework/model.class.php index 267fbc1edf..7f58ebbde1 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -83,7 +83,12 @@ class model extends baseModel if(isset($this->config->bizVersion)) { static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION)->where('module')->eq($moduleName)->andWhere('buildin')->eq('1')->andWhere('status')->eq('enable')->fetchAll('action'); + if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('1') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->fetchAll('action'); } $enabled = true; @@ -133,7 +138,13 @@ class model extends baseModel if(strpos($module, '.') !== false) list($appName, $moduleName) = explode('.', $module); static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION)->where('module')->eq($moduleName)->andWhere('buildin')->eq('0')->andWhere('status')->eq('enable')->orderBy('order_asc')->fetchAll(); + if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('0') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->orderBy('order_asc') + ->fetchAll(); $menu = ''; if($show) diff --git a/module/caselib/model.php b/module/caselib/model.php index 19e11a3c29..1be4157617 100644 --- a/module/caselib/model.php +++ b/module/caselib/model.php @@ -594,4 +594,65 @@ class caselibModel extends model } } } + + /** + * Build case lib menu. + * + * @param object $object + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($object, $type = 'view') + { + $function = 'buildOperate' . ucfirst($type) . 'Menu'; + return $this->$function($object); + } + + /** + * Build case lib view menu. + * + * @param object $lib + * @access public + * @return string + */ + public function buildOperateViewMenu($lib) + { + if($lib->deleted) return ''; + + $menu = ''; + $params = "libID=$lib->id"; + $menu .= $this->buildFlowMenu('caselib', $lib, 'view', 'direct'); + $menu .= "
    "; + $menu .= $this->buildMenu('caselib', 'edit', $params, $lib, 'view'); + $menu .= $this->buildMenu('caselib', 'delete', $params, $lib, 'view', 'trash', 'hiddenwin'); + + return $menu; + } + + /** + * Build case lib browse menu. + * + * @param object $case + * @access public + * @return string + */ + public function buildOperateBrowseMenu($case) + { + $menu = ''; + $params = "caseID=$case->id"; + + if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview)) + { + $menu .= $this->buildMenu('testcase', 'review', $params, $case, 'browse', 'glasses', '', 'iframe'); + } + $menu .= $this->buildMenu('testcase', 'edit', $params, $case, 'browse'); + if(common::hasPriv('testcase', 'delete')) + { + $deleteURL = helper::createLink('testcase', 'delete', "$params&confirm=yes"); + $menu .= html::a("javascript:ajaxDelete(\"$deleteURL\", \"caseList\", confirmDelete)", '', '', "title='{$this->lang->testcase->delete}' class='btn'"); + } + + return $menu; + } } diff --git a/module/caselib/view/browse.html.php b/module/caselib/view/browse.html.php index 5fc8f8174d..35101bfe14 100644 --- a/module/caselib/view/browse.html.php +++ b/module/caselib/view/browse.html.php @@ -157,15 +157,7 @@ js::set('flow', $config->global->flow); processStatus('testcase', $case);?> " . $this->loadModel('flow')->getFieldValue($extendField, $case) . "";?> - testcase->needReview or !empty($config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'glasses', '', 'iframe'); - common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); - if(common::hasPriv('testcase', 'delete')) - { - $deleteURL = $this->createLink('testcase', 'delete', "caseID=$case->id&confirm=yes"); - echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"caseList\", confirmDelete)", '', '', "title='{$lang->testcase->delete}' class='btn'"); - } - ?> + buildOperateMenu($case, 'browse');?> diff --git a/module/caselib/view/view.html.php b/module/caselib/view/view.html.php index 1d3b1dc160..868c67dccc 100644 --- a/module/caselib/view/view.html.php +++ b/module/caselib/view/view.html.php @@ -37,15 +37,9 @@
    - deleted) - { - echo "
    "; - common::printIcon('caselib', 'edit', "libID=$lib->id"); - common::printIcon('caselib', 'delete', "libID=$lib->id", '', 'button', 'trash', 'hiddenwin'); - } - ?> + +
    ";?> + buildOperateMenu($lib, 'view');?>
    diff --git a/module/testcase/model.php b/module/testcase/model.php index ad0f5a2c6b..6316e0a981 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1715,22 +1715,8 @@ class testcaseModel extends model echo $case->stepNumber; break; case 'actions': - if($canBeChanged) - { - if($case->needconfirm or $browseType == 'needconfirm') - { - common::printIcon('testcase', 'confirmstorychange', "caseID=$case->id", $case, 'list', 'confirm', 'hiddenwin', '', '', '', $this->lang->confirm); - break; - } - - common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", $case, 'list', '', '', 'iframe', true, "data-width='95%'"); - common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", $case, 'list', 'play', '', 'runCase iframe', false, "data-width='95%'"); - common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); - if($this->config->testcase->needReview or !empty($this->config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'glasses', '', 'iframe'); - common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe', '', "data-width='90%'"); - common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); - } - + $case->browseType = $browseType; + echo $this->buildOperateMenu($case, 'browse'); break; } echo ''; @@ -2016,4 +2002,116 @@ class testcaseModel extends model return ''; } + + /** + * Build test case menu. + * + * @param object $case + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($case, $type = 'view') + { + $function = 'buildOperate' . ucfirst($type) . 'Menu'; + return $this->$function($case); + } + + /** + * Build test case view menu. + * + * @param object $case + * @access public + * @return string + */ + public function buildOperateViewMenu($case) + { + if($case->deleted) return ''; + + $menu = ''; + $params = "caseID=$case->id"; + $extraParams = "runID=$case->runID&$params"; + if(!$case->needconfirm) + { + if(!$case->isLibCase) + { + if($this->app->getViewType() == 'xhtml') + { + $menu .= $this->buildMenu('testtask', 'runCase', "$extraParams&version=$case->currentVersion", $case, 'view', 'play', '', 'showinonlybody', false, "data-width='95%'"); + $menu .= $this->buildMenu('testtask', 'results', "$extraParams&version=$case->version", $case, 'view', '', '', 'showinonlybody', false, "data-width='95%'"); + } + else + { + $menu .= $this->buildMenu('testtask', 'runCase', "$extraParams&version=$case->currentVersion", $case, 'view', 'play', '', 'showinonlybody iframe', false, "data-width='95%'"); + $menu .= $this->buildMenu('testtask', 'results', "$extraParams&version=$case->version", $case, 'view', '', '', 'showinonlybody iframe', false, "data-width='95%'"); + } + if($case->caseFails > 0) + { + $menu .= $this->buildMenu('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=$params,version=$case->version,runID=$case->runID", $case, 'view', 'bug', '', 'iframe', '', "data-width='90%'"); + } + } + if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview)) + { + $menu .= $this->buildMenu('testcase', 'review', $params, $case, 'view', '', '', 'iframe', '', '', $this->lang->testcase->reviewAB); + } + } + else + { + $menu .= $this->buildMenu('testcase', 'confirmstorychange', $params, $case, 'view', 'confirm', 'hiddenwin', '', '', '', $this->lang->confirm); + } + + $menu .= "
    "; + $menu .= $this->buildFlowMenu('testcase', $case, 'view', 'direct'); + $menu .= "
    "; + + if(!$case->needconfirm) + { + if(!isonlybody()) $menu .= $this->buildMenu('testcase', 'edit', $params, $case, 'view', '', '', 'showinonlybody'); + if(!$case->isLibCase && $case->auto != 'unit') + { + $menu .= $this->buildMenu('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'view', 'copy'); + } + if($case->isLibCase && common::hasPriv('caselib', 'createCase')) + { + echo html::a(helper::createLink('caselib', 'createCase', "libID=$case->lib&moduleID=$case->module¶m=$case->id"), "", '', "class='btn' title='{$this->lang->testcase->copy}'"); + } + + $menu .= $this->buildMenu('testcase', 'delete', $params, $case, 'view', 'trash', 'hiddenwin', ''); + } + + return $menu; + } + + /** + * Build test case browse menu. + * + * @param object $case + * @access public + * @return string + */ + public function buildOperateBrowseMenu($case) + { + $canBeChanged = common::canBeChanged('case', $case); + if(!$canBeChanged) return ''; + + $menu = ''; + $params = "caseID=$case->id"; + + if($case->needconfirm || $case->browseType == 'needconfirm') + { + return $this->buildMenu('testcase', 'confirmstorychange', $params, $case, 'browse', 'confirm', 'hiddenwin', '', '', '', $this->lang->confirm); + } + + $menu .= $this->buildMenu('testtask', 'results', "runID=0&$params", $case, 'browse', '', '', 'iframe', true, "data-width='95%'"); + $menu .= $this->buildMenu('testtask', 'runCase', "runID=0&$params&version=$case->version", $case, 'browse', 'play', '', 'runCase iframe', false, "data-width='95%'"); + $menu .= $this->buildMenu('testcase', 'edit', "caseID=$case->id", $case, 'browse'); + if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview)) + { + common::printIcon('testcase', 'review', $params, $case, 'browse', 'glasses', '', 'iframe'); + } + $menu .= $this->buildMenu('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'browse', 'bug', '', 'iframe', '', "data-width='90%'"); + $menu .= $this->buildMenu('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'browse', 'copy'); + + return $menu; + } } diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 37a3ad7e13..28a613dd52 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -112,41 +112,11 @@
    - deleted):?>
    ";?> - needconfirm):?> -
    "; - if($this->app->getViewType() == 'xhtml') - { - common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", $case, 'button', 'play', '', 'showinonlybody', false, "data-width='95%'"); - common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", $case, 'button', '', '', 'showinonlybody', false, "data-width='95%'"); - } - else - { - common::printIcon('testtask', 'runCase', "runID=$runID&caseID=$case->id&version=$case->currentVersion", $case, 'button', 'play', '', 'showinonlybody iframe', false, "data-width='95%'"); - common::printIcon('testtask', 'results', "runID=$runID&caseID=$case->id&version=$case->version", $case, 'button', '', '', 'showinonlybody iframe', false, "data-width='95%'"); - } - - if($caseFails > 0) common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=$runID", $case, 'button', 'bug', '', 'iframe', '', "data-width='90%'"); - } - if($config->testcase->needReview or !empty($config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'button', '', '', 'iframe', '', '', $lang->testcase->reviewAB); - ?> - + isLibCase = $isLibCase;?> + caseFails = $caseFails;?> + runID = $runID;?> buildOperateMenu($case, 'view');?> - - id", $case, 'button', '', '', 'showinonlybody'); - if(!$isLibCase and $case->auto != 'unit') common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'button', 'copy'); - if($isLibCase and common::hasPriv('caselib', 'createCase')) echo html::a($this->createLink('caselib', 'createCase', "libID=$case->lib&moduleID=$case->module¶m=$case->id"), "", '', "class='btn' title='{$lang->testcase->copy}'"); - common::printIcon('testcase', 'delete', "caseID=$case->id", $case, 'button', 'trash', 'hiddenwin', ''); - ?> - needconfirm):?> - id", $case, 'list', 'confirm', 'hiddenwin', '', '', '', $this->lang->confirm);?> - - diff --git a/module/testsuite/model.php b/module/testsuite/model.php index bb3470d280..9ddaf7a619 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -325,4 +325,27 @@ class testsuiteModel extends model ->page($pager) ->fetchAll('id'); } + + + /** + * Build testsuite menu. + * + * @param object $suite + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($suite, $type = 'view') + { + $menu = ''; + $params = "suiteID=$suite->id"; + + if($type == 'view') $menu .= $this->buildFlowMenu('testsuite', $suite, $type, 'direct'); + + $menu .= $this->buildMenu('testsuite', 'linkCase', $params, $suite, $type, 'link', '', '', '', '', $this->lang->testsuite->linkCase); + $menu .= $this->buildMenu('testsuite', 'edit', $params, $suite, $type); + $menu .= $this->buildMenu('testsuite', 'delete', $params, $suite, $type, 'trash', 'hiddenwin'); + + return $menu; + } } diff --git a/module/testsuite/view/browse.html.php b/module/testsuite/view/browse.html.php index a4d24ca90e..70fd6b4070 100644 --- a/module/testsuite/view/browse.html.php +++ b/module/testsuite/view/browse.html.php @@ -70,11 +70,7 @@ addedDate;?> " . $this->loadModel('flow')->getFieldValue($extendField, $suite) . "";?> - id", $suite, 'list', 'link'); - common::printIcon('testsuite', 'edit', "suiteID=$suite->id", $suite, 'list'); - common::printIcon('testsuite', 'delete', "suiteID=$suite->id", $suite, 'list', 'trash', 'hiddenwin'); - ?> + buildOperateMenu($suite, 'browse');?> diff --git a/module/testsuite/view/view.html.php b/module/testsuite/view/view.html.php index b3e3faf113..6a44d631bc 100644 --- a/module/testsuite/view/view.html.php +++ b/module/testsuite/view/view.html.php @@ -32,10 +32,6 @@ if(!$suite->deleted and $canBeChanged) { echo $this->buildOperateMenu($suite, 'view'); - - common::printLink('testsuite', 'linkCase', "suiteID=$suite->id", " " . '', '', "class='btn btn-link' title='{$lang->testsuite->linkCase}'"); - common::printIcon('testsuite', 'edit', "suiteID=$suite->id"); - common::printIcon('testsuite', 'delete', "suiteID=$suite->id", '', 'button', 'trash', 'hiddenwin'); } ?> diff --git a/module/testtask/model.php b/module/testtask/model.php index ab145e1f10..8caf00e163 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -2160,4 +2160,76 @@ class testtaskModel extends model return array('suites' => $suites, 'cases' => $cases, 'results' => $results, 'suiteNames' => $suiteNames, 'caseTitles' => $caseTitles); } + + /** + * Build test task menu. + * + * @param object $task + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($task, $type = 'view') + { + $function = 'buildOperate' . ucfirst($type) . 'Menu'; + return $this->$function($task); + } + + /** + * Build test task view menu. + * + * @param object $task + * @access public + * @return string + */ + public function buildOperateViewMenu($task) + { + if($task->deleted) return ''; + + $menu = ''; + $params = "taskID=$task->id"; + + $menu .= $this->buildMenu('testtask', 'start', $params, $task, 'view', '', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('testtask', 'close', $params, $task, 'view', '', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('testtask', 'block', $params, $task, 'view', 'pause', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('testtask', 'activate', $params, $task, 'view', 'magic', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('testtask', 'cases', $params, $task, 'view', 'sitemap'); + $menu .= $this->buildMenu('testtask', 'linkCase', $params, $task, 'view', 'link'); + + $menu .= "
    "; + $menu .= $this->buildFlowMenu('testtask', $task, 'view', 'direct'); + $menu .= "
    "; + + $menu .= $this->buildMenu('testtask', 'edit', $params, $task, 'view'); + $menu .= $this->buildMenu('testtask', 'delete', $params, $task, 'view', 'trash', 'hiddenwin'); + + return $menu; + } + + /** + * Build test task browse menu. + * + * @param object $task + * @access public + * @return string + */ + public function buildOperateBrowseMenu($task) + { + $menu = ''; + $params = "taskID=$task->id"; + + $menu .= '
    '; + $menu .= $this->buildMenu('testtask', 'cases', $params, $task, 'browse', 'sitemap'); + $menu .= $this->buildMenu('testtask', 'linkCase', "$params&type=all¶m=myQueryID", $task, 'browse', 'link'); + $menu .= $this->buildMenu('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'browse', 'flag'); + $menu .= '
    '; + $menu .= $this->buildMenu('testtask', 'view', $params, $task, 'browse', 'list-alt', '', 'iframe', true, "data-width='90%'"); + $menu .= $this->buildMenu('testtask', 'edit', $params, $task, 'browse'); + if(common::hasPriv('testtask', 'delete', $task)) + { + $deleteURL = helper::createLink('testtask', 'delete', "taskID=$task->id&confirm=yes"); + $menu .= html::a("javascript:ajaxDelete(\"$deleteURL\",\"taskList\",confirmDelete)", '', '', "title='{$this->lang->testtask->delete}' class='btn'"); + } + return $menu; + } } diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index 74b54c4461..e417cb11f6 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -102,20 +102,7 @@ $status = $this->session->testTaskVersionStatus; " . $this->loadModel('flow')->getFieldValue($extendField, $task) . "";?> - '; - common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'list', 'sitemap'); - common::printIcon('testtask', 'linkCase', "taskID=$task->id&type=all¶m=myQueryID", $task, 'list', 'link'); - common::printIcon('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'list', 'flag'); - echo ''; - common::printIcon('testtask', 'view', "taskID=$task->id", '', 'list', 'list-alt', '', 'iframe', true, "data-width='90%'"); - common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list'); - if(common::hasPriv('testtask', 'delete', $task)) - { - $deleteURL = $this->createLink('testtask', 'delete', "taskID=$task->id&confirm=yes"); - echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"taskList\",confirmDelete)", '', '', "title='{$lang->testtask->delete}' class='btn'"); - } - ?> + buildOperateMenu($task, 'browse');?> diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php index 14fa49a23d..7324b9d56e 100644 --- a/module/testtask/view/view.html.php +++ b/module/testtask/view/view.html.php @@ -50,25 +50,8 @@
    ' . $lang->goback, '', 'btn btn-secondary');?> - deleted):?>
    - id", $task, 'button', '', '', 'iframe showinonlybody', true); - common::printIcon('testtask', 'close', "taskID=$task->id", $task, 'button', '', '', 'iframe showinonlybody', true); - common::printIcon('testtask', 'block', "taskID=$task->id", $task, 'button', 'pause', '', 'iframe showinonlybody', true); - common::printIcon('testtask', 'activate', "taskID=$task->id", $task, 'button', 'magic', '', 'iframe showinonlybody', true); - common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'button', 'sitemap'); - common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'button', 'link'); - ?> - buildOperateMenu($task, 'view');?> - -
    - id", $task); - common::printIcon('testtask', 'delete', "taskID=$task->id", $task, 'button', 'trash', 'hiddenwin'); - ?> -
    From 248683c67dbfc94af49eb36e0fbb28fdb59337c8 Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Tue, 10 May 2022 16:36:06 +0800 Subject: [PATCH 031/125] * Merge code. --- framework/control.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/framework/control.class.php b/framework/control.class.php index 381e637cb8..926fab0f05 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -320,10 +320,7 @@ class control extends baseControl if(!isset($this->config->bizVersion)) return false; $moduleName = $this->moduleName; - if($moduleName == 'bug' || $moduleName == 'feedback' || $moduleName == 'caselib' || $moduleName == 'testsuite' || $moduleName == 'testtask' || $moduleName == 'testcase') - { - return $this->$moduleName->buildOperateMenu($object, $type); - } + if(strpos(',bug,feedback,caselib,testsuite,testtask,testcase,product,', ",{$moduleName},") !== false) return $this->$moduleName->buildOperateMenu($object, $type); $flow = $this->loadModel('workflow')->getByModule($moduleName); return $this->loadModel('flow')->buildOperateMenu($flow, $object, $type); From bcf64c0c54902255c1af46643f600e9cc54567a0 Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Tue, 10 May 2022 16:41:36 +0800 Subject: [PATCH 032/125] * Optimize code. --- framework/model.class.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/framework/model.class.php b/framework/model.class.php index 7f58ebbde1..be9480d01f 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -83,12 +83,15 @@ class model extends baseModel if(isset($this->config->bizVersion)) { static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) - ->where('module')->eq($moduleName) - ->andWhere('buildin')->eq('1') - ->andWhere('status')->eq('enable') - ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() - ->fetchAll('action'); + if(empty($actions)) + { + $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('1') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->fetchAll('action'); + } } $enabled = true; @@ -138,13 +141,16 @@ class model extends baseModel if(strpos($module, '.') !== false) list($appName, $moduleName) = explode('.', $module); static $actions; - if(empty($actions)) $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) - ->where('module')->eq($moduleName) - ->andWhere('buildin')->eq('0') - ->andWhere('status')->eq('enable') - ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() - ->orderBy('order_asc') - ->fetchAll(); + if(empty($actions)) + { + $actions = $this->dao->select('*')->from(TABLE_WORKFLOWACTION) + ->where('module')->eq($moduleName) + ->andWhere('buildin')->eq('0') + ->andWhere('status')->eq('enable') + ->beginIF(!empty($this->config->vision))->andWhere('vision')->eq($this->config->vision)->fi() + ->orderBy('order_asc') + ->fetchAll(); + } $menu = ''; if($show) From bd06901bfa40f8197df2c548edfd1967c4f50863 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 10 May 2022 08:52:05 +0000 Subject: [PATCH 033/125] * Fix bug. --- db/update16.5.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index 47c6e3031c..46afc5aa1d 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -91,15 +91,11 @@ DELETE FROM `zt_config` WHERE `section` = 'customMenu'; UPDATE `zt_story` SET `plan` = '' WHERE `plan` = 0; UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` = 'testcase' and `field` IN ('openedDate','reviewedDate','lastEditedDate','lastRunDate'); -UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'testcase' and `field` = 'lib'; UPDATE `zt_workflowfield` set `control` = 'date' WHERE `module` = 'testtask' and `field` IN ('begin','end'); UPDATE `zt_workflowfield` set `control` = 'richtext' WHERE `module` = 'testtask' and `field` = 'desc'; UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` IN ('testsuite','caselib') and `field` IN ('addedDate','lastEditedDate'); -UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'testsuite' and `field` = 'type'; UPDATE `zt_workflowfield` set `control` = 'richtext' WHERE `module` = 'testsuite' and `field` = 'desc'; UPDATE `zt_workflowfield` set `control` = 'datetime' WHERE `module` = 'feedback' and `field` IN ('openedDate','reviewedDate','processedDate','closedDate','editedDate','assignedDate'); -UPDATE `zt_workflowfield` set `control` = 'select' WHERE `module` = 'feedback' and `field` IN ('public','notify'); - From d8d6ce45f7e3fd78e3878d46b8237c4dbf54e763 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 10 May 2022 08:58:00 +0000 Subject: [PATCH 034/125] * Finish task#53653 --- module/program/control.php | 11 +++++++++-- module/program/js/browse.js | 4 ++++ module/program/lang/en.php | 1 + module/program/lang/zh-cn.php | 1 + module/program/model.php | 17 +++++++++++++---- module/program/view/browse.html.php | 1 + module/program/view/browsebylist.html.php | 1 + 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index 54e34c9fa2..3ef0331eb9 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -26,13 +26,16 @@ class program extends control * @access public * @return void */ - public function browse($status = 'all', $orderBy = 'order_asc') + public function browse($status = 'all', $orderBy = 'order_asc', $recTotal = 0, $recPerPage = 10, $pageID = 1) { if(common::hasPriv('program', 'create')) $this->lang->pageActions = html::a($this->createLink('program', 'create'), " " . $this->lang->program->create, '', "class='btn btn-primary create-program-btn'"); $this->session->set('programList', $this->app->getURI(true), 'program'); $this->session->set('projectList', $this->app->getURI(true), 'program'); + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $programType = $this->cookie->programType ? $this->cookie->programType : 'bylist'; if($programType === 'bygrid') @@ -41,7 +44,10 @@ class program extends control } else { - $programs = $this->program->getList($status, $orderBy, null, true); + $topPrograms = $this->program->getList($status, $orderBy, $pager, 'topProgram'); + $programIDs = array(); + foreach($topPrograms as $programID => $program) $programIDs[] = $programID; + $programs = $this->program->getList($status, $orderBy, null, 'byTopIDs', $programIDs); } /* Get PM id list. */ @@ -58,6 +64,7 @@ class program extends control $this->view->programs = $programs; $this->view->status = $status; $this->view->orderBy = $orderBy; + $this->view->pager = $pager; $this->view->users = $this->user->getPairs('noletter'); $this->view->userIdPairs = $this->user->getPairs('noletter|showid'); $this->view->usersAvatar = $this->user->getAvatarPairs(''); diff --git a/module/program/js/browse.js b/module/program/js/browse.js index e84d284444..b042c063d3 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -43,6 +43,10 @@ $(function() $('#programForm').removeClass('has-row-checked'); } }); + + var myPager = $('.pager').data('zui.pager'); + myPager.lang.pageSize = pageSize; + myPager.set(); }); function showEditCheckbox(show) diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 31568de285..62bf6dce4f 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -71,6 +71,7 @@ $lang->program->moreProgram = 'More program'; $lang->program->stakeholderType = 'Stakeholder type'; $lang->program->parentBudget = 'Parent program surplus budget:'; $lang->program->isStakeholderKey = 'Key stakeholder'; +$lang->program->pageSize = '{recPerPage} Top Programs per page'; $lang->program->stakeholderTypeList['inside'] = 'Inside'; $lang->program->stakeholderTypeList['outside'] = 'Outside'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index c38753ce88..6afc1ca4b4 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -71,6 +71,7 @@ $lang->program->moreProgram = '更多项目集'; $lang->program->stakeholderType = '干系人类型'; $lang->program->parentBudget = '所属项目集剩余预算:'; $lang->program->isStakeholderKey = '关键干系人'; +$lang->program->pageSize = '每页 {recPerPage} 项顶级项目集'; $lang->program->stakeholderTypeList['inside'] = '内部'; $lang->program->stakeholderTypeList['outside'] = '外部'; diff --git a/module/program/model.php b/module/program/model.php index f5bd3cdb18..892a34a19d 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -133,8 +133,15 @@ class programModel extends model * @access public * @return array */ - public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL) + public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $filter = '', $filterParams = '') { + $filterSql = ''; + if($filter === 'byTopIDs') + { + foreach($filterParams as $topID) $filterSql .= "path like ',{$topID},%' or "; + if($filterSql) $filterSql = '(' . substr($filterSql, 0, -3) . ')'; // Remove last or. + } + return $this->dao->select('*')->from(TABLE_PROGRAM) ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) @@ -146,6 +153,8 @@ class programModel extends model ->markRight(2) ->beginIF($status != 'all')->andWhere('status')->eq($status)->fi() ->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi() + ->beginIF($filter === 'topProgram')->andWhere('parent')->eq(0)->fi() + ->beginIF(!empty($filterSql))->andWhere($filterSql)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -240,15 +249,15 @@ class programModel extends model foreach($products as $product) { $product->plans = zget($plans, $product->id, array()); - + /* Convert predefined HTML entities to characters. */ !empty($product->plans) && array_map(function($planVal) { return $planVal->title = htmlspecialchars_decode($planVal->title, ENT_QUOTES); - }, + }, $product->plans); $product->name = htmlspecialchars_decode($product->name, ENT_QUOTES); - + $product->releases = zget($releases, $product->id, array()); $projects = zget($projectGroup, $product->id, array()); foreach($projects as $project) diff --git a/module/program/view/browse.html.php b/module/program/view/browse.html.php index 6b13491250..e26b262b62 100644 --- a/module/program/view/browse.html.php +++ b/module/program/view/browse.html.php @@ -15,6 +15,7 @@ edit);?> selectAll);?> +program->pageSize);?> diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php index 3271346cda..5e6a78f15e 100644 --- a/module/program/view/browsebylist.html.php +++ b/module/program/view/browsebylist.html.php @@ -138,6 +138,7 @@ + @@ -105,9 +107,12 @@ $app->loadLang('productplan'); begin) and !helper::isZeroDate($card->end) and $card->begin != '2030-01-01' and $card->end != '2030-01-01'):?> end)) . $lang->kanbancard->deadlineAB;?> - begin) and !helper::isZeroDate($card->end) and $card->begin != '2030-01-01' and $card->end != '2030-01-01'):?> + begin) and !helper::isZeroDate($card->end) and $card->begin != '2030-01-01' and $card->end != '2030-01-01' and $card->fromType == ''):?> begin)) . ' ~ ' . date("m/d", strtotime($card->end));?> + begin) and !helper::isZeroDate($card->end) and $card->begin != '2030-01-01' and $card->end != '2030-01-01' and $card->fromType != ''):?> + begin)) . ' ' . $lang->{$card->fromType}->to . ' ' . date("m-d", strtotime($card->end));?> + begin == '2030-01-01' or $card->end == '2030-01-01') echo '' . $lang->{$card->fromType}->future . ''; From 90f6f0f63f107a4b65d0940e958393b5829a1c6d Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 11 May 2022 07:22:16 +0000 Subject: [PATCH 082/125] * Build operate menu for story module. --- module/story/model.php | 110 +++++++++++++++++++++++++------- module/story/view/view.html.php | 48 +------------- 2 files changed, 88 insertions(+), 70 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 3f5d681686..10100ef2ed 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3760,6 +3760,92 @@ class storyModel extends model return true; } + /** + * Build operate menu. + * + * @param object $story + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($story, $type = 'view') + { + $menu = ''; + $params = "storyID=$story->id"; + + if($type == 'browse') + { + if(common::canBeChanged('story', $story)) + { + if($story->URChanged) return $this->buildMenu('story', 'processStoryChange', $params, $story, $type, 'search', '', 'iframe', true, '', $this->lang->confirm); + + $menu .= $this->buildMenu('story', 'change', $params . "&from=$story->from", $story, $type, 'alter'); + $menu .= $this->buildMenu('story', 'review', $params . "&from=$story->from", $story, $type, 'search'); + $menu .= $this->buildMenu('story', 'recall', $params, $story, $type, 'undo', 'hiddenwin', '', '', '', $this->lang->story->recall); + $menu .= $this->buildMenu('story', 'close', $params, $story, $type, '', '', 'iframe', true); + $menu .= $this->buildMenu('story', 'edit', $params . "&from=$story->from", $story, $type); + + if($story->type != 'requirement' and $this->config->vision != 'lite') $menu .= $this->buildMenu('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$params", $story, $type, 'sitemap', '', '', false, "data-app='qa'"); + if($this->app->rawModule != 'projectstory' OR $this->config->vision == 'lite') $menu .= $this->buildMenu('story', 'batchCreate', "productID=$story->product&branch=$story->branch&module=$story->module&$params&executionID={$this->session->project}", $story, $type, 'split', '', '', '', '', $this->lang->story->subdivide); + if($this->app->rawModule == 'projectstory' and $this->config->vision != 'lite') $menu .= $this->buildMenu('projectstory', 'unlinkStory', "projectID={$this->session->project}&$params", $story, $type, 'unlink', 'hiddenwin'); + } + else + { + return $this->buildMenu('story', 'close', $params, $story, 'list', '', '', 'iframe', true); + } + } + + if($type == 'view') + { + $menu .= $this->buildMenu('story', 'change', $params, $story, $type, 'alter', '', 'showinonlybody'); + $menu .= $this->buildMenu('story', 'recall', $params, $story, $type, 'undo', '', 'showinonlybody'); + $menu .= $this->buildMenu('story', 'review', $params, $story, $type, 'search', '', 'showinonlybody'); + + if(!isonlybody()) $menu .= $this->buildMenu('story', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&$params", $story, $type, 'split', '', 'divideStory', '', "data-toggle='modal' data-type='iframe' data-width='95%'", $this->lang->story->subdivide); + + $menu .= $this->buildMenu('story', 'assignTo', $params, $story, $type, '', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('story', 'close', $params, $story, $type, '', '', 'iframe showinonlybody', true); + $menu .= $this->buildMenu('story', 'activate', $params, $story, $type, '', '', 'iframe showinonlybody', true); + + if($this->config->edition == 'max' and $this->app->tab == 'project' and common::hasPriv('story', 'importToLib')) $menu .= html::a('#importToLib', " " . $this->lang->story->importToLib, '', 'class="btn" data-toggle="modal"'); + + /* Print testcate actions. */ + if($story->parent >= 0 and $story->type != 'requirement' and (common::hasPriv('testcase', 'create', $story) or common::hasPriv('testcase', 'batchCreate', $story))) + { + $this->app->loadLang('testcase'); + $menu .= "
    "; + $menu .= ""; + $menu .= "
    "; + } + + if($this->app->tab == 'execution' and strpos('draft,closed', $story->status) === false) $menu .= $this->buildMenu('task', 'create', "execution={$this->session->project}&{$params}&moduleID=$story->module", $story, $type, 'plus', '', 'showinonly body'); + + $menu .= "
    "; + $menu .= $this->buildMenu('story', 'edit', $params, $story, $type); + $menu .= $this->buildMenu('story', 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&{$params}&executionID=0&bugID=0&planID=0&todoID=0&extra=&type=$story->type", $story, $type, 'copy', '', '', ' ', "data-width='1050'"); + $menu .= $this->buildMenu('story', 'delete', $params, $story, 'button', 'trash', 'hiddenwin', 'showinonlybody', true); + } + + return $menu; + } + /** * Merge plan title. * @@ -4164,29 +4250,7 @@ class storyModel extends model echo $story->version; break; case 'actions': - $vars = "story={$story->id}"; - $executionParams = $this->config->vision == 'lite' ? "&executionID={$this->session->project}" : ''; - if($canBeChanged) - { - if($story->URChanged) - { - common::printIcon('story', 'processStoryChange', "storyID=$story->id", '', 'list', 'search', '', 'iframe', true, '', $this->lang->confirm); - break; - } - - common::printIcon('story', 'change', $vars . "&from=$story->from", $story, 'list', 'alter', '', '', false, "data-group=$story->from"); - common::printIcon('story', 'review', $vars . "&from=$story->from", $story, 'list', 'search', '', '', false, "data-group=$story->from"); - common::printIcon('story', 'recall', $vars, $story, 'list', 'undo', 'hiddenwin', '', '', '', $this->lang->story->recall); - common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true); - common::printIcon('story', 'edit', $vars . "&from=$story->from", $story, 'list', '', '', '', false, "data-group=$story->from"); - if($story->type != 'requirement' and $this->config->vision != 'lite') common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap', '', '', false, "data-app='qa'"); - if($this->app->rawModule != 'projectstory' OR $this->config->vision == 'lite') common::printIcon('story', 'batchCreate', "productID=$story->product&branch=$story->branch&module=$story->module&storyID=$story->id" . $executionParams, $story, 'list', 'split', '', '', '', '', $this->lang->story->subdivide); - if($this->app->rawModule == 'projectstory' and $this->config->vision != 'lite') common::printIcon('projectstory', 'unlinkStory', "projectID={$this->session->project}&storyID=$story->id", '', 'list', 'unlink', 'hiddenwin'); - } - else - { - common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true); - } + echo $this->buildOperateMenu($story, 'browse'); break; } echo ''; diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index b6967b86c7..5c6f57ab9b 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -200,53 +200,7 @@
    ";?> - deleted):?> - id", $story, 'button', 'alter', '', 'showinonlybody'); - common::printIcon('story', 'recall', "storyID=$story->id", $story, 'button', 'undo', '', 'showinonlybody'); - common::printIcon('story', 'review', "storyID=$story->id", $story, 'button', 'search', '', 'showinonlybody'); - if($story->status == 'active' and $story->stage == 'wait' and $story->parent <= 0 and !isonlybody()) - { - $divideLang = $lang->story->subdivide; - $misc = "class='btn divideStory' data-toggle='modal' data-type='iframe' data-width='95%'"; - $link = $this->createLink('story', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', true); - if(common::hasPriv('story', 'batchCreate', $story)) echo html::a($link, " " . $divideLang, '', $misc); - } - - common::printIcon('story', 'assignTo', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true); - common::printIcon('story', 'close', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true); - common::printIcon('story', 'activate', "storyID=$story->id", $story, 'button', '', '', 'iframe showinonlybody', true); - if($this->config->edition == 'max' and $this->app->tab == 'project' and common::hasPriv('story', 'importToLib')) echo html::a('#importToLib', " " . $this->lang->story->importToLib, '', 'class="btn" data-toggle="modal"'); - - if($story->parent >= 0 and $story->type != 'requirement' and (common::hasPriv('testcase', 'create', $story) or common::hasPriv('testcase', 'batchCreate', $story))) - { - $this->app->loadLang('testcase'); - echo "
    "; - echo ""; - echo ""; - echo "
    "; - } - - if($from == 'execution' and strpos('draft,closed', $story->status) === false) common::printIcon('task', 'create', "execution=$param&storyID=$story->id&moduleID=$story->module", $story, 'button', 'plus', '', 'showinonlybody'); - - echo $this->buildOperateMenu($story, 'view'); - - echo "
    "; - common::printIcon('story', 'edit', "storyID=$story->id", $story); - common::printIcon('story', 'create', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id&executionID=0&bugID=0&planID=0&todoID=0&extra=&type=$story->type", $story, 'button', 'copy', '', '', '', "data-width='1050'"); - common::printIcon('story', 'delete', "storyID=$story->id", $story, 'button', 'trash', 'hiddenwin', 'showinonlybody',true); - ?> - + deleted) echo $this->buildOperateMenu($story, 'view');?> From 0695047d20ab499b683aa5dd81f74a46441d395e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 15:40:59 +0800 Subject: [PATCH 083/125] *Finish task #53659. --- module/program/model.php | 6 ++-- module/project/config.php | 37 +++++++++++++++++++++++ module/project/control.php | 5 +++ module/project/lang/zh-cn.php | 4 +++ module/project/model.php | 33 ++++++++++++++++++++ module/project/view/browsebylist.html.php | 2 ++ 6 files changed, 84 insertions(+), 3 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index baff7f83d0..da8f3dd75a 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -240,15 +240,15 @@ class programModel extends model foreach($products as $product) { $product->plans = zget($plans, $product->id, array()); - + /* Convert predefined HTML entities to characters. */ !empty($product->plans) && array_map(function($planVal) { return $planVal->title = htmlspecialchars_decode($planVal->title, ENT_QUOTES); - }, + }, $product->plans); $product->name = htmlspecialchars_decode($product->name, ENT_QUOTES); - + $product->releases = zget($releases, $product->id, array()); $projects = zget($projectGroup, $product->id, array()); foreach($projects as $project) diff --git a/module/project/config.php b/module/project/config.php index a9e7474d96..9c8be57d6b 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -132,6 +132,43 @@ $config->project->maxCheckList = new stdclass(); $config->project->maxCheckList->scrum = array('bug', 'execution', 'build', 'doc', 'release', 'testtask', 'case', 'issue', 'risk', 'meeting'); $config->project->maxCheckList->waterfall = array('execution', 'design', 'doc', 'bug', 'case', 'build', 'release', 'testtask', 'review', 'build', 'researchplan', 'issue', 'risk', 'opportunity', 'auditplan', 'gapanalysis', 'meeting'); +$config->project->search['module'] = 'project'; +$config->project->search['fields']['name'] = $lang->project->name; +$config->project->search['fields']['code'] = $lang->project->code; +$config->project->search['fields']['id'] = $lang->project->id; +$config->project->search['fields']['model'] = $lang->project->manageType; +$config->project->search['fields']['parent'] = $lang->project->parent; +$config->project->search['fields']['status'] = $lang->project->projectStatus; +$config->project->search['fields']['desc'] = $lang->project->desc; +$config->project->search['fields']['PM'] = $lang->project->PM; +$config->project->search['fields']['openedDate'] = $lang->project->openedDate; +$config->project->search['fields']['begin'] = $lang->project->begin; +$config->project->search['fields']['end'] = $lang->project->end; +$config->project->search['fields']['realBeginAB'] = $lang->project->realBeginAB; +$config->project->search['fields']['realEndAB'] = $lang->project->realEndAB; +$config->project->search['fields']['openedBy'] = $lang->project->openedBy; +$config->project->search['fields']['closedBy'] = $lang->project->closedBy; +$config->project->search['fields']['lastEditedDate'] = $lang->project->lastEditedDate; +$config->project->search['fields']['closedDate'] = $lang->project->closedDate; + +$config->project->search['params']['name'] = array('operator' => 'include', 'control' => 'input' , 'values' => ''); +$config->project->search['params']['code'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); +$config->project->search['params']['id'] = array('operator' => '=' , 'control' => 'input' , 'values' => ''); +$config->project->search['params']['model'] = array('operator' => '=' , 'control' => 'select', 'values' => $lang->project->modelList); +$config->project->search['params']['parent'] = array('operator' => '=' , 'control' => 'select', 'values' => ''); +$config->project->search['params']['status'] = array('operator' => '=' , 'control' => 'select', 'values' => $lang->project->statusList); +$config->project->search['params']['desc'] = array('operator' => 'include', 'control' => 'input' , 'values' => ''); +$config->project->search['params']['PM'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); +$config->project->search['params']['openedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['begin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['end'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realBeginAB'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realEndAB'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['openedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); +$config->project->search['params']['closedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); +$config->project->search['params']['lastEditedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['closedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); + $config->project->includedPriv['project'] = array('edit', 'group', 'createGroup', 'managePriv', 'manageMembers', 'manageGroupMember', 'copyGroup', 'editGroup', 'start', 'suspend', 'close', 'activate', 'delete', 'view', 'whitelist', 'addWhitelist', 'unbindWhitelist', 'manageProducts', 'dynamic', 'build', 'bug', 'testcase', 'testtask', 'testreport', 'execution', 'team', 'unlinkMember'); $config->project->includedPriv['execution'] = array('create', 'start', 'delete', 'calendar', 'effortCalendar', 'effort', 'taskEffort', 'computeTaskEffort', 'deleterelation', 'maintainrelation', 'relation', 'gantt'); $config->project->includedPriv['task'] = array('create'); diff --git a/module/project/control.php b/module/project/control.php index e46b59976d..e99b77f51e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -307,6 +307,11 @@ class project extends control $programTitle = $this->loadModel('setting')->getItem('owner=' . $this->app->user->account . '&module=project&key=programTitle'); $projectStats = $this->loadModel('program')->getProjectStats($programID, $browseType, $queryID, $orderBy, $pager, $programTitle); + $actionURL = $this->createLink('project', 'browse', "&programID=$programID&browseType=bySearch&queryID=myQueryID"); + $this->project->buildSearchFrom($queryID, $actionURL); + $projectQuery = $this->session->projectQuery; + if($browseType == 'bySearch') $projectStats = $this->project->getBySearch($projectQuery); + $this->view->title = $this->lang->project->browse; $this->view->position[] = $this->lang->project->browse; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 551d4649ed..ba4ec95a1f 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -66,6 +66,7 @@ $lang->project->id = '项目编号'; $lang->project->project = '所属项目'; $lang->project->stage = '阶段'; $lang->project->model = '项目管理方式'; +$lang->project->manageType = '管理类型'; $lang->project->PM = '负责人'; $lang->project->PO = '项目负责人'; $lang->project->QD = '测试负责人'; @@ -79,6 +80,7 @@ $lang->project->begin = '计划开始'; $lang->project->end = '计划完成'; $lang->project->status = '状态'; $lang->project->subStatus = '子状态'; +$lang->project->projectStatus = '项目状态'; $lang->project->type = '项目类型'; $lang->project->lifetime = '项目周期'; $lang->project->attribute = '阶段类型'; @@ -227,6 +229,7 @@ $lang->project->currencySymbol['NZD'] = 'NZ$'; $lang->project->currencySymbol['THB'] = '฿'; $lang->project->currencySymbol['SGD'] = 'S$'; +$lang->project->modelList[''] = ""; $lang->project->modelList['scrum'] = "Scrum"; $lang->project->modelList['waterfall'] = "瀑布"; $lang->project->modelList['kanban'] = "看板"; @@ -257,6 +260,7 @@ $lang->project->kanbanSubAclList['program'] = '项目集内公开(所有上级 $lang->project->authList['extend'] = '继承 (取系统权限与项目权限的合集)'; $lang->project->authList['reset'] = '重新定义 (只取项目权限)'; +$lang->project->statusList[''] = ''; $lang->project->statusList['wait'] = '未开始'; $lang->project->statusList['doing'] = '进行中'; $lang->project->statusList['suspended'] = '已挂起'; diff --git a/module/project/model.php b/module/project/model.php index ab4804577c..65b2b5717f 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -629,6 +629,39 @@ class projectModel extends model ->fetchGroup('productID', 'branchID'); } + /* + * Get projects by search conditions. + * + * @param string $projectQuery + * @return array + * */ + public function getBySearch($projectQuery) + { + $projects = $this->dao->select('*')->from(TABLE_PROJECT) + ->where($projectQuery) + ->fetchAll(); + return $projects; + } + + /* + * Build search form + * + * @param int $queryID + * @param string $actionURL + * + * @return 0 + * */ + public function buildSearchFrom($queryID, $actionURL) + { + $this->config->project->search['queryID'] = $queryID; + $this->config->project->search['actionURL'] = $actionURL; + + $programPairs = array(0 => ''); + $programPairs += $this->loadModel('program')->getPairs(); + $this->config->project->search['params']['parent']['values'] = $programPairs; + $this->loadModel('search')->setSearchParams($this->config->project->search); + } + /** * Build the query. * diff --git a/module/project/view/browsebylist.html.php b/module/project/view/browsebylist.html.php index 93a0f68599..df3626ef01 100644 --- a/module/project/view/browsebylist.html.php +++ b/module/project/view/browsebylist.html.php @@ -40,6 +40,7 @@ $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?> +
    @@ -67,6 +68,7 @@
    +

    From bbb5ec189d03ae1f5cdf9f2ecce0a335e2699546 Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 11 May 2022 07:57:36 +0000 Subject: [PATCH 084/125] * Optimize code. --- module/project/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 0a4b6d9110..3a4b42f608 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -472,7 +472,7 @@ class projectModel extends model $link = helper::createLink('project', 'index', "projectID=%s"); $project = $this->getByID($projectID); - if(strpos(',project,product,projectstory,story,bug,testcase,testtask,testreport,build,projectrelease,stakeholder,', ',' . $module . ',') !== false) + if(strpos(',project,product,projectstory,story,bug,doc,testcase,testtask,testreport,build,projectrelease,stakeholder,', ',' . $module . ',') !== false) { if($module == 'project' and $method == 'execution') { @@ -606,7 +606,7 @@ class projectModel extends model } elseif($module == 'doc') { - $link = helper::createLink($module, 'tablecontents', "type=projectprojectID=%s#app=project"); + $link = helper::createLink($module, 'tablecontents', "type=project&objectID=%s#app=project"); } elseif($module == 'build') { From ed90476621970eb586f163047e06bd8102d9893e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 11 May 2022 16:10:07 +0800 Subject: [PATCH 085/125] * Refactoring bug search code. --- module/bug/model.php | 101 ++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 69 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 5ac9ba0e38..4b8abe39ea 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1679,32 +1679,7 @@ class bugModel extends model } } - $allProduct = "`product` = 'all'"; - $bugQuery = $this->session->projectBugQuery; - if(strpos($this->session->projectBugQuery, $allProduct) !== false) - { - $bugQuery = str_replace($allProduct, '1', $this->session->projectBugQuery); - } - if(strpos($bugQuery, ' `story` ') !== false) - { - preg_match_all("/`story`[ ]+(NOT *)?LIKE[ ]+'%([^%]*)%'/Ui", $bugQuery, $out); - if(!empty($out[2])) - { - foreach($out[2] as $searchValue) - { - $story = $this->dao->select('id')->from(TABLE_STORY)->alias('t1') - ->leftJoin(TABLE_STORYSPEC)->alias('t2')->on('t1.id=t2.story') - ->where('t1.title')->like("%$searchValue%") - ->orWhere('t1.keywords')->like("%$searchValue%") - ->orWhere('t2.spec')->like("%$searchValue%") - ->orWhere('t2.verify')->like("%$searchValue%") - ->fetchPairs('id'); - - $bugQuery = preg_replace("/`story`[ ]+(NOT[ ]*)?LIKE[ ]+'%$searchValue%'/Ui", '`story` $1 IN (' . implode(',', $story) .')', $bugQuery); - } - } - $bugQuery .= ' AND `story` != 0'; - } + $bugQuery = $this->getBugQuery($this->session->projectBugQuery); $bugs = $this->dao->select('*')->from(TABLE_BUG) ->where($bugQuery) @@ -1766,32 +1741,7 @@ class bugModel extends model } } - $allProduct = "`product` = 'all'"; - $bugQuery = $this->session->executionBugQuery; - if(strpos($this->session->executionBugQuery, $allProduct) !== false) - { - $bugQuery = str_replace($allProduct, '1', $this->session->executionBugQuery); - } - if(strpos($bugQuery, ' `story` ') !== false) - { - preg_match_all("/`story`[ ]+(NOT *)?LIKE[ ]+'%([^%]*)%'/Ui", $bugQuery, $out); - if(!empty($out[2])) - { - foreach($out[2] as $searchValue) - { - $story = $this->dao->select('id')->from(TABLE_STORY)->alias('t1') - ->leftJoin(TABLE_STORYSPEC)->alias('t2')->on('t1.id=t2.story') - ->where('t1.title')->like("%$searchValue%") - ->orWhere('t1.keywords')->like("%$searchValue%") - ->orWhere('t2.spec')->like("%$searchValue%") - ->orWhere('t2.verify')->like("%$searchValue%") - ->fetchPairs('id'); - - $bugQuery = preg_replace("/`story`[ ]+(NOT[ ]*)?LIKE[ ]+'%$searchValue%'/Ui", '`story` $1 IN (' . implode(',', $story) .')', $bugQuery); - } - } - $bugQuery .= ' AND `story` != 0'; - } + $bugQuery = $this->getBugQuery($this->session->executionBugQuery); $bugs = $this->dao->select('*')->from(TABLE_BUG) ->where($bugQuery) @@ -2743,10 +2693,37 @@ class bugModel extends model if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1'); } - $allProduct = "`product` = 'all'"; - $bugQuery = $this->session->bugQuery; + $bugQuery = $this->getBugQuery($this->session->bugQuery, $productIDList, $branch); if(is_array($productIDList)) $productIDList = implode(',', $productIDList); if(strpos($bugQuery, '`product` =') === false) $bugQuery .= ' AND `product` in (' . $productIDList . ')'; + + $bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery) + ->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi() + ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() + + ->beginIF($projectID) + ->andWhere('project', true)->eq($projectID) + ->orWhere('project')->eq(0) + ->andWhere('openedBuild')->eq('trunk') + ->markRight(1) + ->fi() + + ->andWhere('deleted')->eq(0) + ->orderBy($orderBy)->page($pager)->fetchAll(); + return $bugs; + } + + /** + * Get bug query. + * + * @param string $bugQuery + * @param string $branch + * @access public + * @return string + */ + public function getBugQuery($bugQuery, $branch = 'all') + { + $allProduct = "`product` = 'all'"; if(strpos($bugQuery, $allProduct) !== false) { $products = $this->app->user->view->products; @@ -2790,21 +2767,7 @@ class bugModel extends model } $bugQuery .= ' AND `story` != 0'; } - - $bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery) - ->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi() - ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() - - ->beginIF($projectID) - ->andWhere('project', true)->eq($projectID) - ->orWhere('project')->eq(0) - ->andWhere('openedBuild')->eq('trunk') - ->markRight(1) - ->fi() - - ->andWhere('deleted')->eq(0) - ->orderBy($orderBy)->page($pager)->fetchAll(); - return $bugs; + return $bugQuery; } /** From 3380222afc1522cfc0cef831b7e0f26fd2432d35 Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Wed, 11 May 2022 16:11:34 +0800 Subject: [PATCH 086/125] * Fix build action menu bug. --- module/build/view/view.html.php | 2 +- module/caselib/view/browse.html.php | 2 +- module/caselib/view/view.html.php | 2 +- module/execution/view/view.html.php | 2 +- module/product/view/all.html.php | 2 +- module/product/view/view.html.php | 2 +- module/productplan/view/browsebylist.html.php | 2 +- module/productplan/view/view.html.php | 2 +- module/project/view/view.html.php | 2 +- module/story/view/view.html.php | 2 +- module/task/view/view.html.php | 2 +- module/testcase/view/view.html.php | 2 +- module/testsuite/view/browse.html.php | 2 +- module/testsuite/view/view.html.php | 2 +- module/testtask/view/browse.html.php | 2 +- module/testtask/view/view.html.php | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 3adcc8d6f1..b2dad81742 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -48,7 +48,7 @@ tbody tr td:first-child input {display: none;}

    - buildOperateMenu($build, 'view');?> + build->buildOperateMenu($build, 'view');?>
    diff --git a/module/caselib/view/browse.html.php b/module/caselib/view/browse.html.php index 35101bfe14..980fcde929 100644 --- a/module/caselib/view/browse.html.php +++ b/module/caselib/view/browse.html.php @@ -157,7 +157,7 @@ js::set('flow', $config->global->flow); processStatus('testcase', $case);?> " . $this->loadModel('flow')->getFieldValue($extendField, $case) . "";?> - buildOperateMenu($case, 'browse');?> + caselib->buildOperateMenu($case, 'browse');?> diff --git a/module/caselib/view/view.html.php b/module/caselib/view/view.html.php index 868c67dccc..0bc7645556 100644 --- a/module/caselib/view/view.html.php +++ b/module/caselib/view/view.html.php @@ -39,7 +39,7 @@
    ";?> - buildOperateMenu($lib, 'view');?> + caselib->buildOperateMenu($lib, 'view');?>
    diff --git a/module/execution/view/view.html.php b/module/execution/view/view.html.php index 2bc2913fd1..90ec222e0e 100644 --- a/module/execution/view/view.html.php +++ b/module/execution/view/view.html.php @@ -148,7 +148,7 @@
    session->executionList ? $this->session->executionList : inlink('browse', "executionID=$execution->id");?> - buildOperateMenu($execution, 'view');?> + execution->buildOperateMenu($execution, 'view');?>
    diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index 83b96d0c5c..3a065df1ea 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -214,7 +214,7 @@ plans;?> releases;?> " . $this->loadModel('flow')->getFieldValue($extendField, $product) . "";?> - buildOperateMenu($product, 'browse');?> + product->buildOperateMenu($product, 'browse');?> diff --git a/module/product/view/view.html.php b/module/product/view/view.html.php index 9dff1daa07..dd670efb83 100644 --- a/module/product/view/view.html.php +++ b/module/product/view/view.html.php @@ -161,7 +161,7 @@ $browseLink = $this->session->productList ? $this->session->productList : inlink('browse', "productID=$product->id"); common::printBack($browseLink); - if(!$product->deleted) echo $this->buildOperateMenu($product, 'view'); + if(!$product->deleted) echo $this->product->buildOperateMenu($product, 'view'); ?> diff --git a/module/productplan/view/browsebylist.html.php b/module/productplan/view/browsebylist.html.php index db0c2e0b73..b4bbe598f4 100644 --- a/module/productplan/view/browsebylist.html.php +++ b/module/productplan/view/browsebylist.html.php @@ -144,7 +144,7 @@
    " . $this->loadModel('flow')->getFieldValue($extendField, $plan) . "";?> - buildOperateMenu($plan, 'browse'); ?> + productplan->buildOperateMenu($plan, 'browse'); ?> diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index cff6af86a6..76002e70b1 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -38,7 +38,7 @@
    - deleted && !isonlybody()) echo $this->buildOperateMenu($plan, 'view'); ?> + deleted && !isonlybody()) echo $this->productplan->buildOperateMenu($plan, 'view'); ?>
    diff --git a/module/project/view/view.html.php b/module/project/view/view.html.php index 8986fb8d76..cca23ade7a 100644 --- a/module/project/view/view.html.php +++ b/module/project/view/view.html.php @@ -98,7 +98,7 @@
    session->projectList ? $this->session->projectList : inlink('browse');?> - buildOperateMenu($project, 'view');?> + project->buildOperateMenu($project, 'view');?>
    diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index 5c6f57ab9b..63f42cf8b9 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -200,7 +200,7 @@
    ";?> - deleted) echo $this->buildOperateMenu($story, 'view');?> + deleted) echo $this->story->buildOperateMenu($story, 'view');?> diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 8cab2c2c8e..ec607004ca 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -170,7 +170,7 @@ ";?> executionList = $execution;?> - buildOperateMenu($task, 'view');?> + task->buildOperateMenu($task, 'view');?> diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 28a613dd52..afd9e223d8 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -116,7 +116,7 @@ isLibCase = $isLibCase;?> caseFails = $caseFails;?> runID = $runID;?> - buildOperateMenu($case, 'view');?> + testcase->buildOperateMenu($case, 'view');?> diff --git a/module/testsuite/view/browse.html.php b/module/testsuite/view/browse.html.php index 70fd6b4070..6503d4d34a 100644 --- a/module/testsuite/view/browse.html.php +++ b/module/testsuite/view/browse.html.php @@ -70,7 +70,7 @@ addedDate;?> " . $this->loadModel('flow')->getFieldValue($extendField, $suite) . "";?> - buildOperateMenu($suite, 'browse');?> + testsuite->buildOperateMenu($suite, 'browse');?> diff --git a/module/testsuite/view/view.html.php b/module/testsuite/view/view.html.php index 6a44d631bc..efdb7d4a9f 100644 --- a/module/testsuite/view/view.html.php +++ b/module/testsuite/view/view.html.php @@ -31,7 +31,7 @@ deleted and $canBeChanged) { - echo $this->buildOperateMenu($suite, 'view'); + echo $this->testsuite->buildOperateMenu($suite, 'view'); } ?> diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index e417cb11f6..fbd46f6bb1 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -102,7 +102,7 @@ $status = $this->session->testTaskVersionStatus; " . $this->loadModel('flow')->getFieldValue($extendField, $task) . "";?> - buildOperateMenu($task, 'browse');?> + testtask->buildOperateMenu($task, 'browse');?> diff --git a/module/testtask/view/view.html.php b/module/testtask/view/view.html.php index 7324b9d56e..7bb7fa2871 100644 --- a/module/testtask/view/view.html.php +++ b/module/testtask/view/view.html.php @@ -51,7 +51,7 @@
    ' . $lang->goback, '', 'btn btn-secondary');?>
    - buildOperateMenu($task, 'view');?> + testtask->buildOperateMenu($task, 'view');?>
    From 160c0fbcaaa7ae965b7d106de1b7b5df9140d2f3 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 11 May 2022 08:13:06 +0000 Subject: [PATCH 087/125] * Fix bug #53656. --- module/product/control.php | 8 ++++++-- module/product/view/all.html.php | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index e6d17166e3..eea2e15688 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1197,7 +1197,7 @@ class product extends control * @access public * @return void */ - public function all($browseType = 'noclosed', $orderBy = 'order_asc', $param = 0) + public function all($browseType = 'noclosed', $orderBy = 'order_asc', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Load module and set session. */ $this->loadModel('program'); @@ -1211,8 +1211,11 @@ class product extends control $this->product->setMenu($productID); } + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + /* Process product structure. */ - $productStats = $this->product->getStats($orderBy, '', $browseType, '', 'story', '', $queryID); + $productStats = $this->product->getStats($orderBy, $pager, $browseType, '', 'story', '', $queryID); $productStructure = $this->product->statisticProgram($productStats); $actionURL = $this->createLink('product', 'all', "browseType=bySearch&orderBy=order_asc&queryID=myQueryID"); @@ -1226,6 +1229,7 @@ class product extends control $this->view->productStructure = $productStructure; $this->view->orderBy = $orderBy; $this->view->browseType = $browseType; + $this->view->pager = $pager; $this->display(); } diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index 83b96d0c5c..f3df14cae4 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -222,17 +222,18 @@ - - From 6d61b450685ad4fb01fa33e1d47f7069d4743ec7 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 11 May 2022 16:15:07 +0800 Subject: [PATCH 088/125] * Refactoring bug search code. --- module/bug/model.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 4b8abe39ea..9ff6b81d69 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2693,10 +2693,15 @@ class bugModel extends model if($this->session->bugQuery == false) $this->session->set('bugQuery', ' 1 = 1'); } - $bugQuery = $this->getBugQuery($this->session->bugQuery, $productIDList, $branch); + $bugQuery = $this->getBugQuery($this->session->bugQuery); + if(is_array($productIDList)) $productIDList = implode(',', $productIDList); if(strpos($bugQuery, '`product` =') === false) $bugQuery .= ' AND `product` in (' . $productIDList . ')'; + $allBranch = "`branch` = 'all'"; + if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('0','$branch')"; + if(strpos($bugQuery, $allBranch) !== false) $bugQuery = str_replace($allBranch, '1', $bugQuery); + $bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery) ->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi() ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() @@ -2717,11 +2722,10 @@ class bugModel extends model * Get bug query. * * @param string $bugQuery - * @param string $branch * @access public * @return string */ - public function getBugQuery($bugQuery, $branch = 'all') + public function getBugQuery($bugQuery) { $allProduct = "`product` = 'all'"; if(strpos($bugQuery, $allProduct) !== false) @@ -2731,10 +2735,6 @@ class bugModel extends model $bugQuery = $bugQuery . ' AND `product` ' . helper::dbIN($products); } - $allBranch = "`branch` = 'all'"; - if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('0','$branch')"; - if(strpos($bugQuery, $allBranch) !== false) $bugQuery = str_replace($allBranch, '1', $bugQuery); - $allProject = "`project` = 'all'"; if(strpos($bugQuery, $allProject) !== false) { From ffed15713bfc7ebbbaf4defc676b326ad4b5ebf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 16:15:54 +0800 Subject: [PATCH 089/125] *Optimize the code. --- module/project/model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/project/model.php b/module/project/model.php index 65b2b5717f..6cfcc799d9 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -637,6 +637,8 @@ class projectModel extends model * */ public function getBySearch($projectQuery) { + $flag = stripos($projectQuery, 'and') + 3; + $projectQuery = substr_replace($projectQuery, " (`type` = 'project') and", $flag, 0); $projects = $this->dao->select('*')->from(TABLE_PROJECT) ->where($projectQuery) ->fetchAll(); From 0aa36bd6e5ab9c5e4a3a5fa7c2cfa0635e1970ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 16:25:43 +0800 Subject: [PATCH 090/125] *Optimize the code. --- module/project/config.php | 2 +- module/project/lang/zh-cn.php | 2 +- module/project/model.php | 3 +-- module/project/view/browsebylist.html.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/module/project/config.php b/module/project/config.php index 9c8be57d6b..9fb9286c56 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -136,7 +136,7 @@ $config->project->search['module'] = 'project'; $config->project->search['fields']['name'] = $lang->project->name; $config->project->search['fields']['code'] = $lang->project->code; $config->project->search['fields']['id'] = $lang->project->id; -$config->project->search['fields']['model'] = $lang->project->manageType; +$config->project->search['fields']['model'] = $lang->project->model; $config->project->search['fields']['parent'] = $lang->project->parent; $config->project->search['fields']['status'] = $lang->project->projectStatus; $config->project->search['fields']['desc'] = $lang->project->desc; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index ba4ec95a1f..b60f1e6366 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -66,7 +66,6 @@ $lang->project->id = '项目编号'; $lang->project->project = '所属项目'; $lang->project->stage = '阶段'; $lang->project->model = '项目管理方式'; -$lang->project->manageType = '管理类型'; $lang->project->PM = '负责人'; $lang->project->PO = '项目负责人'; $lang->project->QD = '测试负责人'; @@ -163,6 +162,7 @@ $lang->project->branch = '所属分支'; $lang->project->plan = '所属计划'; $lang->project->createKanban = '添加看板'; $lang->project->kanban = '看板'; +$lang->project->search = '搜索'; /* Project Kanban. */ $lang->project->typeList = array(); diff --git a/module/project/model.php b/module/project/model.php index 6cfcc799d9..458bac3853 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -637,10 +637,9 @@ class projectModel extends model * */ public function getBySearch($projectQuery) { - $flag = stripos($projectQuery, 'and') + 3; - $projectQuery = substr_replace($projectQuery, " (`type` = 'project') and", $flag, 0); $projects = $this->dao->select('*')->from(TABLE_PROJECT) ->where($projectQuery) + ->andWhere('type')->eq('project') ->fetchAll(); return $projects; } diff --git a/module/project/view/browsebylist.html.php b/module/project/view/browsebylist.html.php index df3626ef01..052a85fe84 100644 --- a/module/project/view/browsebylist.html.php +++ b/module/project/view/browsebylist.html.php @@ -40,7 +40,7 @@ $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?> - + project->search;?>
    From 008236e9976b4ee95fd3ce1405a363e3af59923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 08:29:42 +0000 Subject: [PATCH 091/125] Update zh-cn.php --- module/project/lang/zh-cn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index b60f1e6366..19108aa0e6 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -229,7 +229,7 @@ $lang->project->currencySymbol['NZD'] = 'NZ$'; $lang->project->currencySymbol['THB'] = '฿'; $lang->project->currencySymbol['SGD'] = 'S$'; -$lang->project->modelList[''] = ""; +$lang->project->modelList[''] = ""; $lang->project->modelList['scrum'] = "Scrum"; $lang->project->modelList['waterfall'] = "瀑布"; $lang->project->modelList['kanban'] = "看板"; From b5093f3a1ba9ca5f175bf8506dbe86ec0613cd60 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 11 May 2022 08:32:50 +0000 Subject: [PATCH 092/125] * Code for task#53657 --- module/program/config.php | 28 ++++++++++++ module/program/control.php | 24 ++++++++--- module/program/js/browse.js | 2 +- module/program/lang/en.php | 59 +++++++++++++------------ module/program/lang/zh-cn.php | 59 +++++++++++++------------ module/program/model.php | 67 +++++++++++++++++++++++++---- module/program/view/browse.html.php | 3 ++ 7 files changed, 171 insertions(+), 71 deletions(-) diff --git a/module/program/config.php b/module/program/config.php index d93159b907..15afcb8278 100644 --- a/module/program/config.php +++ b/module/program/config.php @@ -22,3 +22,31 @@ $config->program->sortFields = new stdclass(); $config->program->sortFields->id = 'id'; $config->program->sortFields->begin = 'begin'; $config->program->sortFields->end = 'end'; + +global $lang; +$config->program->search['module'] = 'program'; +$config->program->search['fields']['name'] = $lang->program->name; +$config->program->search['fields']['status'] = $lang->program->status; +$config->program->search['fields']['desc'] = $lang->program->desc; +$config->program->search['fields']['PM'] = $lang->program->PM; +$config->program->search['fields']['openedDate'] = $lang->program->openedDate; +$config->program->search['fields']['begin'] = $lang->program->begin; +$config->program->search['fields']['end'] = $lang->program->end; +$config->program->search['fields']['openedBy'] = $lang->program->openedBy; +$config->program->search['fields']['lastEditedDate'] = $lang->program->lastEditedDate; +$config->program->search['fields']['realBegan'] = $lang->program->realBegin; +$config->program->search['fields']['realEnd'] = $lang->program->realEnd; +$config->program->search['fields']['closedDate'] = $lang->program->closedDate; + +$config->program->search['params']['name'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); +$config->program->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => array('' => '') + $lang->program->statusList); +$config->program->search['params']['desc'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); +$config->program->search['params']['PM'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); +$config->program->search['params']['openedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['begin'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['end'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['openedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); +$config->program->search['params']['lastEditedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['realBegan'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['realEnd'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); +$config->program->search['params']['closedDate'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); diff --git a/module/program/control.php b/module/program/control.php index 3ef0331eb9..780397b955 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -26,7 +26,7 @@ class program extends control * @access public * @return void */ - public function browse($status = 'all', $orderBy = 'order_asc', $recTotal = 0, $recPerPage = 10, $pageID = 1) + public function browse($status = 'all', $orderBy = 'order_asc', $recTotal = 0, $recPerPage = 10, $pageID = 1, $param = 0) { if(common::hasPriv('program', 'create')) $this->lang->pageActions = html::a($this->createLink('program', 'create'), " " . $this->lang->program->create, '', "class='btn btn-primary create-program-btn'"); @@ -44,10 +44,18 @@ class program extends control } else { - $topPrograms = $this->program->getList($status, $orderBy, $pager, 'topProgram'); - $programIDs = array(); - foreach($topPrograms as $programID => $program) $programIDs[] = $programID; - $programs = $this->program->getList($status, $orderBy, null, 'byTopIDs', $programIDs); + if(strtolower($status) == 'bysearch') + { + $queryID = (int)$param; + $programs = $this->program->getListBySearch($orderBy, $pager, $queryID); + } + else + { + $topPrograms = $this->program->getList($status, $orderBy, $pager, 'top'); + $programIDs = array(); + foreach($topPrograms as $programID => $program) $programIDs[] = $programID; + $programs = $this->program->getList($status, $orderBy, null, 'child', $programIDs); + } } /* Get PM id list. */ @@ -58,6 +66,12 @@ class program extends control } $PMList = $this->loadModel('user')->getListByAccounts($accounts, 'account'); + /* Build the search form. */ + $actionURL = $this->createLink('program', 'browse', "status=bySearch&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}¶m=myQueryID"); + $this->config->program->search['onMenuBar'] = 'yes'; + $this->config->program->search['actionURL'] = $actionURL; + $this->loadModel('search')->setSearchParams($this->config->program->search); + $this->view->title = $this->lang->program->browse; $this->view->position[] = $this->lang->program->browse; diff --git a/module/program/js/browse.js b/module/program/js/browse.js index 6526d35fc9..dc14dca89b 100644 --- a/module/program/js/browse.js +++ b/module/program/js/browse.js @@ -45,7 +45,7 @@ $(function() }); var myPager = $('.pager').data('zui.pager'); - if(myPager) + if(status != 'bySearch' && myPager) { myPager.lang.pageSize = pageSize; myPager.set(); diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 62bf6dce4f..754323b538 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -1,33 +1,36 @@ program->id = 'ID'; -$lang->program->name = 'Name'; -$lang->program->template = 'Template'; -$lang->program->category = 'Type'; -$lang->program->desc = 'Description'; -$lang->program->status = 'Status'; -$lang->program->PM = 'Manager'; -$lang->program->budget = 'Budget'; -$lang->program->budgetUnit = 'Budget Unit'; -$lang->program->begin = 'Begin'; -$lang->program->end = 'End'; -$lang->program->stage = 'Stage'; -$lang->program->type = 'Type'; -$lang->program->pri = 'Priority'; -$lang->program->parent = 'Parent'; -$lang->program->exchangeRate = 'Exchange Rate'; -$lang->program->openedBy = 'OpenedBy'; -$lang->program->openedDate = 'OpenedDate'; -$lang->program->closedBy = 'ClosedBy'; -$lang->program->closedDate = 'ClosedDate'; -$lang->program->canceledBy = 'CanceledBy'; -$lang->program->canceledDate = 'CanceledDate'; -$lang->program->team = 'Team'; -$lang->program->order = 'Rank'; -$lang->program->days = 'Days'; -$lang->program->acl = 'Access Control'; -$lang->program->whitelist = 'WhiteList'; -$lang->program->deleted = 'Deleted'; +$lang->program->id = 'ID'; +$lang->program->name = 'Name'; +$lang->program->template = 'Template'; +$lang->program->category = 'Type'; +$lang->program->desc = 'Description'; +$lang->program->status = 'Status'; +$lang->program->PM = 'Manager'; +$lang->program->budget = 'Budget'; +$lang->program->budgetUnit = 'Budget Unit'; +$lang->program->begin = 'Begin'; +$lang->program->end = 'End'; +$lang->program->realBegin = 'Actual Begin'; +$lang->program->realEnd = 'Actual End'; +$lang->program->stage = 'Stage'; +$lang->program->type = 'Type'; +$lang->program->pri = 'Priority'; +$lang->program->parent = 'Parent'; +$lang->program->exchangeRate = 'Exchange Rate'; +$lang->program->openedBy = 'OpenedBy'; +$lang->program->openedDate = 'OpenedDate'; +$lang->program->closedBy = 'ClosedBy'; +$lang->program->closedDate = 'ClosedDate'; +$lang->program->canceledBy = 'CanceledBy'; +$lang->program->canceledDate = 'CanceledDate'; +$lang->program->lastEditedDate = 'LastEditedDate'; +$lang->program->team = 'Team'; +$lang->program->order = 'Rank'; +$lang->program->days = 'Days'; +$lang->program->acl = 'Access Control'; +$lang->program->whitelist = 'WhiteList'; +$lang->program->deleted = 'Deleted'; /* Actions. */ $lang->program->common = 'Program'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index 6afc1ca4b4..f4279b673c 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -1,33 +1,36 @@ program->id = '编号'; -$lang->program->name = '项目集名称'; -$lang->program->template = '项目集模板'; -$lang->program->category = '项目集类型'; -$lang->program->desc = '项目集描述'; -$lang->program->status = '状态'; -$lang->program->PM = '负责人'; -$lang->program->budget = '预算'; -$lang->program->budgetUnit = '预算单位'; -$lang->program->begin = '计划开始'; -$lang->program->end = '计划完成'; -$lang->program->stage = '阶段'; -$lang->program->type = '类型'; -$lang->program->pri = '优先级'; -$lang->program->parent = '父项目集'; -$lang->program->exchangeRate = '汇率'; -$lang->program->openedBy = '由谁创建'; -$lang->program->openedDate = '创建日期'; -$lang->program->closedBy = '由谁关闭'; -$lang->program->closedDate = '关闭日期'; -$lang->program->canceledBy = '由谁取消'; -$lang->program->canceledDate = '取消日期'; -$lang->program->team = '团队'; -$lang->program->order = '排序'; -$lang->program->days = '可用工作日'; -$lang->program->acl = '访问控制'; -$lang->program->whitelist = '白名单'; -$lang->program->deleted = '已删除'; +$lang->program->id = '编号'; +$lang->program->name = '项目集名称'; +$lang->program->template = '项目集模板'; +$lang->program->category = '项目集类型'; +$lang->program->desc = '项目集描述'; +$lang->program->status = '状态'; +$lang->program->PM = '负责人'; +$lang->program->budget = '预算'; +$lang->program->budgetUnit = '预算单位'; +$lang->program->begin = '计划开始'; +$lang->program->end = '计划完成'; +$lang->program->realBegin = '实际开始'; +$lang->program->realEnd = '实际完成'; +$lang->program->stage = '阶段'; +$lang->program->type = '类型'; +$lang->program->pri = '优先级'; +$lang->program->parent = '父项目集'; +$lang->program->exchangeRate = '汇率'; +$lang->program->openedBy = '由谁创建'; +$lang->program->openedDate = '创建日期'; +$lang->program->closedBy = '由谁关闭'; +$lang->program->closedDate = '关闭日期'; +$lang->program->canceledBy = '由谁取消'; +$lang->program->canceledDate = '取消日期'; +$lang->program->lastEditedDate = '最后编辑'; +$lang->program->team = '团队'; +$lang->program->order = '排序'; +$lang->program->days = '可用工作日'; +$lang->program->acl = '访问控制'; +$lang->program->whitelist = '白名单'; +$lang->program->deleted = '已删除'; /* Actions. */ $lang->program->common = '项目集'; diff --git a/module/program/model.php b/module/program/model.php index 465e3c7003..45ec48e1c4 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -130,18 +130,21 @@ class programModel extends model * @param string $status * @param string $orderBy * @param object $pager - * @param string $filter topProgram|byTopIDs - * @param mixed $filterParams + * @param string $type top|child + * @param mixed $typeParams * @access public * @return array */ - public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $filter = '', $filterParams = '') + public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $typeParams = '') { - $filterSql = ''; - if($filter === 'byTopIDs') + $ids = array(); + if($type === 'child') { - foreach($filterParams as $topID) $filterSql .= "path like ',{$topID},%' or "; - if($filterSql) $filterSql = '(' . substr($filterSql, 0, -3) . ')'; // Remove last or. + foreach($typeParams as $topID) + { + $topIDs = $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); + if($topIDs) $ids = array_merge($ids, $topIDs); + } } return $this->dao->select('*')->from(TABLE_PROGRAM) @@ -155,8 +158,54 @@ class programModel extends model ->markRight(2) ->beginIF($status != 'all')->andWhere('status')->eq($status)->fi() ->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi() - ->beginIF($filter === 'topProgram')->andWhere('parent')->eq(0)->fi() - ->beginIF(!empty($filterSql))->andWhere($filterSql)->fi() + ->beginIF($type === 'top')->andWhere('parent')->eq(0)->fi() + ->beginIF(!empty($ids))->andWhere('id')->in($ids)->fi() + ->orderBy($orderBy) + ->page($pager) + ->fetchAll('id'); + } + + /** + * Get program list by search. + * + * @param string $orderBy + * @param object $pager + * @param int $queryID + * @access public + * @return void + */ + public function getListBySearch($orderBy = 'id_asc', $pager = NULL, $queryID = 0) + { + if($queryID) + { + $query = $this->loadModel('search')->getQuery($queryID); + if($query) + { + $this->session->set('programQuery', $query->sql); + $this->session->set('programForm', $query->form); + } + else + { + $this->session->set('programQuery', ' 1 = 1'); + } + } + else + { + if($this->session->programQuery == false) $this->session->set('programQuery', ' 1 = 1'); + } + $query = $this->session->programQuery; + + return $this->dao->select('*')->from(TABLE_PROGRAM) + ->where('deleted')->eq(0) + ->andWhere('vision')->eq($this->config->vision) + ->andWhere('((type')->eq('program') + ->beginIF(!$this->app->user->admin and $this->app->rawMethod != 'browse')->andWhere('id')->in($this->app->user->view->programs)->fi() + ->markRight(1) + ->orWhere('(type')->eq('project') + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() + ->markRight(2) + ->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi() + ->beginIF($query)->andWhere($query)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); diff --git a/module/program/view/browse.html.php b/module/program/view/browse.html.php index e26b262b62..abbf959b56 100644 --- a/module/program/view/browse.html.php +++ b/module/program/view/browse.html.php @@ -28,6 +28,7 @@ $lang->program->showClosed), '', $this->cookie->showClosed ? 'checked=checked' : '');?> $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '');?> + user->search;?>
    ' . $lang->project->create, '', 'class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');?> @@ -36,6 +37,7 @@
    +

    program->noProgram;?> @@ -44,6 +46,7 @@

    +
    Date: Wed, 11 May 2022 16:40:48 +0800 Subject: [PATCH 093/125] *Optimize the code. --- module/project/config.php | 2 +- module/project/lang/en.php | 2 ++ module/project/lang/zh-cn.php | 2 -- module/project/view/browsebylist.html.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/project/config.php b/module/project/config.php index 9fb9286c56..5330fe9321 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -138,7 +138,7 @@ $config->project->search['fields']['code'] = $lang->project->code; $config->project->search['fields']['id'] = $lang->project->id; $config->project->search['fields']['model'] = $lang->project->model; $config->project->search['fields']['parent'] = $lang->project->parent; -$config->project->search['fields']['status'] = $lang->project->projectStatus; +$config->project->search['fields']['status'] = $lang->project->status; $config->project->search['fields']['desc'] = $lang->project->desc; $config->project->search['fields']['PM'] = $lang->project->PM; $config->project->search['fields']['openedDate'] = $lang->project->openedDate; diff --git a/module/project/lang/en.php b/module/project/lang/en.php index 8f30c43aac..c44e458fe8 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -226,6 +226,7 @@ $lang->project->currencySymbol['NZD'] = 'NZ$'; $lang->project->currencySymbol['THB'] = '฿'; $lang->project->currencySymbol['SGD'] = 'S$'; +$lang->project->modelList[''] = ''; $lang->project->modelList['scrum'] = "Scrum"; $lang->project->modelList['waterfall'] = "CMMI"; $lang->project->modelList['kanban'] = "Kanban"; @@ -256,6 +257,7 @@ $lang->project->kanbanSubAclList['program'] = 'Open in the program (all upper-le $lang->project->authList['extend'] = 'Inherit (system privilege and project privilege)'; $lang->project->authList['reset'] = 'Reset (project privilege only)'; +$lang->project->statusList[''] = ''; $lang->project->statusList['wait'] = 'Waiting'; $lang->project->statusList['doing'] = 'Doing'; $lang->project->statusList['suspended'] = 'Suspended'; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index b60f1e6366..4ef428fc61 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -79,7 +79,6 @@ $lang->project->begin = '计划开始'; $lang->project->end = '计划完成'; $lang->project->status = '状态'; $lang->project->subStatus = '子状态'; -$lang->project->projectStatus = '项目状态'; $lang->project->type = '项目类型'; $lang->project->lifetime = '项目周期'; $lang->project->attribute = '阶段类型'; @@ -162,7 +161,6 @@ $lang->project->branch = '所属分支'; $lang->project->plan = '所属计划'; $lang->project->createKanban = '添加看板'; $lang->project->kanban = '看板'; -$lang->project->search = '搜索'; /* Project Kanban. */ $lang->project->typeList = array(); diff --git a/module/project/view/browsebylist.html.php b/module/project/view/browsebylist.html.php index 052a85fe84..c459a4c95f 100644 --- a/module/project/view/browsebylist.html.php +++ b/module/project/view/browsebylist.html.php @@ -40,7 +40,7 @@ $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?> - project->search;?> + search->common;?>
    From 43984d13b4e1b52e8fba5fb1a6106ea949a8b241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 08:45:54 +0000 Subject: [PATCH 094/125] Update model.php --- module/project/model.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 458bac3853..c2abf92f62 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -637,11 +637,10 @@ class projectModel extends model * */ public function getBySearch($projectQuery) { - $projects = $this->dao->select('*')->from(TABLE_PROJECT) + return $this->dao->select('*')->from(TABLE_PROJECT) ->where($projectQuery) ->andWhere('type')->eq('project') ->fetchAll(); - return $projects; } /* From 675d2c2e86d04a51234ffe7f14d55ba887e488d6 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Wed, 11 May 2022 08:49:22 +0000 Subject: [PATCH 095/125] * Fix bug #22339. --- module/execution/js/edit.js | 2 +- "module/execution/view/\\" | 142 ++++++++++++++++++++++++++++ module/execution/view/edit.html.php | 2 +- 3 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 "module/execution/view/\\" diff --git a/module/execution/js/edit.js b/module/execution/js/edit.js index 0c09b6bfe8..3955629251 100644 --- a/module/execution/js/edit.js +++ b/module/execution/js/edit.js @@ -71,6 +71,6 @@ $(function() { $('#submit').after(""); } - $("#syncStories").val(confirm(confirmSyncStories) ? 'yes' : 'no'); + $("#syncStories").val(confirm(confirmSync) ? 'yes' : 'no'); }); }) diff --git "a/module/execution/view/\\" "b/module/execution/view/\\" new file mode 100644 index 0000000000..aa7fc31b38 --- /dev/null +++ "b/module/execution/view/\\" @@ -0,0 +1,142 @@ + + * @package ZenTaoPMS + * @version $Id: index.html.php 4129 2013-01-18 01:58:14Z wwccss $ + */ +?> + + +
    +
    +

    execution->batchEdit;?>

    +
    + createLink('custom', 'ajaxSaveCustomFields', 'module=execution§ion=custom&key=batchEditFields')?> + +
    +
    + execution->edit->requiredFields) as $field) + { + if($field) + { + $requiredFields[$field] = ''; + if(strpos(",{$config->execution->customBatchEditFields},", ",{$field},") !== false) $visibleFields[$field] = ''; + } + } + $minWidth = (count($visibleFields) > 5) ? 'w-150px' : ''; + + $name = $from == 'execution' ? 'execName' : 'name'; + $code = $from == 'execution' ? 'execCode' : 'code'; + $PM = $from == 'execution' ? 'execPM' : 'PM'; + $type = $from == 'execution' ? 'execType' : 'type'; + $desc = $from == 'execution' ? 'execDesc' : 'desc'; + $status = $from == 'execution' ? 'execStatus' : 'status'; + + ?> +
    '> +
    + + + + + systemMode == 'new' and isset($project) and $project->model == 'scrum'):?> + + + + + + + + + + + + + + + + execution->getFlowExtendFields(); + foreach($extendFields as $extendField) echo ""; + ?> + + + + + config->moreLinks["PM"])) $this->config->moreLinks["PMs[$executionID]"] = $this->config->moreLinks["PM"]; + if(!empty($this->config->moreLinks["PO"])) $this->config->moreLinks["POs[$executionID]"] = $this->config->moreLinks["PO"]; + if(!empty($this->config->moreLinks["QD"])) $this->config->moreLinks["QDs[$executionID]"] = $this->config->moreLinks["QD"]; + if(!empty($this->config->moreLinks["RD"])) $this->config->moreLinks["RDs[$executionID]"] = $this->config->moreLinks["RD"]; + ?> + + + systemMode == 'new' and isset($project) and $project->model == 'scrum'):?> + + + + + + + + + + + + + + + + control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $executions[$executionID], $extendField->field . "[{$executionID}]") . "";?> + + config->moreLinks["PMs[$executionID]"])) unset($this->config->moreLinks["PMs[$executionID]"]); + if(isset($this->config->moreLinks["POs[$executionID]"])) unset($this->config->moreLinks["POs[$executionID]"]); + if(isset($this->config->moreLinks["QDs[$executionID]"])) unset($this->config->moreLinks["QDs[$executionID]"]); + if(isset($this->config->moreLinks["RDs[$executionID]"])) unset($this->config->moreLinks["RDs[$executionID]"]); + ?> + + + + + + + +
    idAB;?>execution->projectName;?>execution->$name;?>execution->$code;?>'>execution->$PM;?>'>execution->PO;?>'>execution->QD;?>'>execution->RD;?>'>execution->$type;?>'>execution->$status;?>execution->begin;?>execution->end;?>'>execution->$desc;?>'>execution->teamname;?>'>execution->days;?>{$extendField->name}
    project, "class='form-control picker-select' onchange='sync($executionID, {$executions[$executionID]->project})'");?>name, "class='form-control'");?>code, "class='form-control'");?>' style='overflow:visible'>PM, "class='form-control picker-select'");?>' style='overflow:visible'>PO, "class='form-control picker-select'");?>' style='overflow:visible'>QD, "class='form-control picker-select'");?>' style='overflow:visible'>RD, "class='form-control picker-select'");?>'> + type == 'stage') + { + echo html::select("attributes[$executionID]", $lang->stage->typeList, $executions[$executionID]->attribute, 'class=form-control'); + } + else + { + echo html::select("lifetimes[$executionID]", $lang->execution->lifeTimeList, $executions[$executionID]->lifetime, 'class=form-control'); + } + ?> + '>execution->statusList, $executions[$executionID]->status, 'class=form-control');?>begin, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?>end, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?>'> desc, "rows='1' class='form-control autosize'");?>'>team, "class='form-control'");?>'> +
    + days, "class='form-control'");?> + execution->day;?> +
    +
    + + goback, $this->session->executionList, 'self', '', 'btn btn-wide');;?> +
    +
    +
    +
    +execution->weekend);?> +execution->confirmSync);?> +project);?> + diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 7c664b9c0a..449d728f84 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -220,6 +220,6 @@ execution->notAllowRemoveProducts);?> -execution->confirmSyncStories);?> +execution->confirmSync);?> systemMode);?> From a0f2b068dc9287e98516d43da674ed5a26c53cec Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Wed, 11 May 2022 08:51:36 +0000 Subject: [PATCH 096/125] * Fix bug #22339. --- "module/execution/view/\\" | 142 ------------------------------------- 1 file changed, 142 deletions(-) delete mode 100644 "module/execution/view/\\" diff --git "a/module/execution/view/\\" "b/module/execution/view/\\" deleted file mode 100644 index aa7fc31b38..0000000000 --- "a/module/execution/view/\\" +++ /dev/null @@ -1,142 +0,0 @@ - - * @package ZenTaoPMS - * @version $Id: index.html.php 4129 2013-01-18 01:58:14Z wwccss $ - */ -?> - - -
    -
    -

    execution->batchEdit;?>

    -
    - createLink('custom', 'ajaxSaveCustomFields', 'module=execution§ion=custom&key=batchEditFields')?> - -
    -
    - execution->edit->requiredFields) as $field) - { - if($field) - { - $requiredFields[$field] = ''; - if(strpos(",{$config->execution->customBatchEditFields},", ",{$field},") !== false) $visibleFields[$field] = ''; - } - } - $minWidth = (count($visibleFields) > 5) ? 'w-150px' : ''; - - $name = $from == 'execution' ? 'execName' : 'name'; - $code = $from == 'execution' ? 'execCode' : 'code'; - $PM = $from == 'execution' ? 'execPM' : 'PM'; - $type = $from == 'execution' ? 'execType' : 'type'; - $desc = $from == 'execution' ? 'execDesc' : 'desc'; - $status = $from == 'execution' ? 'execStatus' : 'status'; - - ?> -
    '> -
    - - - - - systemMode == 'new' and isset($project) and $project->model == 'scrum'):?> - - - - - - - - - - - - - - - - execution->getFlowExtendFields(); - foreach($extendFields as $extendField) echo ""; - ?> - - - - - config->moreLinks["PM"])) $this->config->moreLinks["PMs[$executionID]"] = $this->config->moreLinks["PM"]; - if(!empty($this->config->moreLinks["PO"])) $this->config->moreLinks["POs[$executionID]"] = $this->config->moreLinks["PO"]; - if(!empty($this->config->moreLinks["QD"])) $this->config->moreLinks["QDs[$executionID]"] = $this->config->moreLinks["QD"]; - if(!empty($this->config->moreLinks["RD"])) $this->config->moreLinks["RDs[$executionID]"] = $this->config->moreLinks["RD"]; - ?> - - - systemMode == 'new' and isset($project) and $project->model == 'scrum'):?> - - - - - - - - - - - - - - - - control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->loadModel('flow')->getFieldControl($extendField, $executions[$executionID], $extendField->field . "[{$executionID}]") . "";?> - - config->moreLinks["PMs[$executionID]"])) unset($this->config->moreLinks["PMs[$executionID]"]); - if(isset($this->config->moreLinks["POs[$executionID]"])) unset($this->config->moreLinks["POs[$executionID]"]); - if(isset($this->config->moreLinks["QDs[$executionID]"])) unset($this->config->moreLinks["QDs[$executionID]"]); - if(isset($this->config->moreLinks["RDs[$executionID]"])) unset($this->config->moreLinks["RDs[$executionID]"]); - ?> - - - - - - - -
    idAB;?>execution->projectName;?>execution->$name;?>execution->$code;?>'>execution->$PM;?>'>execution->PO;?>'>execution->QD;?>'>execution->RD;?>'>execution->$type;?>'>execution->$status;?>execution->begin;?>execution->end;?>'>execution->$desc;?>'>execution->teamname;?>'>execution->days;?>{$extendField->name}
    project, "class='form-control picker-select' onchange='sync($executionID, {$executions[$executionID]->project})'");?>name, "class='form-control'");?>code, "class='form-control'");?>' style='overflow:visible'>PM, "class='form-control picker-select'");?>' style='overflow:visible'>PO, "class='form-control picker-select'");?>' style='overflow:visible'>QD, "class='form-control picker-select'");?>' style='overflow:visible'>RD, "class='form-control picker-select'");?>'> - type == 'stage') - { - echo html::select("attributes[$executionID]", $lang->stage->typeList, $executions[$executionID]->attribute, 'class=form-control'); - } - else - { - echo html::select("lifetimes[$executionID]", $lang->execution->lifeTimeList, $executions[$executionID]->lifetime, 'class=form-control'); - } - ?> - '>execution->statusList, $executions[$executionID]->status, 'class=form-control');?>begin, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?>end, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?>'> desc, "rows='1' class='form-control autosize'");?>'>team, "class='form-control'");?>'> -
    - days, "class='form-control'");?> - execution->day;?> -
    -
    - - goback, $this->session->executionList, 'self', '', 'btn btn-wide');;?> -
    -
    -
    -
    -execution->weekend);?> -execution->confirmSync);?> -project);?> - From 41f8454bb45bc70f9513b21a96ab29f1c13e2113 Mon Sep 17 00:00:00 2001 From: wangyuting2 <851424971@qq.com> Date: Wed, 11 May 2022 16:52:02 +0800 Subject: [PATCH 097/125] * Adjust release action menu. --- module/release/model.php | 76 +++++++++++++++++++++++++++++ module/release/view/browse.html.php | 20 +------- module/release/view/view.html.php | 18 +------ 3 files changed, 79 insertions(+), 35 deletions(-) diff --git a/module/release/model.php b/module/release/model.php index 89adcb5dbb..1253044b8d 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -670,4 +670,80 @@ class releaseModel extends model $this->loadModel('mail')->send(implode(',', $toList), $subject, $mailContent, '', false, $emails); } } + + /** + * Build release action menu. + * + * @param object $release + * @param string $type + * @access public + * @return string + */ + public function buildOperateMenu($release, $type = 'view') + { + $function = 'buildOperate' . ucfirst($type) . 'Menu'; + return $this->$function($release); + } + + /** + * Build release view action menu. + * + * @param object $release + * @access public + * @return string + */ + public function buildOperateViewMenu($release) + { + $canBeChanged = common::canBeChanged('release', $release); + if($release->deleted || !$canBeChanged || isonlybody()) return ''; + + $menu = ''; + $params = "releaseID=$release->id"; + + if(common::hasPriv('release', 'changeStatus', $release)) + { + $changedStatus = $release->status == 'normal' ? 'terminate' : 'normal'; + $menu .= html::a(inlink('changeStatus', "releaseID=$release->id&status=$changedStatus"), ' ' . $this->lang->release->changeStatusList[$changedStatus], 'hiddenwin', "class='btn btn-link' title='{$this->lang->release->changeStatusList[$changedStatus]}'"); + } + + $menu .= "
    "; + $menu .= $this->buildFlowMenu('release', $release, 'view', 'direct'); + $menu .= "
    "; + + $menu .= $this->buildMenu('release', 'edit', $params, $release, 'view'); + $menu .= $this->buildMenu('release', 'delete', $params, $release, 'view', 'trash', 'hiddenwin'); + + return $menu; + } + + /** + * Build release browse action menu. + * + * @param object $release + * @access public + * @return string + */ + public function buildOperateBrowseMenu($release) + { + $canBeChanged = common::canBeChanged('release', $release); + if(!$canBeChanged) return ''; + + $menu = ''; + $params = "releaseID=$release->id"; + $changedStatus = $release->status == 'normal' ? 'terminate' : 'normal'; + + if(common::hasPriv('release', 'linkStory')) $menu .= html::a(inlink('view', "$params&type=story&link=true"), ' ', '', "class='btn' title='{$this->lang->release->linkStory}'"); + if(common::hasPriv('release', 'linkBug')) $menu .= html::a(inlink('view', "$params&type=bug&link=true"), ' ', '', "class='btn' title='{$this->lang->release->linkBug}'"); + $menu .= $this->buildMenu('release', 'changeStatus', "$params&status=$changedStatus", $release, 'browse', $release->status == 'normal' ? 'pause' : 'play', 'hiddenwin', '', '', '',$this->lang->release->changeStatusList[$changedStatus]); + $menu .= $this->buildMenu('release', 'edit', "release=$release->id", $release, 'browse'); + $menu .= $this->buildMenu('release', 'notify', "release=$release->id", $release, 'browse', 'bullhorn', '', 'iframe', true); + + if(common::hasPriv('release', 'delete', $release)) + { + $deleteURL = helper::createLink('release', 'delete', "releaseID=$release->id&confirm=yes"); + $menu .= html::a("javascript:ajaxDelete(\"$deleteURL\", \"releaseList\", confirmDelete)", '', '', "class='btn' title='{$this->lang->release->delete}'"); + } + + return $menu; + } } diff --git a/module/release/view/browse.html.php b/module/release/view/browse.html.php index 9ed17da60f..4444a5242b 100644 --- a/module/release/view/browse.html.php +++ b/module/release/view/browse.html.php @@ -80,25 +80,7 @@ " . $this->loadModel('flow')->getFieldValue($extendField, $release) . "";?> - id&type=story&link=true"), ' ', '', "class='btn' title='{$lang->release->linkStory}'"); - if(common::hasPriv('release', 'linkBug')) echo html::a(inlink('view', "releaseID=$release->id&type=bug&link=true"), ' ', '', "class='btn' title='{$lang->release->linkBug}'"); - if(common::hasPriv('release', 'changeStatus', $release)) - { - $changedStatus = $release->status == 'normal' ? 'terminate' : 'normal'; - echo html::a($this->createLink('release', 'changeStatus', "releaseID=$release->id&status=$changedStatus"), ' ', 'hiddenwin', "class='btn' title='{$lang->release->changeStatusList[$changedStatus]}'"); - } - common::printIcon('release', 'edit', "release=$release->id", $release, 'list'); - common::printIcon('release', 'notify', "release=$release->id", $release, 'list', 'bullhorn', '', 'iframe', true); - if(common::hasPriv('release', 'delete', $release)) - { - $deleteURL = $this->createLink('release', 'delete', "releaseID=$release->id&confirm=yes"); - echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"releaseList\", confirmDelete)", '', '', "class='btn' title='{$lang->release->delete}'"); - } - } - ?> + release->buildOperateMenu($release, 'browse');?> diff --git a/module/release/view/view.html.php b/module/release/view/view.html.php index da1fbae9c1..71a3c84d30 100644 --- a/module/release/view/view.html.php +++ b/module/release/view/view.html.php @@ -14,6 +14,7 @@ release->confirmUnlinkStory)?> release->confirmUnlinkBug)?> +
    - deleted and $canBeChanged and !isonlybody()) - { - echo $this->buildOperateMenu($release, 'view'); - - if(common::hasPriv('release', 'changeStatus', $release)) - { - $changedStatus = $release->status == 'normal' ? 'terminate' : 'normal'; - echo html::a(inlink('changeStatus', "releaseID=$release->id&status=$changedStatus"), ' ' . $lang->release->changeStatusList[$changedStatus], 'hiddenwin', "class='btn btn-link' title='{$lang->release->changeStatusList[$changedStatus]}'"); - } - if(common::hasPriv('release', 'edit')) echo html::a(inlink('edit', "releaseID=$release->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); - if(common::hasPriv('release', 'delete')) echo html::a(inlink('delete', "releaseID=$release->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); - } - ?> + release->buildOperateMenu($release, 'view');?>
    From f65a51e5e1498b4dcc1ca98ea0d15c259c10e7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 17:00:59 +0800 Subject: [PATCH 098/125] *Fix bug. --- module/project/config.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/project/config.php b/module/project/config.php index 5330fe9321..c4370e1bd0 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -144,8 +144,8 @@ $config->project->search['fields']['PM'] = $lang->project->PM; $config->project->search['fields']['openedDate'] = $lang->project->openedDate; $config->project->search['fields']['begin'] = $lang->project->begin; $config->project->search['fields']['end'] = $lang->project->end; -$config->project->search['fields']['realBeginAB'] = $lang->project->realBeginAB; -$config->project->search['fields']['realEndAB'] = $lang->project->realEndAB; +$config->project->search['fields']['realBegin'] = $lang->project->realBeginAB; +$config->project->search['fields']['realEnd'] = $lang->project->realEndAB; $config->project->search['fields']['openedBy'] = $lang->project->openedBy; $config->project->search['fields']['closedBy'] = $lang->project->closedBy; $config->project->search['fields']['lastEditedDate'] = $lang->project->lastEditedDate; @@ -162,8 +162,8 @@ $config->project->search['params']['PM'] = array('operator' => '=' $config->project->search['params']['openedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['begin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['end'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); -$config->project->search['params']['realBeginAB'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); -$config->project->search['params']['realEndAB'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realBegin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realEnd'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['openedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); $config->project->search['params']['closedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); $config->project->search['params']['lastEditedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); From 318ccfb4bcc27267d0b3f2b04e77300fff86f657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 09:03:10 +0000 Subject: [PATCH 099/125] Update config.php --- module/project/config.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/project/config.php b/module/project/config.php index c4370e1bd0..c2c56be5c3 100644 --- a/module/project/config.php +++ b/module/project/config.php @@ -144,8 +144,8 @@ $config->project->search['fields']['PM'] = $lang->project->PM; $config->project->search['fields']['openedDate'] = $lang->project->openedDate; $config->project->search['fields']['begin'] = $lang->project->begin; $config->project->search['fields']['end'] = $lang->project->end; -$config->project->search['fields']['realBegin'] = $lang->project->realBeginAB; -$config->project->search['fields']['realEnd'] = $lang->project->realEndAB; +$config->project->search['fields']['realBegin'] = $lang->project->realBeginAB; +$config->project->search['fields']['realEnd'] = $lang->project->realEndAB; $config->project->search['fields']['openedBy'] = $lang->project->openedBy; $config->project->search['fields']['closedBy'] = $lang->project->closedBy; $config->project->search['fields']['lastEditedDate'] = $lang->project->lastEditedDate; @@ -162,8 +162,8 @@ $config->project->search['params']['PM'] = array('operator' => '=' $config->project->search['params']['openedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['begin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['end'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); -$config->project->search['params']['realBegin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); -$config->project->search['params']['realEnd'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realBegin'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); +$config->project->search['params']['realEnd'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); $config->project->search['params']['openedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); $config->project->search['params']['closedBy'] = array('operator' => '=' , 'control' => 'select', 'values' => 'users'); $config->project->search['params']['lastEditedDate'] = array('operator' => '=' , 'control' => 'input' , 'values' => '', 'class' => 'date'); From 0e18988f6acb9a5c810d4ff55bd53bb532f42110 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 11 May 2022 17:05:04 +0800 Subject: [PATCH 100/125] * Fix bug for close product. --- module/product/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index 79493dc5df..a6c1d0ba54 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -2108,7 +2108,7 @@ class productModel extends model $menu .= $this->buildFlowMenu('product', $product, $type, 'direct'); $menu .= "
    "; - $menu .= $this->buildMenu('product', 'close', $params, $product, $type, '', '', '', '', "data-app='product'"); + $menu .= $this->buildMenu('product', 'close', $params, $product, $type, '', '', 'iframe', true, "data-app='product'"); $menu .= "
    "; } From 2bc6e6b468a030ca93da2dac20b8167e74896d4f Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 11 May 2022 09:08:18 +0000 Subject: [PATCH 101/125] * Adjust code --- module/program/model.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index 45ec48e1c4..63e7ee5e0c 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -135,15 +135,14 @@ class programModel extends model * @access public * @return array */ - public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $typeParams = '') + public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $topIdList = '') { - $ids = array(); + $projectIdList = array(); if($type === 'child') { - foreach($typeParams as $topID) + foreach($topIdList as $topID) { - $topIDs = $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); - if($topIDs) $ids = array_merge($ids, $topIDs); + $projectIdList += $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); } } @@ -159,7 +158,7 @@ class programModel extends model ->beginIF($status != 'all')->andWhere('status')->eq($status)->fi() ->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi() ->beginIF($type === 'top')->andWhere('parent')->eq(0)->fi() - ->beginIF(!empty($ids))->andWhere('id')->in($ids)->fi() + ->beginIF(!empty($projectIdList))->andWhere('id')->in($projectIdList)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); From 0fe5a1884f7fcf41bcc3178d534286284b3f04a9 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 11 May 2022 09:11:13 +0000 Subject: [PATCH 102/125] * Adjust code --- module/program/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index 63e7ee5e0c..01c47c2219 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -131,16 +131,16 @@ class programModel extends model * @param string $orderBy * @param object $pager * @param string $type top|child - * @param mixed $typeParams + * @param mixed $idList * @access public * @return array */ - public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $topIdList = '') + public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $idList = '') { $projectIdList = array(); if($type === 'child') { - foreach($topIdList as $topID) + foreach($idList as $topID) { $projectIdList += $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); } From 214259dfc0cd784d561c56dfc3b5da6ccd4cd433 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Wed, 11 May 2022 09:23:03 +0000 Subject: [PATCH 103/125] * Fix bug. --- db/update16.5.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index 4cd109e11e..3b86f8abb9 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -135,8 +135,6 @@ DELETE FROM `zt_workflowfield` WHERE `module`='project' AND `field`='stage'; DELETE FROM `zt_workflowfield` WHERE `module`='bug' AND `field`='feedback'; DELETE FROM `zt_workflowfield` WHERE `module`='task' AND `field`='feedback'; -ALTER TABLE `zt_workflowdatasource` ADD UNIQUE `code` (`code`); - REPLACE INTO `zt_workflowdatasource` (`type`, `name`, `code`, `buildin`, `datasource`, `view`, `keyField`, `valueField`) VALUES ('lang', '项目模型', 'projectModel', '1', 'projectModel', '', '', ''), ('lang', '反馈类型', 'feedbackType', '1', 'feedbackType', '', '', ''), From a2b64debb935aacd5665c70877cfa5a96d2a67ab Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 11 May 2022 09:24:30 +0000 Subject: [PATCH 104/125] * Adjust code --- module/program/control.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index 780397b955..3c8d716d36 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -52,9 +52,9 @@ class program extends control else { $topPrograms = $this->program->getList($status, $orderBy, $pager, 'top'); - $programIDs = array(); - foreach($topPrograms as $programID => $program) $programIDs[] = $programID; - $programs = $this->program->getList($status, $orderBy, null, 'child', $programIDs); + $programIds = array(); + foreach($topPrograms as $programID => $program) $programIds[] = $programID; + $programs = $this->program->getList($status, $orderBy, null, 'child', $programIds); } } From a798dd5f9c051441f6053b4a62c4435716e01420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 17:33:50 +0800 Subject: [PATCH 105/125] *Fix upgrade bug. --- db/update16.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index 4cd109e11e..a841fc8213 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -140,7 +140,7 @@ ALTER TABLE `zt_workflowdatasource` ADD UNIQUE `code` (`code`); REPLACE INTO `zt_workflowdatasource` (`type`, `name`, `code`, `buildin`, `datasource`, `view`, `keyField`, `valueField`) VALUES ('lang', '项目模型', 'projectModel', '1', 'projectModel', '', '', ''), ('lang', '反馈类型', 'feedbackType', '1', 'feedbackType', '', '', ''), -('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''); +('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''), ('lang', '反馈关闭原因', 'feedbackclosedReason', '1', 'feedbackclosedReason', '', '', ''); REPLACE INTO `zt_workflowfield` (`module`, `field`, `type`, `length`, `name`, `control`, `expression`, `options`, `default`, `rules`, `placeholder`, `order`, `searchOrder`, `exportOrder`, `canExport`, `canSearch`, `isValue`, `readonly`, `buildin`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES From 1f72825b20f9114fabff44c8b7ce82c72189602e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 09:36:27 +0000 Subject: [PATCH 106/125] Update update16.5.sql --- db/update16.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index 4cd109e11e..500a338ec4 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -140,7 +140,7 @@ ALTER TABLE `zt_workflowdatasource` ADD UNIQUE `code` (`code`); REPLACE INTO `zt_workflowdatasource` (`type`, `name`, `code`, `buildin`, `datasource`, `view`, `keyField`, `valueField`) VALUES ('lang', '项目模型', 'projectModel', '1', 'projectModel', '', '', ''), ('lang', '反馈类型', 'feedbackType', '1', 'feedbackType', '', '', ''), -('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''); +('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''), ('lang', '反馈关闭原因', 'feedbackclosedReason', '1', 'feedbackclosedReason', '', '', ''); REPLACE INTO `zt_workflowfield` (`module`, `field`, `type`, `length`, `name`, `control`, `expression`, `options`, `default`, `rules`, `placeholder`, `order`, `searchOrder`, `exportOrder`, `canExport`, `canSearch`, `isValue`, `readonly`, `buildin`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES From 2eddac20a1730abf00eb261e74a6c2a26deaf016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Wed, 11 May 2022 09:36:56 +0000 Subject: [PATCH 107/125] Update update16.5.sql --- db/update16.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/update16.5.sql b/db/update16.5.sql index 500a338ec4..a841fc8213 100644 --- a/db/update16.5.sql +++ b/db/update16.5.sql @@ -140,7 +140,7 @@ ALTER TABLE `zt_workflowdatasource` ADD UNIQUE `code` (`code`); REPLACE INTO `zt_workflowdatasource` (`type`, `name`, `code`, `buildin`, `datasource`, `view`, `keyField`, `valueField`) VALUES ('lang', '项目模型', 'projectModel', '1', 'projectModel', '', '', ''), ('lang', '反馈类型', 'feedbackType', '1', 'feedbackType', '', '', ''), -('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''), +('lang', '反馈处理方案', 'feedbackSolution', '1', 'feedbackSolution', '', '', ''), ('lang', '反馈关闭原因', 'feedbackclosedReason', '1', 'feedbackclosedReason', '', '', ''); REPLACE INTO `zt_workflowfield` (`module`, `field`, `type`, `length`, `name`, `control`, `expression`, `options`, `default`, `rules`, `placeholder`, `order`, `searchOrder`, `exportOrder`, `canExport`, `canSearch`, `isValue`, `readonly`, `buildin`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES From ce7c0afdc112b9be7c6c1d171872f11072db1def Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 11 May 2022 18:24:13 +0800 Subject: [PATCH 108/125] * Finish task#53666. --- lib/date/date.class.php | 76 ++++++++++++++--------------- module/execution/control.php | 7 +-- module/execution/css/burn.css | 1 + module/execution/js/burn.js | 12 +++++ module/execution/lang/en.php | 3 ++ module/execution/lang/zh-cn.php | 3 ++ module/execution/model.php | 16 ++++-- module/execution/view/burn.html.php | 23 ++++++++- 8 files changed, 94 insertions(+), 47 deletions(-) diff --git a/lib/date/date.class.php b/lib/date/date.class.php index efdc37eb02..5737e68cb2 100644 --- a/lib/date/date.class.php +++ b/lib/date/date.class.php @@ -9,14 +9,14 @@ * @version $Id: date.class.php 2605 2013-01-09 07:22:58Z wwccss $ * @link http://www.zentao.net */ -class date +class date { /** * Build hour time list. - * - * @param int $begin - * @param int $end - * @param int $delta + * + * @param int $begin + * @param int $end + * @param int $delta * @access public * @return array */ @@ -37,7 +37,7 @@ class date /** * Get today. - * + * * @access public * @return date */ @@ -47,8 +47,8 @@ class date } /** - * Get yesterday - * + * Get yesterday + * * @access public * @return date */ @@ -59,7 +59,7 @@ class date /** * Get tomorrow. - * + * * @access public * @return date */ @@ -70,7 +70,7 @@ class date /** * Get the day before yesterday. - * + * * @access public * @return date */ @@ -81,8 +81,8 @@ class date /** * Get now time period. - * - * @param int $delta + * + * @param int $delta * @access public * @return string the current time period, like 0915 */ @@ -114,8 +114,8 @@ class date /** * Format time 0915 to 09:15 - * - * @param string $time + * + * @param string $time * @access public * @return string */ @@ -127,7 +127,7 @@ class date /** * Get the begin and end date of this week. - * + * * @access public * @return array */ @@ -141,7 +141,7 @@ class date /** * Get the begin and end date of last week. - * + * * @access public * @return array */ @@ -155,7 +155,7 @@ class date /** * Get the time at the middle of this week. - * + * * If today in week is 1, move it one day in future. Else is 7, move it back one day. To keep the time geted in this week. * * @access public @@ -172,7 +172,7 @@ class date /** * Get middle of last week. - * + * * @access public * @return time */ @@ -188,7 +188,7 @@ class date /** * Get begin and end time of this month. - * + * * @access public * @return array */ @@ -201,7 +201,7 @@ class date /** * Get begin and end time of last month. - * + * * @access public * @return array */ @@ -213,11 +213,11 @@ class date } /** - * Get begin and end time of this season. - * + * Get begin and end time of this season. + * * @static * @access public - * @return array + * @return array */ public static function getThisSeason() { @@ -230,11 +230,11 @@ class date } /** - * Get begin and end time of last season. - * + * Get begin and end time of last season. + * * @static * @access public - * @return array + * @return array */ public static function getLastSeason() { @@ -242,43 +242,43 @@ class date $begin = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 2, 1, date('Y'))); $endDay = date('t', mktime(0, 0 , 0, $season * 3, 1, date("Y"))); // Get end day. $end = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, $endDay, date('Y'))); - + return array('begin' => $begin, 'end' => $end); } /** * Get begin and end time of this year. - * + * * @static * @access public - * @return array + * @return array */ public static function getThisYear() { $begin = date(DT_DATE1, strtotime('1/1 this year')) . ' 00:00:00'; - $end = date(DT_DATE1, strtotime('1/1 next year -1 day')) . ' 23:59:59'; + $end = date(DT_DATE1, strtotime('1/1 next year -1 day')) . ' 23:59:59'; return array('begin' => $begin, 'end' => $end); } /** * Get begin and end time of last year. - * + * * @static * @access public - * @return array + * @return array */ public static function getLastYear() { $begin = date(DT_DATE1, strtotime('1/1 last year')) . ' 00:00:00'; - $end = date(DT_DATE1, strtotime('1/1 this year -1 day')) . ' 23:59:59'; + $end = date(DT_DATE1, strtotime('1/1 this year -1 day')) . ' 23:59:59'; return array('begin' => $begin, 'end' => $end); } /** - * Get date list - * - * @param string $begin - * @param string $end + * Get date list + * + * @param string $begin + * @param string $end * @param string $format m/d/Y|Y-m-d * @param string $type noweekend|withweekend * @param int $weekend 2|1 @@ -295,7 +295,7 @@ class date for($date = $begin; $date <= $end; $date += 24 * 3600) { $weekDay = date('w', $date); - if($type == 'noweekend' and (($weekend == 2 and $weekDay == 6) or $weekDay == 0)) continue; + if(strpos($type, 'noweekend') !== false and (($weekend == 2 and $weekDay == 6) or $weekDay == 0)) continue; $dateList[] = date($format, $date); } diff --git a/module/execution/control.php b/module/execution/control.php index be01e4169e..8ed62988e5 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1149,12 +1149,12 @@ class execution extends control * @access public * @return void */ - public function burn($executionID = 0, $type = 'noweekend', $interval = 0, $burnBy = 'left') + public function burn($executionID = 0, $type = 'noweekend,nodelay', $interval = 0, $burnBy = 'left') { $this->loadModel('report'); $execution = $this->commonAction($executionID); $executionID = $execution->id; - $burnBy = $this->cookie->burnBy ? $this->cookie->burnBy : $burnBy; + $burnBy = $this->cookie->burnBy ? $this->cookie->burnBy : $burnBy; /* Header and position. */ $title = $execution->name . $this->lang->colon . $this->lang->execution->burn; @@ -1163,7 +1163,8 @@ class execution extends control /* Get date list. */ $executionInfo = $this->execution->getByID($executionID); - list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $executionInfo->end, $type, $interval, 'Y-m-d'); + $endDate = strpos($type, 'withdelay') !== false ? helper::today() : $executionInfo->end; + list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $endDate, $type, $interval, 'Y-m-d'); $chartData = $this->execution->buildBurnData($executionID, $dateList, $type, $burnBy); $dayList = array_fill(1, floor((int)$execution->days / $this->config->execution->maxBurnDay) + 5, ''); diff --git a/module/execution/css/burn.css b/module/execution/css/burn.css index b954f140ad..71e7d4b506 100644 --- a/module/execution/css/burn.css +++ b/module/execution/css/burn.css @@ -6,5 +6,6 @@ #burnLegend > div {position: relative; padding-left: 30px;} #burnLegend > div > .barline {position: absolute; width: 20px; left: 0; top: 13px; height: 3px; background: #EEEEEE;} #burnLegend .line-real .bg-primary {background: #1183fb;} +#burnLegend .line-real .bg-delay {background: red;} .pull-left .input-control {margin-right: 10px;} diff --git a/module/execution/js/burn.js b/module/execution/js/burn.js index 85e78025cf..192151808a 100644 --- a/module/execution/js/burn.js +++ b/module/execution/js/burn.js @@ -5,6 +5,18 @@ $(function() { location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + type + '&interval=' + $(this).val()); }); + + $('#weekend').click(function() + { + var browseType = type.match('noweekend') ? type.replace('noweekend', 'withweekend') : type.replace('withweekend', 'noweekend'); + location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + browseType + '&interval=' + interval); + }); + + $('#delay').click(function() + { + var browseType = type.match('nodelay') ? type.replace('nodelay', 'withdelay') : type.replace('withdelay', 'nodelay'); + location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + browseType + '&interval=' + interval); + }); }) /* Save burn as image.*/ diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index c9aa6aa2f0..5cff2f8144 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -359,7 +359,9 @@ $lang->execution->linkStory = 'Link Story'; $lang->execution->createTask = 'Create Task'; $lang->execution->goback = "Go Back"; $lang->execution->noweekend = 'Exclude Weekend'; +$lang->execution->nowdelay = 'Exclude Delay Date'; $lang->execution->withweekend = 'Include Weekend'; +$lang->execution->withdelay = 'Include Delay Date'; $lang->execution->interval = 'Intervals '; $lang->execution->fixFirstWithLeft = 'Update hours left too'; $lang->execution->unfinishedExecution = "This {$lang->executionCommon} has "; @@ -384,6 +386,7 @@ $lang->execution->charts->burn->graph->rotateNames = 1; $lang->execution->charts->burn->graph->showValues = 0; $lang->execution->charts->burn->graph->reference = 'Ideal'; $lang->execution->charts->burn->graph->actuality = 'Actual'; +$lang->execution->charts->burn->graph->delay = 'Delay'; $lang->execution->placeholder = new stdclass(); $lang->execution->placeholder->code = "Abbreviation of {$lang->executionCommon} name"; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 9248f804cb..377421ee64 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -359,7 +359,9 @@ $lang->execution->linkStory = "关联{$lang->SRCommon}"; $lang->execution->createTask = '创建任务'; $lang->execution->goback = "返回任务列表"; $lang->execution->noweekend = '去除周末'; +$lang->execution->nodelay = '去除延期日期'; $lang->execution->withweekend = '显示周末'; +$lang->execution->withdelay = '显示延期日期'; $lang->execution->interval = '间隔'; $lang->execution->fixFirstWithLeft = '修改剩余工时'; $lang->execution->unfinishedExecution = "该{$lang->executionCommon}下还有"; @@ -384,6 +386,7 @@ $lang->execution->charts->burn->graph->rotateNames = 1; $lang->execution->charts->burn->graph->showValues = 0; $lang->execution->charts->burn->graph->reference = '参考'; $lang->execution->charts->burn->graph->actuality = '实际'; +$lang->execution->charts->burn->graph->delay = '延期'; $lang->execution->placeholder = new stdclass(); $lang->execution->placeholder->code = '团队内部的简称'; diff --git a/module/execution/model.php b/module/execution/model.php index b3180f1394..9bfb2c0046 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2792,8 +2792,7 @@ class executionModel extends model { $today = helper::today(); $executions = $this->dao->select('id, code')->from(TABLE_EXECUTION) - ->where('end')->ge($today) - ->andWhere('type')->in('sprint,stage') + ->where('type')->in('sprint,stage') ->andWhere('lifetime')->ne('ops') ->andWhere('status')->notin('done,closed,suspended') ->fetchPairs(); @@ -2943,10 +2942,11 @@ class executionModel extends model * * @param int $executionID * @param string $burnBy + * @param bool $showDelay * @access public * @return array */ - public function getBurnDataFlot($executionID = 0, $burnBy = '') + public function getBurnDataFlot($executionID = 0, $burnBy = '', $showDelay = false) { /* Get execution and burn counts. */ $execution = $this->getById($executionID); @@ -2959,7 +2959,8 @@ class executionModel extends model foreach($sets as $date => $set) { if($date < $execution->begin) continue; - if($date > $execution->end) continue; + if(!$showDelay and $date > $execution->end) $set->value = 'null'; + if($showDelay and $date < $execution->end) $set->value = 'null'; $burnData[$date] = $set; $count++; @@ -3648,6 +3649,13 @@ class executionModel extends model $chartData['burnLine'] = $this->report->createSingleJSON($sets, $dateList); $chartData['baseLine'] = $baselineJSON; + $execution = $this->getById($executionID); + if($execution->status != 'closed' and helper::today() > $execution->end) + { + $delaySets = $this->getBurnDataFlot($executionID, $burnBy, true); + $chartData['delayLine'] = $this->report->createSingleJSON($delaySets, $dateList); + } + return $chartData; } diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index 2d0bd26ae7..fd640bf56b 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -18,13 +18,16 @@ execution->burnXUnit);?> execution->burnYUnit);?> +
    @@ -94,6 +100,19 @@ function initBurnChar() }] }; + var delaySets = + { + label: "execution->charts->burn->graph->delay;?>", + color: 'red', + pointStrokeColor: 'red', + pointHighlightStroke: 'red', + pointColor: 'red', + fillColor: 'rgba(0,106,241, .07)', + pointHighlightFill: '#fff', + data: + } + if(type.match('withdelay')) data.datasets.push(delaySets); + var burnChart = $("#burnCanvas").lineChart(data, { pointDotStrokeWidth: 2, From 691de86d4a9ef1058d377f38917df9d2607444c4 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 May 2022 08:15:25 +0800 Subject: [PATCH 109/125] * Code for task#53661. --- module/execution/control.php | 4 +++- module/execution/model.php | 8 +++++--- module/execution/view/burn.html.php | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 8ed62988e5..78e3ee06cc 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1163,7 +1163,8 @@ class execution extends control /* Get date list. */ $executionInfo = $this->execution->getByID($executionID); - $endDate = strpos($type, 'withdelay') !== false ? helper::today() : $executionInfo->end; + $deadline = $execution->status != 'closed' ? helper::today() : substr($execution->closedDate, 0, 10); + $endDate = strpos($type, 'withdelay') !== false ? $deadline : $executionInfo->end; list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $endDate, $type, $interval, 'Y-m-d'); $chartData = $this->execution->buildBurnData($executionID, $dateList, $type, $burnBy); @@ -1928,6 +1929,7 @@ class execution extends control if(!empty($_POST)) { $this->loadModel('action'); + $this->execution->computeBurn($executionID); $changes = $this->execution->close($executionID); if(dao::isError()) return print(js::error(dao::getError())); diff --git a/module/execution/model.php b/module/execution/model.php index 9bfb2c0046..7b40302a85 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2785,16 +2785,18 @@ class executionModel extends model /** * Compute burn of a execution. * + * @param int $executionID * @access public - * @return array + * @return void */ - public function computeBurn() + public function computeBurn($executionID = 0) { $today = helper::today(); $executions = $this->dao->select('id, code')->from(TABLE_EXECUTION) ->where('type')->in('sprint,stage') ->andWhere('lifetime')->ne('ops') ->andWhere('status')->notin('done,closed,suspended') + ->beginIF($executionID)->andWhere('id')->eq($executionID)->fi() ->fetchPairs(); if(!$executions) return array(); @@ -3650,7 +3652,7 @@ class executionModel extends model $chartData['baseLine'] = $baselineJSON; $execution = $this->getById($executionID); - if($execution->status != 'closed' and helper::today() > $execution->end) + if(($execution->status != 'closed' and helper::today() > $execution->end) or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end)) { $delaySets = $this->getBurnDataFlot($executionID, $burnBy, true); $chartData['delayLine'] = $this->report->createSingleJSON($delaySets, $dateList); diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index fd640bf56b..6374ef4835 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -27,7 +27,7 @@ common::printLink('execution', 'computeBurn', 'reload=yes', ' ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'"); echo '
    '; echo html::a('#', $lang->execution->$weekend, '', "class='btn btn-link' id='weekend'"); - if($execution->status != 'closed' and helper::today() > $execution->end) echo html::a('#', $lang->execution->$delay, '', "class='btn btn-link' id='delay'"); + if(($execution->status != 'closed' and helper::today() > $execution->end) or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end)) echo html::a('#', $lang->execution->$delay, '', "class='btn btn-link' id='delay'"); if(common::canModify('execution', $execution)) common::printLink('execution', 'fixFirst', "execution=$execution->id", $lang->execution->fixFirst, '', "class='btn btn-link iframe' data-width='700'"); echo $lang->execution->howToUpdateBurn; ?> @@ -109,7 +109,7 @@ function initBurnChar() pointColor: 'red', fillColor: 'rgba(0,106,241, .07)', pointHighlightFill: '#fff', - data: + data: } if(type.match('withdelay')) data.datasets.push(delaySets); From 1cab87893e38e9559ee4720a6c82db04d2541375 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 May 2022 09:19:49 +0800 Subject: [PATCH 110/125] * Finish task#53661. --- module/execution/control.php | 1 + module/execution/model.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/module/execution/control.php b/module/execution/control.php index 78e3ee06cc..060128b0f2 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1834,6 +1834,7 @@ class execution extends control if(!empty($_POST)) { $this->loadModel('action'); + $this->execution->computeBurn($executionID); $changes = $this->execution->suspend($executionID); if(dao::isError()) return print(js::error(dao::getError())); diff --git a/module/execution/model.php b/module/execution/model.php index 7b40302a85..37e7304e64 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -481,6 +481,8 @@ class executionModel extends model ->remove('products, branch, uid, plans, syncStories, contactListMenu, teamMembers') ->get(); + if(in_array($execution->status, array('closed', 'suspended'))) $this->computeBurn($executionID); + if($this->config->systemMode == 'new' and (empty($execution->project) or $execution->project == $oldExecution->project)) $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end); if(dao::isError()) return false; From ffa1ec828df11d7ca2987217f043dd6644ababfa Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 May 2022 10:38:22 +0800 Subject: [PATCH 111/125] * Code for task#53661. --- module/execution/control.php | 2 +- module/execution/model.php | 5 ++++- module/execution/view/burn.html.php | 13 ++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 060128b0f2..44c81b6cd1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1163,7 +1163,7 @@ class execution extends control /* Get date list. */ $executionInfo = $this->execution->getByID($executionID); - $deadline = $execution->status != 'closed' ? helper::today() : substr($execution->closedDate, 0, 10); + $deadline = strpos('closed,suspended', $execution->status) === false ? helper::today() : ($execution->status == 'closed' ? substr($execution->closedDate, 0, 10) : $execution->suspendedDate); $endDate = strpos($type, 'withdelay') !== false ? $deadline : $executionInfo->end; list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $endDate, $type, $interval, 'Y-m-d'); $chartData = $this->execution->buildBurnData($executionID, $dateList, $type, $burnBy); diff --git a/module/execution/model.php b/module/execution/model.php index 37e7304e64..25be47604a 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -827,6 +827,7 @@ class executionModel extends model ->setDefault('status', 'suspended') ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) + ->setDefault('suspendedDate', helper::today()) ->remove('comment')->get(); $this->dao->update(TABLE_EXECUTION)->data($execution) @@ -3654,7 +3655,9 @@ class executionModel extends model $chartData['baseLine'] = $baselineJSON; $execution = $this->getById($executionID); - if(($execution->status != 'closed' and helper::today() > $execution->end) or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end)) + if((strpos('closed,suspended', $execution->status) === false and helper::today() > $execution->end) + or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end) + or ($execution->status == 'suspended' and $execution->suspendedDate > $execution->end)) { $delaySets = $this->getBurnDataFlot($executionID, $burnBy, true); $chartData['delayLine'] = $this->report->createSingleJSON($delaySets, $dateList); diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index 6374ef4835..b1f9af0f86 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -24,10 +24,17 @@ ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'"); - echo '
    '; + if(strpos('closed,suspended', $execution->status) === false) + { + common::printLink('execution', 'computeBurn', 'reload=yes', ' ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'"); + echo '
    '; + } echo html::a('#', $lang->execution->$weekend, '', "class='btn btn-link' id='weekend'"); - if(($execution->status != 'closed' and helper::today() > $execution->end) or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end)) echo html::a('#', $lang->execution->$delay, '', "class='btn btn-link' id='delay'"); + if((strpos('closed,suspended', $execution->status) === false and helper::today() > $execution->end) + or ($execution->status == 'closed' and substr($execution->closedDate, 0, 10) > $execution->end) + or ($execution->status == 'suspended' and $execution->suspendedDate > $execution->end)) + echo html::a('#', $lang->execution->$delay, '', "class='btn btn-link' id='delay'"); + if(common::canModify('execution', $execution)) common::printLink('execution', 'fixFirst', "execution=$execution->id", $lang->execution->fixFirst, '', "class='btn btn-link iframe' data-width='700'"); echo $lang->execution->howToUpdateBurn; ?> From dab8c1bb1ea8917ee4164b821bcd5410d092c9d6 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 May 2022 10:55:50 +0800 Subject: [PATCH 112/125] * Modify review code. --- module/execution/control.php | 3 ++- module/execution/view/burn.html.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 44c81b6cd1..3c03258f1d 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1163,7 +1163,8 @@ class execution extends control /* Get date list. */ $executionInfo = $this->execution->getByID($executionID); - $deadline = strpos('closed,suspended', $execution->status) === false ? helper::today() : ($execution->status == 'closed' ? substr($execution->closedDate, 0, 10) : $execution->suspendedDate); + $deadline = $execution->status == 'closed' ? substr($execution->closedDate, 0, 10) : $execution->suspendedDate; + $deadline = strpos('closed,suspended', $execution->status) === false ? helper::today() : $deadline; $endDate = strpos($type, 'withdelay') !== false ? $deadline : $executionInfo->end; list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $endDate, $type, $interval, 'Y-m-d'); $chartData = $this->execution->buildBurnData($executionID, $dateList, $type, $burnBy); diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index b1f9af0f86..d84e0a834b 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -24,7 +24,7 @@ status) === false) + if(strpos('wait,doing', $execution->status) !== false) { common::printLink('execution', 'computeBurn', 'reload=yes', ' ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'"); echo '
    '; From 612a2b656efc3486cf5369d24c50b3e2a96475c7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 May 2022 00:18:05 +0800 Subject: [PATCH 113/125] * Adjust code style. --- module/execution/model.php | 2 +- module/execution/view/burn.html.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 25be47604a..e886b3c703 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2790,7 +2790,7 @@ class executionModel extends model * * @param int $executionID * @access public - * @return void + * @return array */ public function computeBurn($executionID = 0) { diff --git a/module/execution/view/burn.html.php b/module/execution/view/burn.html.php index d84e0a834b..81ea61c552 100644 --- a/module/execution/view/burn.html.php +++ b/module/execution/view/burn.html.php @@ -22,13 +22,14 @@