解决bug时,需添加“附件”功能已解决 悬赏5积分
在assignto.html.php中已经添加显示,但是在提交时始终不能写入数据库,在model和control中均不断尝试,(是不是哪里有遗漏)陷入困境(初学者)
control代码如下
public function assignTo($bugID)
{
$bug = $this->bug->getById($bugID);
/* Set menu. */
$this->bug->setMenu($this->products, $bug->product);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->bug->assign($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
$fileAction = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : '';
$actionID = $this->action->create('bug', $bugID, 'Assigned', $fileAction . $this->post->comment, $this->post->assignedTo);
$this->action->logHistory($actionID, $changes);
$this->sendmail($bugID, $actionID);
if(isonlybody()) die(js::closeModal('parent.parent'));
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
$this->view->title = $this->products[$bug->product] . $this->lang->colon . $this->lang->bug->assignedTo;
$this->view->position[] = $this->lang->bug->assignedTo;
$this->view->users = $this->user->getPairs('nodeleted', $bug->assignedTo);
$this->view->bug = $bug;
$this->view->bugID = $bugID;
$this->view->actions = $this->action->getList('bug', $bugID);
$this->display();
}
model代码如下:
public function assign($bugID)
{
$now = helper::now();
$oldBug = $this->getById($bugID);
$bug = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->setDefault('assignedDate', $now)
->remove('comment,files,labels')
->join('mailto', ',')
->get();
$this->dao->update(TABLE_BUG)
->data($bug)
->autoCheck()
->where('id')->eq($bugID)->exec();
if(!dao::isError())
{
$bugID = $this->dao->lastInsertID();
$this->loadModel('file')->saveUpload('bug', $bugID);
return common::createChanges($oldBug, $bug);
}
}
禅道版本:7.3
安装包类型:源码包
操作系统:Windows 7
客户端浏览器:Chrome
石洋洋
2017-02-24 14:17:53
升级到禅道最新版本:
回复
|