* Code for task#67691.
This commit is contained in:
@@ -537,20 +537,16 @@ class task extends control
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$changes = array();
|
||||
$files = array();
|
||||
if($comment == false)
|
||||
{
|
||||
$changes = $this->task->update($taskID);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
$files = $this->loadModel('file')->saveUpload('task', $taskID);
|
||||
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 = !empty($files) ? $this->lang->addFiles . join(',', $files) . "\n" : '';
|
||||
$actionID = $this->action->create('task', $taskID, $action, $fileAction . $this->post->comment);
|
||||
$action = !empty($changes) ? 'Edited' : 'Commented';
|
||||
$actionID = $this->action->create('task', $taskID, $action, $this->post->comment);
|
||||
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
|
||||
+19
-3
@@ -1075,6 +1075,7 @@ class taskModel extends model
|
||||
->setDefault('story, estimate, left, consumed', 0)
|
||||
->setDefault('realStarted', '0000-00-00 00:00:00')
|
||||
->setDefault('mailto', '')
|
||||
->setDefault('deleteFiles', array())
|
||||
->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate)
|
||||
->setIF(is_numeric($this->post->consumed), 'consumed', (float)$this->post->consumed)
|
||||
->setIF(is_numeric($this->post->left), 'left', (float)$this->post->left)
|
||||
@@ -1158,7 +1159,7 @@ class taskModel extends model
|
||||
|
||||
$requiredFields = trim($requiredFields, ',');
|
||||
|
||||
$this->dao->update(TABLE_TASK)->data($task)
|
||||
$this->dao->update(TABLE_TASK)->data($task, 'deleteFiles')
|
||||
->autoCheck()
|
||||
->batchCheckIF($task->status != 'cancel', $requiredFields, 'notempty')
|
||||
->checkIF(!helper::isZeroDate($task->deadline), 'deadline', 'ge', $task->estStarted)
|
||||
@@ -1247,12 +1248,10 @@ class taskModel extends model
|
||||
if(!empty($changes)) $this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
}
|
||||
$this->file->updateObjectID($this->post->uid, $taskID, 'task');
|
||||
|
||||
unset($oldTask->parent);
|
||||
unset($task->parent);
|
||||
|
||||
|
||||
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $oldTask->feedback) $this->loadModel('feedback')->updateStatus('task', $oldTask->feedback, $task->status, $oldTask->status);
|
||||
|
||||
if(isset($oldTask->team))
|
||||
@@ -1269,6 +1268,23 @@ class taskModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
$oldTaskFiles = empty($oldTask->files) ? '' : join(',', array_keys($oldTask->files));
|
||||
if(!empty($task->deleteFiles))
|
||||
{
|
||||
$this->dao->delete()->from(TABLE_FILE)->where('id')->in($task->deleteFiles)->exec();
|
||||
foreach($task->deleteFiles as $fileID)
|
||||
{
|
||||
@unlink($oldTask->files[$fileID]->realPath);
|
||||
$oldTaskFiles = empty($oldTaskFiles) ? '' : str_replace(",$fileID,", ',', ",$oldTaskFiles,");
|
||||
}
|
||||
}
|
||||
|
||||
$this->file->updateObjectID($this->post->uid, $taskID, 'task');
|
||||
$addedFiles = $this->loadModel('file')->saveUpload('task', $taskID);
|
||||
$addedFiles = empty($addedFiles) ? '' : ',' . join(',', array_keys($addedFiles));
|
||||
$task->files = trim($oldTaskFiles . $addedFiles, ',');
|
||||
$oldTask->files = join(',', array_keys($oldTask->files));
|
||||
|
||||
return common::createChanges($oldTask, $task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,10 @@ foreach(explode(',', $config->task->edit->requiredFields) as $field)
|
||||
<?php $this->printExtendFields($task, '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' => $task->files, 'fieldset' => 'false', 'object' => $task, 'method' => 'edit'));?>
|
||||
<?php echo $this->fetch('file', 'buildform');?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='detail text-center form-actions'>
|
||||
<?php echo html::hidden('lastEditedDate', $task->lastEditedDate);?>
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php
|
||||
echo $this->fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true', 'object' => $task));
|
||||
echo $this->fetch('file', 'printFiles', array('files' => $task->files, 'fieldset' => 'true', 'object' => $task, 'method' => 'view', 'showDelete' => false));
|
||||
|
||||
$canBeChanged = common::canBeChanged('task', $task);
|
||||
if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=task&objectID=$task->id");
|
||||
|
||||
Reference in New Issue
Block a user