|
<?php |
|
|
|
namespace Kanboard\Action; |
|
|
|
use Kanboard\Model\TaskModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CommentCreationMoveTaskColumn extends Base |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getDescription() |
|
{ |
|
return t('Add a comment log when moving the task between columns'); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getCompatibleEvents() |
|
{ |
|
return array( |
|
TaskModel::EVENT_MOVE_COLUMN, |
|
); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getActionRequiredParameters() |
|
{ |
|
return array('column_id' => t('Column')); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getEventRequiredParameters() |
|
{ |
|
return array( |
|
'task_id', |
|
'task' => array( |
|
'column_id', |
|
'project_id', |
|
), |
|
); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function doAction(array $data) |
|
{ |
|
if (! $this->userSession->isLogged()) { |
|
return false; |
|
} |
|
|
|
$column = $this->columnModel->getById($data['task']['column_id']); |
|
|
|
return (bool) $this->commentModel->create(array( |
|
'comment' => t('Moved to column %s', $column['title']), |
|
'task_id' => $data['task_id'], |
|
'user_id' => $this->userSession->getId(), |
|
)); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function hasRequiredCondition(array $data) |
|
{ |
|
return $data['task']['column_id'] == $this->getParam('column_id'); |
|
} |
|
} |
|
|