* Code for task#67691.
This commit is contained in:
@@ -969,17 +969,15 @@ class bug extends control
|
||||
return print(js::error(dao::getError()));
|
||||
}
|
||||
}
|
||||
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
|
||||
if(empty($files) and $this->post->uid != '' and isset($_SESSION['album']['used'][$this->post->uid])) $files = $this->file->getPairs($_SESSION['album']['used'][$this->post->uid]);
|
||||
}
|
||||
if($this->post->comment != '' or !empty($changes) or !empty($files))
|
||||
|
||||
if($this->post->comment != '' or !empty($changes))
|
||||
{
|
||||
$action = (!empty($changes) or !empty($files)) ? 'Edited' : 'Commented';
|
||||
$fileAction = '';
|
||||
if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ;
|
||||
$actionID = $this->action->create('bug', $bugID, $action, $fileAction . $this->post->comment);
|
||||
$action = !empty($changes) ? 'Edited' : 'Commented';
|
||||
$actionID = $this->action->create('bug', $bugID, $action, $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'data' => $bugID));
|
||||
$bug = $this->bug->getById($bugID);
|
||||
|
||||
|
||||
+19
-2
@@ -687,7 +687,7 @@ class bugModel extends model
|
||||
*/
|
||||
public function update($bugID)
|
||||
{
|
||||
$oldBug = $this->dao->select('*')->from(TABLE_BUG)->where('id')->eq((int)$bugID)->fetch();
|
||||
$oldBug = $this->getById($bugID);
|
||||
if(!empty($_POST['lastEditedDate']) and $oldBug->lastEditedDate != $this->post->lastEditedDate)
|
||||
{
|
||||
dao::$errors[] = $this->lang->error->editedByOther;
|
||||
@@ -707,6 +707,7 @@ class bugModel extends model
|
||||
->setDefault('resolvedDate', '0000-00-00 00:00:00')
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('mailto', '')
|
||||
->setDefault('deleteFiles', array())
|
||||
->add('lastEditedDate', $now)
|
||||
->setIF(strpos($this->config->bug->edit->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline)
|
||||
->join('openedBuild', ',')
|
||||
@@ -736,7 +737,7 @@ class bugModel extends model
|
||||
->get();
|
||||
|
||||
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->edit['id'], $this->post->uid);
|
||||
$this->dao->update(TABLE_BUG)->data($bug)
|
||||
$this->dao->update(TABLE_BUG)->data($bug, 'deleteFiles')
|
||||
->autoCheck()
|
||||
->batchCheck($this->config->bug->edit->requiredFields, 'notempty')
|
||||
->checkIF($bug->resolvedBy, 'resolution', 'notempty')
|
||||
@@ -783,7 +784,23 @@ class bugModel extends model
|
||||
}
|
||||
|
||||
if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bugID);
|
||||
|
||||
$oldBugFiles = empty($oldBug->files) ? '' : join(',', array_keys($oldBug->files));
|
||||
if(!empty($bug->deleteFiles))
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_FILE)->where('id')->in($bug->deleteFiles)->exec();
|
||||
foreach($bug->deleteFiles as $fileID)
|
||||
{
|
||||
@unlink($oldBug->files[$fileID]->realPath);
|
||||
$oldBugFiles = empty($oldBugFiles) ? '' : str_replace(",$fileID,", ',', ",$oldBugFiles,");
|
||||
}
|
||||
}
|
||||
|
||||
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
|
||||
$addedFiles = $this->loadModel('file')->saveUpload('bug', $bugID);
|
||||
$addedFiles = empty($addedFiles) ? '' : ',' . join(',', array_keys($addedFiles));
|
||||
$bug->files = trim($oldBugFiles . $addedFiles, ',');
|
||||
$oldBug->files = join(',', array_keys($oldBug->files));
|
||||
|
||||
if($bug->execution and $bug->status != $oldBug->status) $this->loadModel('kanban')->updateLane($bug->execution, 'bug');
|
||||
|
||||
|
||||
@@ -72,7 +72,10 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
|
||||
<?php $this->printExtendFields($bug, 'div', 'position=left');?>
|
||||
<div class="detail">
|
||||
<div class="detail-title"><?php echo $lang->files;?></div>
|
||||
<div class='detail-content'><?php echo $this->fetch('file', 'buildform');?></div>
|
||||
<div class='detail-content'>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $bug->files, 'fieldset' => 'false', 'object' => $bug, 'method' => 'edit'));?>
|
||||
<?php echo $this->fetch('file', 'buildform');?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='actions form-actions text-center'>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $bug->files, 'fieldset' => 'true', 'object' => $bug));?>
|
||||
<?php echo $this->fetch('file', 'printFiles', array('files' => $bug->files, 'fieldset' => 'true', 'object' => $bug, 'method' => 'view', 'showDelete' => false));?>
|
||||
<?php
|
||||
$canBeChanged = common::canBeChanged('bug', $bug);
|
||||
if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=bug&objectID=$bug->id");
|
||||
|
||||
Reference in New Issue
Block a user