标题 - 设计出现偏差,需求重新设计
+标题 - 设计出现偏差,需求重新设计
+From 1288cc0803e836cad1fd0b9902a50c5622493708 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Wed, 19 Aug 2020 15:40:59 +0800 Subject: [PATCH 1/9] * Add batchCreate method. --- module/issue/control.php | 26 ++++++++++ module/issue/model.php | 41 +++++++++++++++- module/issue/view/batchcreate.html.php | 66 ++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 module/issue/view/batchcreate.html.php diff --git a/module/issue/control.php b/module/issue/control.php index d6c4231c56..b537006768 100644 --- a/module/issue/control.php +++ b/module/issue/control.php @@ -53,4 +53,30 @@ class issue extends control $this->display(); } + + + /** + * batchCreate issues + * + * @access public + * @return void + */ + public function batchCreate() + { + if($_POST) + { + $results = $this->issue->batchCreate(); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse', 'browseType=all'))); + } + + $this->view->title = $this->lang->issue->common . $this->lang->colon . $this->lang->issue->batchCreate; + $this->view->position[] = $this->lang->issue->common; + $this->view->position[] = $this->lang->issue->batchCreate; + + $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted'); + + $this->display(); + } + } diff --git a/module/issue/model.php b/module/issue/model.php index 7e2e8cc72c..0f53e7d601 100644 --- a/module/issue/model.php +++ b/module/issue/model.php @@ -15,7 +15,7 @@ class issueModel extends model { public function create() { - $now = helper::now(); + $now = helper::now(); $data = fixer::input('post') ->add('createdBy', $this->app->user->account) ->add('createdDate', $now) @@ -45,4 +45,43 @@ class issueModel extends model $this->dao->insert(TABLE_ISSUE)->data($data)->exec(); return true; } + + /** + * Batch create issue. + * + * @access public + * @return void + */ + public function batchCreate() + { + $now = helper::now(); + $data = fixer::input('post')->get(); + + $issues = array(); + foreach($data->dataList as $issue) + { + if(!trim($issue['title'])) continue; + + $issue['createdBy'] = $this->app->user->account; + $issue['createdDate'] = $now; + + if($issue['assignedTo']) + { + $issue['assignedBy'] = $this->app->user->account; + $issue['assignedDate'] = $now; + } + + foreach(explode(',',$this->config->issue->create->requiredFields) as $field) + { + $field = trim($field); + if($field and empty($issue["$field"])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->issue->$field))); + } + + $issues[] = $issue; + } + + foreach($issues as $issue) $this->dao->insert(TABLE_ISSUE)->data($issue)->exec(); + + return true; + } } diff --git a/module/issue/view/batchcreate.html.php b/module/issue/view/batchcreate.html.php new file mode 100644 index 0000000000..62331b46a4 --- /dev/null +++ b/module/issue/view/batchcreate.html.php @@ -0,0 +1,66 @@ + + * @package issue + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
标题 - 设计出现偏差,需求重新设计
+标题 - 设计出现偏差,需求重新设计
+| issue->type;?> | ++ + |
|---|
| risk->id;?> | +id;?> | +
|---|---|
| risk->source;?> | +risk->sourceList, $risk->source);?> | +
| risk->category;?> | +risk->categoryList, $risk->category);?> | +
| risk->strategy;?> | +risk->strategy, $risk->strategy);?> | +
| risk->status;?> | +processStatus('risk', $risk);?> | +
| risk->impact;?> | +risk->impact, $risk->impact);?> | +
| risk->probability;?> | +risk->probability, $risk->probability);?> | +
| risk->riskindex;?> | +riskindex;?> | +
| risk->pri;?> | +pri;?>' title='risk->priList, $risk->pri)?>'>risk->priList, $risk->pri)?> | +
| risk->identifiedDate;?> | +identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate;?> | +
| risk->plannedClosedDate;?> | +plannedClosedDate == '0000-00-00' ? '' : $risk->plannedClosedDate;?> | +
| risk->actualClosedDate;?> | +actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate;?> | +
| risk->assignedTo;?> | +assignedTo);?> | +
|---|---|
| risk->trackedBy;?> | +trackedBy);?> | +
| risk->trackedDate;?> | +trackedDate == '0000-00-00' ? '' : $risk->trackedDate;?> | +
| risk->createdBy;?> | +createdBy);?> | +
| risk->createdDate;?> | +createdDate == '0000-00-00' ? '' : $risk->createdDate;?> | +
| risk->editedBy;?> | +editedBy);?> | +
| risk->editedDate;?> | +editedDate == '0000-00-00' ? '' : $risk->editedDate;?> | +
| risk->assignedDate;?> | +assignedDate == '0000-00-00' ? '' : $risk->assignedDate;?> | +
| risk->resolvedBy;?> | +resolvedBy);?> | +
| risk->actualClosedDate;?> | +actualClosedDate == '0000-00-00' ? '' : $risk->actualClosedDate;?> | +
| risk->cancelBy;?> | +cancelBy);?> | +
| risk->cancelDate;?> | +cancelDate == '0000-00-00' ? '' : $risk->cancelDate;?> | +
| risk->cancelReason;?> | +risk->cancelReasonList, $risk->cancelReason);?> | +
| risk->hangupBy;?> | +hangupBy);?> | +
| risk->hangupDate;?> | +hangupDate == '0000-00-00' ? '' : $risk->hangupDate;?> | +
| risk->activateBy;?> | +activateBy);?> | +
| risk->activateDate;?> | +activateDate == '0000-00-00' ? '' : $risk->activateDate;?> | +