From 809ce930370f2a86f0e387c15ad9e405ca0f7b3a Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Sat, 7 May 2022 17:27:37 +0800 Subject: [PATCH 01/19] * 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 540f6aba4e229b1bd930823a35afb094302d0362 Mon Sep 17 00:00:00 2001 From: sunjun Date: Mon, 9 May 2022 00:56:40 +0000 Subject: [PATCH 02/19] sunjun_test_block --- test/model/block/getprojectparams.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/model/block/getprojectparams.php b/test/model/block/getprojectparams.php index 473a3b6208..89088ad4ab 100755 --- a/test/model/block/getprojectparams.php +++ b/test/model/block/getprojectparams.php @@ -10,10 +10,10 @@ title=测试 blockModel->getProjectParams(); cid=1 pid=1 - +获取计划参数 >> {"type":{"name":"\u7c7b\u578b","options":{"all":"\u6240\u6709","doing":"\u8fdb\u884c\u4e2d","wait":"\u672a\u5f00\u59cb","suspended":"\u5df2\u6302\u8d77","closed":"\u5df2\u5173\u95ed"},"control":"select"},"orderBy":{"name":"\u6392\u5e8f","options":{"id_asc":"ID \u9012\u589e","id_desc":"ID \u9012\u51cf","status_asc":"\u72b6\u6001\u6b63\u5e8f","status_desc":"\u72b6\u6001\u5012\u5e8f"},"control":"select"},"count":{"name":"\u6570\u91cf","default":20,"control":"input"}} */ $block = new blockTest(); -r($block->getProjectParamsTest()) && p() && e(); \ No newline at end of file +r($block->getProjectParamsTest()) && p() && e('{"type":{"name":"\u7c7b\u578b","options":{"all":"\u6240\u6709","doing":"\u8fdb\u884c\u4e2d","wait":"\u672a\u5f00\u59cb","suspended":"\u5df2\u6302\u8d77","closed":"\u5df2\u5173\u95ed"},"control":"select"},"orderBy":{"name":"\u6392\u5e8f","options":{"id_asc":"ID \u9012\u589e","id_desc":"ID \u9012\u51cf","status_asc":"\u72b6\u6001\u6b63\u5e8f","status_desc":"\u72b6\u6001\u5012\u5e8f"},"control":"select"},"count":{"name":"\u6570\u91cf","default":20,"control":"input"}}'); //获取计划参数 \ 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 03/19] * 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 04/19] * 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 05/19] * 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 06/19] * 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 07/19] 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 84ad06f3eca28ee82dac4f4eb0117641b75c4f7c Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 01:37:07 +0000 Subject: [PATCH 08/19] *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 09/19] * 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 39b77f36b6b2dadf5987e23c00e014d597ba3b14 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 10 May 2022 13:24:06 +0800 Subject: [PATCH 10/19] * 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 11/19] * 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 12/19] * 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 631601a39bbbddcd5f2c0b7ed794699b62f8f88b Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 06:42:34 +0000 Subject: [PATCH 13/19] 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 d88c1310b6a1bdad3636e8cccd28a14ae3d14682 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 10 May 2022 07:37:12 +0000 Subject: [PATCH 14/19] 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 15/19] 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 16/19] 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 17/19] 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 18/19] 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 19/19] 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();