Use task description templates in bulk task creation
This commit is contained in:
parent
78a2d3142c
commit
e6f8a76a18
|
|
@ -35,6 +35,7 @@ class TaskBulkController extends BaseController
|
||||||
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private'] == 1),
|
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id'], true, false, $project['is_private'] == 1),
|
||||||
'colors_list' => $this->colorModel->getList(),
|
'colors_list' => $this->colorModel->getList(),
|
||||||
'categories_list' => $this->categoryModel->getList($project['id']),
|
'categories_list' => $this->categoryModel->getList($project['id']),
|
||||||
|
'task_description_templates' => $this->predefinedTaskDescriptionModel->getList($project['id']),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,8 +86,18 @@ class TaskBulkController extends BaseController
|
||||||
'owner_id' => empty($values['owner_id']) ? 0 : $values['owner_id'],
|
'owner_id' => empty($values['owner_id']) ? 0 : $values['owner_id'],
|
||||||
'color_id' => $values['color_id'],
|
'color_id' => $values['color_id'],
|
||||||
'project_id' => $project['id'],
|
'project_id' => $project['id'],
|
||||||
|
'description' => $this->getTaskDescription($project, $values),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getTaskDescription(array $project, array $values)
|
||||||
|
{
|
||||||
|
if (empty($values['task_description_template_id'])) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->predefinedTaskDescriptionModel->getDescriptionById($project['id'], $values['task_description_template_id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
'Template removed successfully.' => 'Modèle supprimé avec succès.',
|
'Template removed successfully.' => 'Modèle supprimé avec succès.',
|
||||||
'Unable to remove this template.' => 'Impossible de supprimer ce modèle.',
|
'Unable to remove this template.' => 'Impossible de supprimer ce modèle.',
|
||||||
'Description Templates' => 'Modèles de description',
|
'Description Templates' => 'Modèles de description',
|
||||||
|
'Template for the task description' => 'Modèle pour la description des tâches',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1362,4 +1362,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1356,4 +1356,5 @@ return array(
|
||||||
// 'Template removed successfully.' => '',
|
// 'Template removed successfully.' => '',
|
||||||
// 'Unable to remove this template.' => '',
|
// 'Unable to remove this template.' => '',
|
||||||
// 'Description Templates' => '',
|
// 'Description Templates' => '',
|
||||||
|
// 'Template for the task description' => '',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,21 @@ class PredefinedTaskDescriptionModel extends Base
|
||||||
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->findAll();
|
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getList($projectId)
|
||||||
|
{
|
||||||
|
return array('' => t('None')) + $this->db->hashtable(self::TABLE)->eq('project_id', $projectId)->getAll('id', 'title');
|
||||||
|
}
|
||||||
|
|
||||||
public function getById($projectId, $id)
|
public function getById($projectId, $id)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->eq('id', $id)->findOne();
|
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->eq('id', $id)->findOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDescriptionById($projectId, $id)
|
||||||
|
{
|
||||||
|
return $this->db->table(self::TABLE)->eq('project_id', $projectId)->eq('id', $id)->findOneColumn('description');
|
||||||
|
}
|
||||||
|
|
||||||
public function create($projectId, $title, $description)
|
public function create($projectId, $title, $description)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)->persist(array(
|
return $this->db->table(self::TABLE)->persist(array(
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,16 @@
|
||||||
<?= $this->form->csrf() ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('column_id', $values) ?>
|
<?= $this->form->hidden('column_id', $values) ?>
|
||||||
<?= $this->form->hidden('swimlane_id', $values) ?>
|
<?= $this->form->hidden('swimlane_id', $values) ?>
|
||||||
<?= $this->form->hidden('project_id', $values) ?>
|
|
||||||
|
|
||||||
<?= $this->task->renderColorField($values) ?>
|
<?= $this->task->renderColorField($values) ?>
|
||||||
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
|
<?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
|
||||||
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
|
<?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
|
||||||
|
|
||||||
|
<?php if (! empty($task_description_templates)): ?>
|
||||||
|
<?= $this->form->label(t('Template for the task description'), 'task_description_template_id') ?>
|
||||||
|
<?= $this->form->select('task_description_template_id', $task_description_templates, $values, $errors) ?>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $this->form->label(t('Tasks'), 'tasks') ?>
|
<?= $this->form->label(t('Tasks'), 'tasks') ?>
|
||||||
<?= $this->form->textarea('tasks', $values, $errors, array('placeholder="'.t('My task title').'"')) ?>
|
<?= $this->form->textarea('tasks', $values, $errors, array('placeholder="'.t('My task title').'"')) ?>
|
||||||
<p class="form-help"><?= t('Enter one task by line.') ?></p>
|
<p class="form-help"><?= t('Enter one task by line.') ?></p>
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,6 @@ class TaskValidator extends BaseValidator
|
||||||
public function validateBulkCreation(array $values)
|
public function validateBulkCreation(array $values)
|
||||||
{
|
{
|
||||||
$rules = array(
|
$rules = array(
|
||||||
new Validators\Required('project_id', t('The project is required')),
|
|
||||||
new Validators\Required('tasks', t('Field required')),
|
new Validators\Required('tasks', t('Field required')),
|
||||||
new Validators\Required('column_id', t('Field required')),
|
new Validators\Required('column_id', t('Field required')),
|
||||||
new Validators\Required('swimlane_id', t('Field required')),
|
new Validators\Required('swimlane_id', t('Field required')),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue